Skip to content

[v14] Error occurs when specifying a custom theme. #1634

Open
@shsatovg

Description

@shsatovg

Description

Error occurs when specifying custom theme on v14 series.

How are you running documentation.js

Node.js API

Version

documentation.js version:v14.0.3
Node.js version: v20.10.0
OS: Windows 10

The current behavior

When I specify the custom theme and run it, I get the following error in the console log.

node:internal/modules/esm/load:236
    throw new ERR_UNSUPPORTED_ESM_URL_SCHEME(parsed, schemes);
          ^

Error [ERR_UNSUPPORTED_ESM_URL_SCHEME]: Only URLs with a scheme in: file, data, and node are supported by the default ESM loader. On Windows, absolute paths must be valid file:// URLs. Received protocol
'c:'
    at throwIfUnsupportedURLScheme (node:internal/modules/esm/load:236:11)
    at defaultLoad (node:internal/modules/esm/load:128:3)
    at ModuleLoader.load (node:internal/modules/esm/loader:409:13)
    at ModuleLoader.moduleProvider (node:internal/modules/esm/loader:291:56)
    at new ModuleJob (node:internal/modules/esm/module_job:65:26)
    at #createModuleJob (node:internal/modules/esm/loader:303:17)
    at ModuleLoader.getJobFromResolveResult (node:internal/modules/esm/loader:260:34)
    at ModuleLoader.getModuleJob (node:internal/modules/esm/loader:241:17)
    at async ModuleLoader.import (node:internal/modules/esm/loader:328:23) {
  code: 'ERR_UNSUPPORTED_ESM_URL_SCHEME'
}

The expected behavior

Specify the custom theme and run it to output documentation with the custom theme applied.

input code,output documentation

For all codes that do not depend on the input code, output documentation is not printed and an error is generated in the console. (More information on console errors can be found in "The current behavior".)

Steps To Reproduce

    1. Create new project folder & npm initialize
    • mkdir doc && cd doc && npm init -y
    1. Install documentation.js
    • npm i -D documentation@latest
    1. Create custom theme (copy defalut theme to create custom theme)
    • cp -r node_modules/documentation/src/default_theme custom_theme
    1. Create build script (build.mjs)
    // build.mjs
    import * as documentation from 'documentation';
    
    const runDocumentation = async () => {
      const comments = await documentation.build(['index.js']);
      const output = await documentation.formats.html(comments, {theme: 'custom_theme'});
    };
    
    runDocumentation();
    
    1. Create input file (copy build.js to create index.js)
    • cp build.mjs index.js
    1. Build the documentation
    • node build.mjs

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions