diff --git a/.eslintrc.js b/.eslintrc.cjs similarity index 98% rename from .eslintrc.js rename to .eslintrc.cjs index 554fba51c3..ed6c66103b 100644 --- a/.eslintrc.js +++ b/.eslintrc.cjs @@ -15,7 +15,7 @@ module.exports = { 'eqeqeq': ['error', 'always', { 'null': 'ignore' }], // imports - 'import/extensions': ['warn', 'never'], + 'import/extensions': ['warn', 'always'], // "always" is most compatible with default vanilla ES Modules 'import/order': [ 'warn', { diff --git a/.mocharc.json b/.mocharc.json new file mode 100644 index 0000000000..811a502f8d --- /dev/null +++ b/.mocharc.json @@ -0,0 +1,7 @@ +{ + "Xrequire": "@babel/register", + "Xexperimental-specifier-resolution=node": "", + "node-option": [ + "loader=ts-node/esm" + ] +} \ No newline at end of file diff --git a/.mocharc.yml b/.mocharc.yml deleted file mode 100644 index 15a5e8f194..0000000000 --- a/.mocharc.yml +++ /dev/null @@ -1 +0,0 @@ -require: '@babel/register' diff --git a/benchmark/benchmark.ts b/benchmark/benchmark.ts index 6982d57605..ca986604cf 100644 --- a/benchmark/benchmark.ts +++ b/benchmark/benchmark.ts @@ -5,10 +5,10 @@ import fs from 'fs'; import path from 'path'; import { gitP } from 'simple-git'; import { argv } from 'yargs'; -import { parseLanguageNames } from '../tests/helper/test-case'; -import { config as baseConfig } from './config'; -import type { Prism } from '../src/core'; -import type { Config, ConfigOptions } from './config'; +import { parseLanguageNames } from '../tests/helper/test-case.js'; +import { config as baseConfig } from './config.js'; +import type { Prism } from '../src/core.js'; +import type { Config, ConfigOptions } from './config.js'; import type { Options, Stats } from 'benchmark'; diff --git a/package.json b/package.json index 47e3e0e750..46dec95323 100644 --- a/package.json +++ b/package.json @@ -2,14 +2,16 @@ "name": "prismjs", "version": "1.29.0", "description": "Lightweight, robust, elegant syntax highlighting. A spin-off project from Dabblet.", - "main": "prism.js", + "type": "module", + "main": "dist/core/prism.js", "style": "themes/prism.css", "engines": { "node": ">=14" }, "scripts": { "benchmark": "ts-node benchmark/benchmark.ts", - "build": "ts-node scripts/build.ts", + "build": "ts-node-esm scripts/build.ts && npm run tsc", + "prepare": "npm run build", "lint": "eslint . --cache", "lint:fix": "npm run lint -- --fix", "lint:ci": "eslint . --max-warnings 0", @@ -23,7 +25,8 @@ "test:plugins": "ts-mocha tests/plugins/**/*.ts", "test:runner": "ts-mocha tests/testrunner-tests.ts", "test": "npm-run-all test:*", - "tsc": "tsc && tsc -p tests/tsconfig.json" + "typecheck": "tsc --noEmit && tsc -p tests/tsconfig.json --noEmit", + "tsc": "tsc" }, "repository": { "type": "git", diff --git a/scripts/build.ts b/scripts/build.ts index 6f05da8853..6c418d33bc 100644 --- a/scripts/build.ts +++ b/scripts/build.ts @@ -1,34 +1,36 @@ /* eslint-disable @typescript-eslint/no-non-null-assertion */ -import rollupTerser from '@rollup/plugin-terser'; -import rollupTypescript from '@rollup/plugin-typescript'; +// import rollupTerser from '@rollup/plugin-terser'; +// import rollupTypescript from '@rollup/plugin-typescript'; import CleanCSS from 'clean-css'; import fs from 'fs'; import { mkdir, readFile, readdir, rm, writeFile, } from 'fs/promises'; -import MagicString from 'magic-string'; +// import MagicString from 'magic-string'; import path from 'path'; -import { rollup } from 'rollup'; +// import { rollup } from 'rollup'; +import { fileURLToPath } from 'url'; import { webfont } from 'webfont'; -import { toArray } from '../src/shared/util'; -import { components } from './components'; -import { parallel, runTask, series } from './tasks'; -import type { ComponentProto } from '../src/types'; -import type { Plugin, SourceMapInput } from 'rollup'; +// import { toArray } from '../src/shared/util.js'; +// import { components } from './components.js'; +import { parallel, runTask, series } from './tasks.js'; +// import type { ComponentProto } from '../src/types'; +// import type { Plugin, SourceMapInput } from 'rollup'; +const __dirname = path.dirname(fileURLToPath(import.meta.url)); const SRC_DIR = path.join(__dirname, '../src/'); -const languageIds = fs.readdirSync(path.join(SRC_DIR, 'languages')).map((f) => f.slice('prism-'.length).slice(0, -'.js'.length)).sort(); +// const languageIds = fs.readdirSync(path.join(SRC_DIR, 'languages')).map((f) => f.slice('prism-'.length).slice(0, -'.js'.length)).sort(); const pluginIds = fs.readdirSync(path.join(SRC_DIR, 'plugins')).sort(); -async function loadComponent(id: string) { - let file; - if (pluginIds.includes(id)) { - file = path.join(SRC_DIR, `plugins/${id}/prism-${id}.ts`); - } else { - file = path.join(SRC_DIR, `languages/prism-${id}.ts`); - } - const exports = (await import(file)) as { default: ComponentProto }; - return exports.default; -} +// async function loadComponent(id: string) { +// let file; +// if (pluginIds.includes(id)) { +// file = path.join(SRC_DIR, `plugins/${id}/prism-${id}.ts`); +// } else { +// file = path.join(SRC_DIR, `languages/prism-${id}.ts`); +// } +// const exports = (await import(file)) as { default: ComponentProto }; +// return exports.default; +// } async function minifyCSS() { const input: Record = {}; @@ -42,7 +44,7 @@ async function minifyCSS() { for (const id of pluginIds) { const file = path.join(SRC_DIR, `plugins/${id}/prism-${id}.css`); if (fs.existsSync(file)) { - input[`plugins/prism-${id}.css`] = file; + input[`plugins/${id}/prism-${id}.css`] = file; } } @@ -116,119 +118,119 @@ async function treeviewIconFont() { fs.writeFileSync(cssPath, css.replace(fontFaceRegex, fontFace), 'utf-8'); } -const dataToInsert = { - aliases_placeholder: async () => { - const data = await Promise.all([...languageIds, ...pluginIds].map(async (id) => { - const proto = await loadComponent(id); - return { id, alias: toArray(proto.alias) }; - })); - return Object.fromEntries(data.flatMap(({ id, alias }) => alias.map((a) => [a, id]))); - }, - all_languages_placeholder: () => Promise.resolve(languageIds), - title_placeholder: async () => { - const rawTitles = new Map(); - for (const [id, entry] of Object.entries(components.languages)) { - if (id === 'meta') { - continue; - } - - rawTitles.set(id, entry.title); - for (const [alias, title] of Object.entries(entry.aliasTitles || {})) { - rawTitles.set(alias, title); - } - } - - const data = (await Promise.all(languageIds.map(async (id) => { - const proto = await loadComponent(id); - const title = rawTitles.get(id); - if (!title) { - throw new Error(`No title for ${id}`); - } - return [id, ...toArray(proto.alias)].map((name) => ({ name, title: rawTitles.get(id) ?? title })); - }))).flat(); - data.push({ name: 'none', title: 'Plain text' }); - - /** - * Tries to guess the name of a language given its id. - * - * @param name The language id. - */ - function guessTitle(name: string) { - return (name.substring(0, 1).toUpperCase() + name.substring(1)).replace(/s(?=cript)/, 'S'); - } - - return Object.fromEntries( - data.filter(({ name, title }) => guessTitle(name) !== title).map(({ name, title }) => [name, title]) - ); - } -}; - -const dataInsertPlugin: Plugin = { - name: 'data-insert', - async renderChunk(code, chunk) { - const pattern = /\/\*\s*(\w+)\[\s*\*\/[\s\S]*?\/\*\s*\]\s*\*\//g; - - // search for placeholders - const contained = new Set(); - let m; - while ((m = pattern.exec(code))) { - contained.add(m[1]); - } - - if (contained.size === 0) { - return null; - } - - // fetch placeholder data - const dataByName: Record = {}; - for (const name of contained) { - if (name in dataToInsert) { - dataByName[name] = await dataToInsert[name as keyof typeof dataToInsert](); - } else { - throw new Error(`Unknown placeholder ${name} in ${chunk.fileName}`); - } - } - - // replace placeholders - const str = new MagicString(code); - str.replace(pattern, (_, name: string) => { - return JSON.stringify(dataByName[name]); - }); - return toRenderedChunk(str); - }, -}; - -const inlineRegexSourcePlugin: Plugin = { - name: 'inline-regex-source', - renderChunk(code) { - const str = new MagicString(code); - str.replace( - /\/((?:[^\n\r[\\\/]|\\.|\[(?:[^\n\r\\\]]|\\.)*\])+)\/\s*\.\s*source\b/g, - (m, source: string) => { - // escape backslashes - source = source.replace(/\\(.)|\[(?:\\s\\S|\\S\\s)\]/g, (m, g1: string) => { - if (g1) { - // characters like /\n/ can just be kept as "\n" instead of being escaped to "\\n" - if (/[nrt0/]/.test(g1)) { - return m; - } - if ('\\' === g1) { - return '\\\\\\\\'; // escape using 4 backslashes - } - return '\\\\' + g1; - } else { - return '[^]'; - } - }); - // escape single quotes - source = source.replace(/'/g, "\\'"); - // wrap source in single quotes - return "'" + source + "'"; - } - ); - return toRenderedChunk(str); - }, -}; +// const dataToInsert = { +// aliases_placeholder: async () => { +// const data = await Promise.all([...languageIds, ...pluginIds].map(async (id) => { +// const proto = await loadComponent(id); +// return { id, alias: toArray(proto.alias) }; +// })); +// return Object.fromEntries(data.flatMap(({ id, alias }) => alias.map((a) => [a, id]))); +// }, +// all_languages_placeholder: () => Promise.resolve(languageIds), +// title_placeholder: async () => { +// const rawTitles = new Map(); +// for (const [id, entry] of Object.entries(components.languages)) { +// if (id === 'meta') { +// continue; +// } + +// rawTitles.set(id, entry.title); +// for (const [alias, title] of Object.entries(entry.aliasTitles || {})) { +// rawTitles.set(alias, title); +// } +// } + +// const data = (await Promise.all(languageIds.map(async (id) => { +// const proto = await loadComponent(id); +// const title = rawTitles.get(id); +// if (!title) { +// throw new Error(`No title for ${id}`); +// } +// return [id, ...toArray(proto.alias)].map((name) => ({ name, title: rawTitles.get(id) ?? title })); +// }))).flat(); +// data.push({ name: 'none', title: 'Plain text' }); + +// /** +// * Tries to guess the name of a language given its id. +// * +// * @param name The language id. +// */ +// function guessTitle(name: string) { +// return (name.substring(0, 1).toUpperCase() + name.substring(1)).replace(/s(?=cript)/, 'S'); +// } + +// return Object.fromEntries( +// data.filter(({ name, title }) => guessTitle(name) !== title).map(({ name, title }) => [name, title]) +// ); +// } +// }; + +// const dataInsertPlugin: Plugin = { +// name: 'data-insert', +// async renderChunk(code, chunk) { +// const pattern = /\/\*\s*(\w+)\[\s*\*\/[\s\S]*?\/\*\s*\]\s*\*\//g; + +// // search for placeholders +// const contained = new Set(); +// let m; +// while ((m = pattern.exec(code))) { +// contained.add(m[1]); +// } + +// if (contained.size === 0) { +// return null; +// } + +// // fetch placeholder data +// const dataByName: Record = {}; +// for (const name of contained) { +// if (name in dataToInsert) { +// dataByName[name] = await dataToInsert[name as keyof typeof dataToInsert](); +// } else { +// throw new Error(`Unknown placeholder ${name} in ${chunk.fileName}`); +// } +// } + +// // replace placeholders +// const str = new MagicString(code); +// str.replace(pattern, (_, name: string) => { +// return JSON.stringify(dataByName[name]); +// }); +// return toRenderedChunk(str); +// }, +// }; + +// const inlineRegexSourcePlugin: Plugin = { +// name: 'inline-regex-source', +// renderChunk(code) { +// const str = new MagicString(code); +// str.replace( +// /\/((?:[^\n\r[\\\/]|\\.|\[(?:[^\n\r\\\]]|\\.)*\])+)\/\s*\.\s*source\b/g, +// (m, source: string) => { +// // escape backslashes +// source = source.replace(/\\(.)|\[(?:\\s\\S|\\S\\s)\]/g, (m, g1: string) => { +// if (g1) { +// // characters like /\n/ can just be kept as "\n" instead of being escaped to "\\n" +// if (/[nrt0/]/.test(g1)) { +// return m; +// } +// if ('\\' === g1) { +// return '\\\\\\\\'; // escape using 4 backslashes +// } +// return '\\\\' + g1; +// } else { +// return '[^]'; +// } +// }); +// // escape single quotes +// source = source.replace(/'/g, "\\'"); +// // wrap source in single quotes +// return "'" + source + "'"; +// } +// ); +// return toRenderedChunk(str); +// }, +// }; /** * This plugin wraps bare grammar objects into functions. @@ -239,97 +241,82 @@ const inlineRegexSourcePlugin: Plugin = { * * @see https://github.com/PrismJS/prism/issues/2768 */ -const lazyGrammarPlugin: Plugin = { - name: 'lazy-grammar', - renderChunk(code) { - const str = new MagicString(code); - str.replace( - /^(?[ \t]+)grammar: (\{[\s\S]*?^\k\})/m, - (m, _, grammar: string) => `\tgrammar: () => (${grammar})` - ); - return toRenderedChunk(str); - }, -}; - -function toRenderedChunk(s: MagicString): { code: string; map: SourceMapInput } { - return { - code: s.toString(), - map: s.generateMap({ hires: true }) as SourceMapInput, - }; -} - -const terserPlugin = rollupTerser({ - ecma: 2020, - module: true, - compress: { - passes: 4, - unsafe: true, - unsafe_arrows: true, - unsafe_math: true, - unsafe_regexp: true, - }, - format: { - comments: false - }, - keep_classnames: true -}); +// const lazyGrammarPlugin: Plugin = { +// name: 'lazy-grammar', +// renderChunk(code) { +// const str = new MagicString(code); +// str.replace( +// /^(?[ \t]+)grammar: (\{[\s\S]*?^\k\})/m, +// (m, _, grammar: string) => `\tgrammar: () => (${grammar})` +// ); +// return toRenderedChunk(str); +// }, +// }; + +// function toRenderedChunk(s: MagicString): { code: string; map: SourceMapInput } { +// return { +// code: s.toString(), +// map: s.generateMap({ hires: true }) as SourceMapInput, +// }; +// } + +// const terserPlugin = rollupTerser({ +// ecma: 2020, +// module: true, +// compress: { +// passes: 4, +// unsafe: true, +// unsafe_arrows: true, +// unsafe_math: true, +// unsafe_regexp: true, +// }, +// format: { +// comments: false +// }, +// keep_classnames: true +// }); async function clean() { const outputDir = path.join(__dirname, '../dist'); await rm(outputDir, { recursive: true, force: true }); } -async function buildJS() { - const input: Record = { - 'core': path.join(SRC_DIR, 'core.ts'), - 'shared': path.join(SRC_DIR, 'shared.ts'), - }; - for (const id of languageIds) { - input[`languages/prism-${id}`] = path.join(SRC_DIR, `languages/prism-${id}.ts`); - } - for (const id of pluginIds) { - input[`plugins/prism-${id}`] = path.join(SRC_DIR, `plugins/${id}/prism-${id}.ts`); - } - - let bundle; - try { - bundle = await rollup({ - input, - plugins: [rollupTypescript({ module: 'esnext' })], - }); - - // ESM - await bundle.write({ - dir: 'dist/esm', - chunkFileNames: '_chunks/[name]-[hash].js', - validate: true, - sourcemap: 'hidden', - plugins: [ - lazyGrammarPlugin, - dataInsertPlugin, - inlineRegexSourcePlugin, - terserPlugin - ] - }); - - // CommonJS - await bundle.write({ - dir: 'dist/cjs', - chunkFileNames: '_chunks/[name]-[hash].js', - validate: true, - sourcemap: 'hidden', - format: 'cjs', - exports: 'named', - plugins: [ - lazyGrammarPlugin, - dataInsertPlugin, - inlineRegexSourcePlugin, - terserPlugin - ] - }); - } finally { - await bundle?.close(); - } -} - -runTask(series(clean, parallel(buildJS, series(treeviewIconFont, minifyCSS)))); +// async function buildJS() { +// const input: Record = { +// 'core': path.join(SRC_DIR, 'core.ts'), +// 'shared': path.join(SRC_DIR, 'shared.ts'), +// }; +// for (const id of languageIds) { +// input[`languages/prism-${id}`] = path.join(SRC_DIR, `languages/prism-${id}.ts`); +// } +// for (const id of pluginIds) { +// input[`plugins/prism-${id}`] = path.join(SRC_DIR, `plugins/${id}/prism-${id}.ts`); +// } + +// let bundle; +// try { +// bundle = await rollup({ +// input, +// plugins: [rollupTypescript({ module: 'esnext' })], +// }); + +// // ESM +// await bundle.write({ +// dir: 'dist/', +// chunkFileNames: '_chunks/[name]-[hash].js', +// validate: true, +// sourcemap: 'hidden', +// plugins: [ +// lazyGrammarPlugin, +// dataInsertPlugin, +// inlineRegexSourcePlugin, +// terserPlugin +// ] +// }); +// } finally { +// await bundle?.close(); +// } +// } + +// runTask(series(clean, parallel(buildJS, series(treeviewIconFont, minifyCSS)))); +runTask(series(clean, treeviewIconFont, minifyCSS)); diff --git a/scripts/create-changelog.ts b/scripts/create-changelog.ts index 86f9fda6f5..d0495c0034 100644 --- a/scripts/create-changelog.ts +++ b/scripts/create-changelog.ts @@ -1,7 +1,7 @@ /* eslint-disable @typescript-eslint/no-non-null-assertion */ import simpleGit from 'simple-git'; -import { components } from './components'; -import { runTask } from './tasks'; +import { components } from './components.js'; +import { runTask } from './tasks.js'; const git = simpleGit(__dirname); diff --git a/scripts/linkify-changelog.ts b/scripts/linkify-changelog.ts index 13c1d7a417..3b14922fdd 100644 --- a/scripts/linkify-changelog.ts +++ b/scripts/linkify-changelog.ts @@ -1,5 +1,5 @@ import fs from 'fs/promises'; -import { runTask } from './tasks'; +import { runTask } from './tasks.js'; runTask(async () => { const changelog = 'CHANGELOG.md'; diff --git a/scripts/tsconfig.json b/scripts/tsconfig.json index 28706a102b..d5e22140df 100644 --- a/scripts/tsconfig.json +++ b/scripts/tsconfig.json @@ -1,78 +1,7 @@ { "extends": "../tsconfig.json", "compilerOptions": { - /* Visit https://aka.ms/tsconfig to read more about this file */ - - /* Projects */ - // "incremental": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */ - // "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */ - // "tsBuildInfoFile": "./.tsbuildinfo", /* Specify the path to .tsbuildinfo incremental compilation file. */ - // "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects. */ - // "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */ - // "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */ - - /* Language and Environment */ - "target": "ES2020", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */ - // "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */ - // "jsx": "preserve", /* Specify what JSX code is generated. */ - // "experimentalDecorators": true, /* Enable experimental support for TC39 stage 2 draft decorators. */ - // "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */ - // "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */ - // "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */ - // "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using 'jsx: react-jsx*'. */ - // "reactNamespace": "", /* Specify the object invoked for 'createElement'. This only applies when targeting 'react' JSX emit. */ - // "noLib": true, /* Disable including any library files, including the default lib.d.ts. */ - // "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */ - // "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */ - - /* Modules */ - "module": "CommonJS", /* Specify what module code is generated. */ - // "rootDir": "./", /* Specify the root folder within your source files. */ - // "moduleResolution": "node", /* Specify how TypeScript looks up a file from a given module specifier. */ - // "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */ - // "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */ - // "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */ - // "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */ - // "types": [], /* Specify type package names to be included without being referenced in a source file. */ - // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */ - // "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */ - // "resolveJsonModule": true, /* Enable importing .json files. */ - // "noResolve": true, /* Disallow 'import's, 'require's or ''s from expanding the number of files TypeScript should add to a project. */ - - /* JavaScript Support */ - "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */ - "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */ - // "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */ - - /* Emit */ - // "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */ - // "declarationMap": true, /* Create sourcemaps for d.ts files. */ - // "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */ - // "sourceMap": true, /* Create source map files for emitted JavaScript files. */ - // "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */ - // "outDir": "./", /* Specify an output folder for all emitted files. */ - // "removeComments": true, /* Disable emitting comments. */ "noEmit": true, /* Disable emitting files from a compilation. */ - // "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */ - // "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types. */ - // "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */ - // "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */ - // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */ - // "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */ - // "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */ - // "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */ - // "newLine": "crlf", /* Set the newline character for emitting files. */ - // "stripInternal": true, /* Disable emitting declarations that have '@internal' in their JSDoc comments. */ - // "noEmitHelpers": true, /* Disable generating custom helper functions like '__extends' in compiled output. */ - // "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */ - // "preserveConstEnums": true, /* Disable erasing 'const enum' declarations in generated code. */ - // "declarationDir": "./", /* Specify the output directory for generated declaration files. */ - // "preserveValueImports": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */ - - /* Interop Constraints */ - // "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */ - // "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */ - "esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */ }, "include": ["./**/*"] } diff --git a/src/auto-start.ts b/src/auto-start.ts index a2050b18d2..6f44b4676b 100644 --- a/src/auto-start.ts +++ b/src/auto-start.ts @@ -1,5 +1,5 @@ -import Prism from './global'; -import autoloader from './plugins/autoloader/prism-autoloader'; +import Prism from './global.js'; +import autoloader from './plugins/autoloader/prism-autoloader.js'; Prism.components.add(autoloader); diff --git a/src/core/hooks.ts b/src/core/hooks.ts index c4abf21882..b486713034 100644 --- a/src/core/hooks.ts +++ b/src/core/hooks.ts @@ -1,6 +1,6 @@ import type { Grammar, TokenName } from '../types'; -import type { HookState } from './hook-state'; -import type { TokenStream } from './token'; +import type { HookState } from './hook-state.js'; +import type { TokenStream } from './token.js'; export class Hooks { // eslint-disable-next-line func-call-spacing diff --git a/src/core/prism.ts b/src/core/prism.ts index d370c3e7f0..cbee2ae0e2 100644 --- a/src/core/prism.ts +++ b/src/core/prism.ts @@ -1,16 +1,16 @@ -import { getLanguage, setLanguage } from '../shared/dom-util'; -import { rest, tokenize } from '../shared/symbols'; -import { htmlEncode } from '../shared/util'; -import { HookState } from './hook-state'; -import { Hooks } from './hooks'; -import { LinkedList } from './linked-list'; -import { Registry } from './registry'; -import { Token } from './token'; +import { getLanguage, setLanguage } from '../shared/dom-util.js'; +import { rest, tokenize } from '../shared/symbols.js'; +import { htmlEncode } from '../shared/util.js'; +import { HookState } from './hook-state.js'; +import { Hooks } from './hooks.js'; +import { LinkedList } from './linked-list.js'; +import { Registry } from './registry.js'; +import { Token } from './token.js'; import type { KnownPlugins } from '../known-plugins'; import type { Grammar, GrammarToken, GrammarTokens } from '../types'; -import type { HookEnvMap } from './hooks'; -import type { LinkedListHeadNode, LinkedListMiddleNode, LinkedListTailNode } from './linked-list'; -import type { TokenStream } from './token'; +import type { HookEnvMap } from './hooks.js'; +import type { LinkedListHeadNode, LinkedListMiddleNode, LinkedListTailNode } from './linked-list.js'; +import type { TokenStream } from './token.js'; /** * Prism: Lightweight, robust, elegant syntax highlighting diff --git a/src/core/registry.ts b/src/core/registry.ts index 4c5140b81c..0707a3cc85 100644 --- a/src/core/registry.ts +++ b/src/core/registry.ts @@ -1,7 +1,7 @@ -import { extend } from '../shared/language-util'; -import { forEach, kebabToCamelCase } from '../shared/util'; +import { extend } from '../shared/language-util.js'; +import { forEach, kebabToCamelCase } from '../shared/util.js'; import type { ComponentProto, Grammar } from '../types'; -import type { Prism } from './prism'; +import type { Prism } from './prism.js'; interface Entry { proto: ComponentProto; diff --git a/src/global.ts b/src/global.ts index 7516dcb877..b296d5b7df 100644 --- a/src/global.ts +++ b/src/global.ts @@ -1,4 +1,4 @@ -import { Prism } from './core/prism'; +import { Prism } from './core/prism.js'; const globalSymbol = Symbol.for('Prism global'); diff --git a/src/known-plugins.d.ts b/src/known-plugins.d.ts index 19cd5baba3..f63adde974 100644 --- a/src/known-plugins.d.ts +++ b/src/known-plugins.d.ts @@ -1,13 +1,13 @@ -import type { Autoloader } from './plugins/autoloader/prism-autoloader'; -import type { CustomClass } from './plugins/custom-class/prism-custom-class'; -import type { FileHighlight } from './plugins/file-highlight/prism-file-highlight'; -import type { FilterHighlightAll } from './plugins/filter-highlight-all/prism-filter-highlight-all'; -import type { JsonpHighlight } from './plugins/jsonp-highlight/prism-jsonp-highlight'; -import type { LineHighlight } from './plugins/line-highlight/prism-line-highlight'; -import type { LineNumbers } from './plugins/line-numbers/prism-line-numbers'; -import type { NormalizeWhitespace } from './plugins/normalize-whitespace/prism-normalize-whitespace'; -import type { PreviewerCollection } from './plugins/previewers/prism-previewers'; -import type { Toolbar } from './plugins/toolbar/prism-toolbar'; +import type { Autoloader } from './plugins/autoloader/prism-autoloader.js'; +import type { CustomClass } from './plugins/custom-class/prism-custom-class.js'; +import type { FileHighlight } from './plugins/file-highlight/prism-file-highlight.js'; +import type { FilterHighlightAll } from './plugins/filter-highlight-all/prism-filter-highlight-all.js'; +import type { JsonpHighlight } from './plugins/jsonp-highlight/prism-jsonp-highlight.js'; +import type { LineHighlight } from './plugins/line-highlight/prism-line-highlight.js'; +import type { LineNumbers } from './plugins/line-numbers/prism-line-numbers.js'; +import type { NormalizeWhitespace } from './plugins/normalize-whitespace/prism-normalize-whitespace.js'; +import type { PreviewerCollection } from './plugins/previewers/prism-previewers.js'; +import type { Toolbar } from './plugins/toolbar/prism-toolbar.js'; declare interface KnownPlugins { autoloader: Autoloader; diff --git a/src/languages/prism-actionscript.ts b/src/languages/prism-actionscript.ts index f6b71caed0..d4f6609a14 100644 --- a/src/languages/prism-actionscript.ts +++ b/src/languages/prism-actionscript.ts @@ -1,5 +1,5 @@ -import { insertBefore } from '../shared/language-util'; -import javascript from './prism-javascript'; +import { insertBefore } from '../shared/language-util.js'; +import javascript from './prism-javascript.js'; import type { GrammarToken, LanguageProto } from '../types'; export default { diff --git a/src/languages/prism-apex.ts b/src/languages/prism-apex.ts index a03a9ea305..5dfad0132e 100644 --- a/src/languages/prism-apex.ts +++ b/src/languages/prism-apex.ts @@ -1,5 +1,5 @@ -import clike from './prism-clike'; -import sql from './prism-sql'; +import clike from './prism-clike.js'; +import sql from './prism-sql.js'; import type { LanguageProto } from '../types'; export default { diff --git a/src/languages/prism-arduino.ts b/src/languages/prism-arduino.ts index f2258a00bd..648e326673 100644 --- a/src/languages/prism-arduino.ts +++ b/src/languages/prism-arduino.ts @@ -1,4 +1,4 @@ -import cpp from './prism-cpp'; +import cpp from './prism-cpp.js'; import type { LanguageProto } from '../types'; export default { diff --git a/src/languages/prism-asciidoc.ts b/src/languages/prism-asciidoc.ts index b4af841a40..61279b85a7 100644 --- a/src/languages/prism-asciidoc.ts +++ b/src/languages/prism-asciidoc.ts @@ -1,4 +1,4 @@ -import { rest } from '../shared/symbols'; +import { rest } from '../shared/symbols.js'; import type { Grammar, GrammarToken, LanguageProto } from '../types'; export default { diff --git a/src/languages/prism-aspnet.ts b/src/languages/prism-aspnet.ts index 6b94a8bb37..8d96f8b8c1 100644 --- a/src/languages/prism-aspnet.ts +++ b/src/languages/prism-aspnet.ts @@ -1,7 +1,7 @@ -import { insertBefore } from '../shared/language-util'; -import { rest } from '../shared/symbols'; -import csharp from './prism-csharp'; -import markup from './prism-markup'; +import { insertBefore } from '../shared/language-util.js'; +import { rest } from '../shared/symbols.js'; +import csharp from './prism-csharp.js'; +import markup from './prism-markup.js'; import type { Grammar, GrammarToken, LanguageProto } from '../types'; export default { diff --git a/src/languages/prism-birb.ts b/src/languages/prism-birb.ts index 53fa00a037..ff5ef02540 100644 --- a/src/languages/prism-birb.ts +++ b/src/languages/prism-birb.ts @@ -1,5 +1,5 @@ -import { insertBefore } from '../shared/language-util'; -import clike from './prism-clike'; +import { insertBefore } from '../shared/language-util.js'; +import clike from './prism-clike.js'; import type { LanguageProto } from '../types'; export default { diff --git a/src/languages/prism-bison.ts b/src/languages/prism-bison.ts index 87bed901fd..76c9f96c6c 100644 --- a/src/languages/prism-bison.ts +++ b/src/languages/prism-bison.ts @@ -1,6 +1,6 @@ -import { insertBefore } from '../shared/language-util'; -import { rest } from '../shared/symbols'; -import c from './prism-c'; +import { insertBefore } from '../shared/language-util.js'; +import { rest } from '../shared/symbols.js'; +import c from './prism-c.js'; import type { LanguageProto } from '../types'; export default { diff --git a/src/languages/prism-c.ts b/src/languages/prism-c.ts index c2ac138f11..d5732d5228 100644 --- a/src/languages/prism-c.ts +++ b/src/languages/prism-c.ts @@ -1,5 +1,5 @@ -import { insertBefore } from '../shared/language-util'; -import clike from './prism-clike'; +import { insertBefore } from '../shared/language-util.js'; +import clike from './prism-clike.js'; import type { GrammarToken, LanguageProto } from '../types'; export default { diff --git a/src/languages/prism-cfscript.ts b/src/languages/prism-cfscript.ts index 65312d1d6f..a8ab149085 100644 --- a/src/languages/prism-cfscript.ts +++ b/src/languages/prism-cfscript.ts @@ -1,5 +1,5 @@ -import { insertBefore } from '../shared/language-util'; -import clike from './prism-clike'; +import { insertBefore } from '../shared/language-util.js'; +import clike from './prism-clike.js'; import type { LanguageProto } from '../types'; export default { diff --git a/src/languages/prism-chaiscript.ts b/src/languages/prism-chaiscript.ts index b283586283..da45129afe 100644 --- a/src/languages/prism-chaiscript.ts +++ b/src/languages/prism-chaiscript.ts @@ -1,7 +1,7 @@ -import { insertBefore } from '../shared/language-util'; -import { toArray } from '../shared/util'; -import clike from './prism-clike'; -import cpp from './prism-cpp'; +import { insertBefore } from '../shared/language-util.js'; +import { toArray } from '../shared/util.js'; +import clike from './prism-clike.js'; +import cpp from './prism-cpp.js'; import type { LanguageProto } from '../types'; export default { diff --git a/src/languages/prism-cilkc.ts b/src/languages/prism-cilkc.ts index 9ac7812448..fbf288f637 100644 --- a/src/languages/prism-cilkc.ts +++ b/src/languages/prism-cilkc.ts @@ -1,5 +1,5 @@ -import { insertBefore } from '../shared/language-util'; -import c from './prism-c'; +import { insertBefore } from '../shared/language-util.js'; +import c from './prism-c.js'; import type { LanguageProto } from '../types'; export default { diff --git a/src/languages/prism-cilkcpp.ts b/src/languages/prism-cilkcpp.ts index bb621bf6b5..5cdc58564b 100644 --- a/src/languages/prism-cilkcpp.ts +++ b/src/languages/prism-cilkcpp.ts @@ -1,5 +1,5 @@ -import { insertBefore } from '../shared/language-util'; -import cpp from './prism-cpp'; +import { insertBefore } from '../shared/language-util.js'; +import cpp from './prism-cpp.js'; import type { LanguageProto } from '../types'; export default { diff --git a/src/languages/prism-coffeescript.ts b/src/languages/prism-coffeescript.ts index 1a751987cd..c60887c182 100644 --- a/src/languages/prism-coffeescript.ts +++ b/src/languages/prism-coffeescript.ts @@ -1,5 +1,5 @@ -import { insertBefore } from '../shared/language-util'; -import javascript from './prism-javascript'; +import { insertBefore } from '../shared/language-util.js'; +import javascript from './prism-javascript.js'; import type { LanguageProto } from '../types'; export default { diff --git a/src/languages/prism-cpp.ts b/src/languages/prism-cpp.ts index 801c4a30c8..09c132f51f 100644 --- a/src/languages/prism-cpp.ts +++ b/src/languages/prism-cpp.ts @@ -1,5 +1,5 @@ -import { insertBefore } from '../shared/language-util'; -import c from './prism-c'; +import { insertBefore } from '../shared/language-util.js'; +import c from './prism-c.js'; import type { LanguageProto } from '../types'; export default { diff --git a/src/languages/prism-crystal.ts b/src/languages/prism-crystal.ts index 7d5c62b0e4..5fc5988236 100644 --- a/src/languages/prism-crystal.ts +++ b/src/languages/prism-crystal.ts @@ -1,6 +1,6 @@ -import { insertBefore } from '../shared/language-util'; -import { toArray } from '../shared/util'; -import ruby from './prism-ruby'; +import { insertBefore } from '../shared/language-util.js'; +import { toArray } from '../shared/util.js'; +import ruby from './prism-ruby.js'; import type { LanguageProto } from '../types'; export default { diff --git a/src/languages/prism-csharp.ts b/src/languages/prism-csharp.ts index 4a64f31d0d..05dd100d24 100644 --- a/src/languages/prism-csharp.ts +++ b/src/languages/prism-csharp.ts @@ -1,5 +1,5 @@ -import { insertBefore } from '../shared/language-util'; -import clike from './prism-clike'; +import { insertBefore } from '../shared/language-util.js'; +import clike from './prism-clike.js'; import type { LanguageProto } from '../types'; /** diff --git a/src/languages/prism-cshtml.ts b/src/languages/prism-cshtml.ts index 547a578e85..e512ee3f42 100644 --- a/src/languages/prism-cshtml.ts +++ b/src/languages/prism-cshtml.ts @@ -1,6 +1,6 @@ -import { insertBefore } from '../shared/language-util'; -import csharp from './prism-csharp'; -import markup from './prism-markup'; +import { insertBefore } from '../shared/language-util.js'; +import csharp from './prism-csharp.js'; +import markup from './prism-markup.js'; import type { Grammar, GrammarToken, LanguageProto } from '../types'; export default { diff --git a/src/languages/prism-css-extras.ts b/src/languages/prism-css-extras.ts index 62871dba0e..39c16d01c9 100644 --- a/src/languages/prism-css-extras.ts +++ b/src/languages/prism-css-extras.ts @@ -1,4 +1,4 @@ -import cssSelector from './prism-css-selector'; +import cssSelector from './prism-css-selector.js'; import type { LanguageProto } from '../types'; export default { diff --git a/src/languages/prism-css.ts b/src/languages/prism-css.ts index 75d6fc2e12..32807a7ece 100644 --- a/src/languages/prism-css.ts +++ b/src/languages/prism-css.ts @@ -1,5 +1,5 @@ -import { insertBefore } from '../shared/language-util'; -import { rest } from '../shared/symbols'; +import { insertBefore } from '../shared/language-util.js'; +import { rest } from '../shared/symbols.js'; import type { LanguageProto } from '../types'; export default { diff --git a/src/languages/prism-d.ts b/src/languages/prism-d.ts index ab9d182005..cce0d9611a 100644 --- a/src/languages/prism-d.ts +++ b/src/languages/prism-d.ts @@ -1,5 +1,5 @@ -import { insertBefore } from '../shared/language-util'; -import clike from './prism-clike'; +import { insertBefore } from '../shared/language-util.js'; +import clike from './prism-clike.js'; import type { LanguageProto } from '../types'; export default { diff --git a/src/languages/prism-dart.ts b/src/languages/prism-dart.ts index e7bb52997b..96a19da675 100644 --- a/src/languages/prism-dart.ts +++ b/src/languages/prism-dart.ts @@ -1,5 +1,5 @@ -import { insertBefore } from '../shared/language-util'; -import clike from './prism-clike'; +import { insertBefore } from '../shared/language-util.js'; +import clike from './prism-clike.js'; import type { LanguageProto } from '../types'; export default { diff --git a/src/languages/prism-django.ts b/src/languages/prism-django.ts index b1ba1f5705..ed4cd88e71 100644 --- a/src/languages/prism-django.ts +++ b/src/languages/prism-django.ts @@ -1,6 +1,6 @@ -import { embeddedIn } from '../shared/languages/templating'; -import { tokenize } from '../shared/symbols'; -import markup from './prism-markup'; +import { embeddedIn } from '../shared/languages/templating.js'; +import { tokenize } from '../shared/symbols.js'; +import markup from './prism-markup.js'; import type { LanguageProto } from '../types'; // Django/Jinja2 syntax definition for Prism.js syntax highlighter. diff --git a/src/languages/prism-ejs.ts b/src/languages/prism-ejs.ts index acc3a4e752..01a508048f 100644 --- a/src/languages/prism-ejs.ts +++ b/src/languages/prism-ejs.ts @@ -1,7 +1,7 @@ -import { embeddedIn } from '../shared/languages/templating'; -import { tokenize } from '../shared/symbols'; -import javascript from './prism-javascript'; -import markup from './prism-markup'; +import { embeddedIn } from '../shared/languages/templating.js'; +import { tokenize } from '../shared/symbols.js'; +import javascript from './prism-javascript.js'; +import markup from './prism-markup.js'; import type { LanguageProto } from '../types'; export default { diff --git a/src/languages/prism-elixir.ts b/src/languages/prism-elixir.ts index 2bb28f4231..783f498f37 100644 --- a/src/languages/prism-elixir.ts +++ b/src/languages/prism-elixir.ts @@ -1,4 +1,4 @@ -import { rest } from '../shared/symbols'; +import { rest } from '../shared/symbols.js'; import type { LanguageProto } from '../types'; export default { diff --git a/src/languages/prism-erb.ts b/src/languages/prism-erb.ts index aef24200d0..2ea15e72f7 100644 --- a/src/languages/prism-erb.ts +++ b/src/languages/prism-erb.ts @@ -1,7 +1,7 @@ -import { embeddedIn } from '../shared/languages/templating'; -import { tokenize } from '../shared/symbols'; -import markup from './prism-markup'; -import ruby from './prism-ruby'; +import { embeddedIn } from '../shared/languages/templating.js'; +import { tokenize } from '../shared/symbols.js'; +import markup from './prism-markup.js'; +import ruby from './prism-ruby.js'; import type { LanguageProto } from '../types'; export default { diff --git a/src/languages/prism-etlua.ts b/src/languages/prism-etlua.ts index ec03c5b08a..2e4819a293 100644 --- a/src/languages/prism-etlua.ts +++ b/src/languages/prism-etlua.ts @@ -1,7 +1,7 @@ -import { embeddedIn } from '../shared/languages/templating'; -import { tokenize } from '../shared/symbols'; -import lua from './prism-lua'; -import markup from './prism-markup'; +import { embeddedIn } from '../shared/languages/templating.js'; +import { tokenize } from '../shared/symbols.js'; +import lua from './prism-lua.js'; +import markup from './prism-markup.js'; import type { LanguageProto } from '../types'; export default { diff --git a/src/languages/prism-factor.ts b/src/languages/prism-factor.ts index de43351066..6dfc74c23f 100644 --- a/src/languages/prism-factor.ts +++ b/src/languages/prism-factor.ts @@ -1,4 +1,4 @@ -import { regexEscape } from '../shared/util'; +import { regexEscape } from '../shared/util.js'; import type { LanguageProto } from '../types'; export default { diff --git a/src/languages/prism-firestore-security-rules.ts b/src/languages/prism-firestore-security-rules.ts index ab44afcfda..793b64817f 100644 --- a/src/languages/prism-firestore-security-rules.ts +++ b/src/languages/prism-firestore-security-rules.ts @@ -1,5 +1,5 @@ -import { insertBefore } from '../shared/language-util'; -import clike from './prism-clike'; +import { insertBefore } from '../shared/language-util.js'; +import clike from './prism-clike.js'; import type { LanguageProto } from '../types'; export default { diff --git a/src/languages/prism-flow.ts b/src/languages/prism-flow.ts index b92c8f695d..8a5a661375 100644 --- a/src/languages/prism-flow.ts +++ b/src/languages/prism-flow.ts @@ -1,6 +1,6 @@ -import { insertBefore } from '../shared/language-util'; -import { toArray } from '../shared/util'; -import javascript from './prism-javascript'; +import { insertBefore } from '../shared/language-util.js'; +import { toArray } from '../shared/util.js'; +import javascript from './prism-javascript.js'; import type { GrammarToken, LanguageProto } from '../types'; export default { diff --git a/src/languages/prism-fsharp.ts b/src/languages/prism-fsharp.ts index 0defee7865..dcf33da762 100644 --- a/src/languages/prism-fsharp.ts +++ b/src/languages/prism-fsharp.ts @@ -1,5 +1,5 @@ -import { insertBefore } from '../shared/language-util'; -import clike from './prism-clike'; +import { insertBefore } from '../shared/language-util.js'; +import clike from './prism-clike.js'; import type { LanguageProto } from '../types'; export default { diff --git a/src/languages/prism-ftl.ts b/src/languages/prism-ftl.ts index b23527ad77..14e881fac9 100644 --- a/src/languages/prism-ftl.ts +++ b/src/languages/prism-ftl.ts @@ -1,6 +1,6 @@ -import { embeddedIn } from '../shared/languages/templating'; -import { rest, tokenize } from '../shared/symbols'; -import markup from './prism-markup'; +import { embeddedIn } from '../shared/languages/templating.js'; +import { rest, tokenize } from '../shared/symbols.js'; +import markup from './prism-markup.js'; import type { Grammar, LanguageProto } from '../types'; export default { diff --git a/src/languages/prism-glsl.ts b/src/languages/prism-glsl.ts index 2e4ac12e41..e1d6f82cea 100644 --- a/src/languages/prism-glsl.ts +++ b/src/languages/prism-glsl.ts @@ -1,4 +1,4 @@ -import c from './prism-c'; +import c from './prism-c.js'; import type { LanguageProto } from '../types'; export default { diff --git a/src/languages/prism-gml.ts b/src/languages/prism-gml.ts index 37a1a34c3b..c6324d380d 100644 --- a/src/languages/prism-gml.ts +++ b/src/languages/prism-gml.ts @@ -1,4 +1,4 @@ -import clike from './prism-clike'; +import clike from './prism-clike.js'; import type { LanguageProto } from '../types'; export default { diff --git a/src/languages/prism-go.ts b/src/languages/prism-go.ts index 98196678b3..9e004f7a43 100644 --- a/src/languages/prism-go.ts +++ b/src/languages/prism-go.ts @@ -1,5 +1,5 @@ -import { insertBefore } from '../shared/language-util'; -import clike from './prism-clike'; +import { insertBefore } from '../shared/language-util.js'; +import clike from './prism-clike.js'; import type { LanguageProto } from '../types'; export default { diff --git a/src/languages/prism-gradle.ts b/src/languages/prism-gradle.ts index 9a22102240..e8ce560bf1 100644 --- a/src/languages/prism-gradle.ts +++ b/src/languages/prism-gradle.ts @@ -1,5 +1,5 @@ -import { insertBefore } from '../shared/language-util'; -import clike from './prism-clike'; +import { insertBefore } from '../shared/language-util.js'; +import clike from './prism-clike.js'; import type { LanguageProto } from '../types'; export default { diff --git a/src/languages/prism-graphql.ts b/src/languages/prism-graphql.ts index 59412f5123..e9ccc1d36e 100644 --- a/src/languages/prism-graphql.ts +++ b/src/languages/prism-graphql.ts @@ -1,6 +1,6 @@ -import { withoutTokenize } from '../shared/language-util'; -import { tokenize } from '../shared/symbols'; -import type { Token } from '../core'; +import { withoutTokenize } from '../shared/language-util.js'; +import { tokenize } from '../shared/symbols.js'; +import type { Token } from '../core.js'; import type { LanguageProto } from '../types'; export default { diff --git a/src/languages/prism-groovy.ts b/src/languages/prism-groovy.ts index 429c880b18..98d53dc398 100644 --- a/src/languages/prism-groovy.ts +++ b/src/languages/prism-groovy.ts @@ -1,5 +1,5 @@ -import { insertBefore } from '../shared/language-util'; -import clike from './prism-clike'; +import { insertBefore } from '../shared/language-util.js'; +import clike from './prism-clike.js'; import type { LanguageProto } from '../types'; export default { diff --git a/src/languages/prism-haml.ts b/src/languages/prism-haml.ts index 3833397188..4f7811e65a 100644 --- a/src/languages/prism-haml.ts +++ b/src/languages/prism-haml.ts @@ -1,5 +1,5 @@ -import { insertBefore } from '../shared/language-util'; -import ruby from './prism-ruby'; +import { insertBefore } from '../shared/language-util.js'; +import ruby from './prism-ruby.js'; import type { Grammar, LanguageProto } from '../types'; export default { diff --git a/src/languages/prism-handlebars.ts b/src/languages/prism-handlebars.ts index faf00524c2..23b834f0f0 100644 --- a/src/languages/prism-handlebars.ts +++ b/src/languages/prism-handlebars.ts @@ -1,6 +1,6 @@ -import { embeddedIn } from '../shared/languages/templating'; -import { tokenize } from '../shared/symbols'; -import markup from './prism-markup'; +import { embeddedIn } from '../shared/languages/templating.js'; +import { tokenize } from '../shared/symbols.js'; +import markup from './prism-markup.js'; import type { LanguageProto } from '../types'; export default { diff --git a/src/languages/prism-haxe.ts b/src/languages/prism-haxe.ts index d7e01fc18c..198fe5eeb3 100644 --- a/src/languages/prism-haxe.ts +++ b/src/languages/prism-haxe.ts @@ -1,5 +1,5 @@ -import { insertBefore } from '../shared/language-util'; -import clike from './prism-clike'; +import { insertBefore } from '../shared/language-util.js'; +import clike from './prism-clike.js'; import type { LanguageProto } from '../types'; export default { diff --git a/src/languages/prism-hlsl.ts b/src/languages/prism-hlsl.ts index bc75480760..ac55b0aff7 100644 --- a/src/languages/prism-hlsl.ts +++ b/src/languages/prism-hlsl.ts @@ -1,5 +1,5 @@ -import { toArray } from '../shared/util'; -import c from './prism-c'; +import { toArray } from '../shared/util.js'; +import c from './prism-c.js'; import type { LanguageProto } from '../types'; export default { diff --git a/src/languages/prism-http.ts b/src/languages/prism-http.ts index 416b0e9c91..4bbdc4da93 100644 --- a/src/languages/prism-http.ts +++ b/src/languages/prism-http.ts @@ -1,4 +1,4 @@ -import { insertBefore } from '../shared/language-util'; +import { insertBefore } from '../shared/language-util.js'; import type { Grammar, LanguageProto } from '../types'; export default { diff --git a/src/languages/prism-icu-message-format.ts b/src/languages/prism-icu-message-format.ts index 71ef66793e..14d7e51410 100644 --- a/src/languages/prism-icu-message-format.ts +++ b/src/languages/prism-icu-message-format.ts @@ -1,4 +1,4 @@ -import { rest } from '../shared/symbols'; +import { rest } from '../shared/symbols.js'; import type { LanguageProto } from '../types'; export default { diff --git a/src/languages/prism-idris.ts b/src/languages/prism-idris.ts index 7a58211be8..a1a0e7fd6e 100644 --- a/src/languages/prism-idris.ts +++ b/src/languages/prism-idris.ts @@ -1,5 +1,5 @@ -import { insertBefore } from '../shared/language-util'; -import haskell from './prism-haskell'; +import { insertBefore } from '../shared/language-util.js'; +import haskell from './prism-haskell.js'; import type { LanguageProto } from '../types'; export default { diff --git a/src/languages/prism-inform7.ts b/src/languages/prism-inform7.ts index fd0bfc4770..602882783a 100644 --- a/src/languages/prism-inform7.ts +++ b/src/languages/prism-inform7.ts @@ -1,4 +1,4 @@ -import { rest } from '../shared/symbols'; +import { rest } from '../shared/symbols.js'; import type { Grammar, LanguageProto } from '../types'; export default { diff --git a/src/languages/prism-java.ts b/src/languages/prism-java.ts index 8a383b034f..4d1de5ebe5 100644 --- a/src/languages/prism-java.ts +++ b/src/languages/prism-java.ts @@ -1,6 +1,6 @@ -import { insertBefore } from '../shared/language-util'; -import { toArray } from '../shared/util'; -import clike from './prism-clike'; +import { insertBefore } from '../shared/language-util.js'; +import { toArray } from '../shared/util.js'; +import clike from './prism-clike.js'; import type { LanguageProto } from '../types'; export default { diff --git a/src/languages/prism-javadoc.ts b/src/languages/prism-javadoc.ts index d6e2132533..d50f0bd114 100644 --- a/src/languages/prism-javadoc.ts +++ b/src/languages/prism-javadoc.ts @@ -1,7 +1,7 @@ -import { insertBefore } from '../shared/language-util'; -import java from './prism-java'; -import javadoclike from './prism-javadoclike'; -import markup from './prism-markup'; +import { insertBefore } from '../shared/language-util.js'; +import java from './prism-java.js'; +import javadoclike from './prism-javadoclike.js'; +import markup from './prism-markup.js'; import type { LanguageProto } from '../types'; export default { diff --git a/src/languages/prism-javascript.ts b/src/languages/prism-javascript.ts index 4db0394418..18c4e3b635 100644 --- a/src/languages/prism-javascript.ts +++ b/src/languages/prism-javascript.ts @@ -1,8 +1,8 @@ -import { insertBefore } from '../shared/language-util'; -import { JS_TEMPLATE, JS_TEMPLATE_INTERPOLATION } from '../shared/languages/patterns'; -import { rest } from '../shared/symbols'; -import { toArray } from '../shared/util'; -import clike from './prism-clike'; +import { insertBefore } from '../shared/language-util.js'; +import { JS_TEMPLATE, JS_TEMPLATE_INTERPOLATION } from '../shared/languages/patterns.js'; +import { rest } from '../shared/symbols.js'; +import { toArray } from '../shared/util.js'; +import clike from './prism-clike.js'; import type { LanguageProto } from '../types'; export default { diff --git a/src/languages/prism-jolie.ts b/src/languages/prism-jolie.ts index ffc8835d8a..a7e9fca622 100644 --- a/src/languages/prism-jolie.ts +++ b/src/languages/prism-jolie.ts @@ -1,5 +1,5 @@ -import { insertBefore } from '../shared/language-util'; -import clike from './prism-clike'; +import { insertBefore } from '../shared/language-util.js'; +import clike from './prism-clike.js'; import type { LanguageProto } from '../types'; export default { diff --git a/src/languages/prism-js-templates.ts b/src/languages/prism-js-templates.ts index f590ec66ff..5e0e507989 100644 --- a/src/languages/prism-js-templates.ts +++ b/src/languages/prism-js-templates.ts @@ -1,6 +1,6 @@ -import { JS_TEMPLATE, JS_TEMPLATE_INTERPOLATION } from '../shared/languages/patterns'; -import { embeddedIn } from '../shared/languages/templating'; -import { rest, tokenize } from '../shared/symbols'; +import { JS_TEMPLATE, JS_TEMPLATE_INTERPOLATION } from '../shared/languages/patterns.js'; +import { embeddedIn } from '../shared/languages/templating.js'; +import { rest, tokenize } from '../shared/symbols.js'; import type { GrammarToken, LanguageProto } from '../types'; /** diff --git a/src/languages/prism-jsdoc.ts b/src/languages/prism-jsdoc.ts index c6a9401ea9..523c1c2144 100644 --- a/src/languages/prism-jsdoc.ts +++ b/src/languages/prism-jsdoc.ts @@ -1,7 +1,7 @@ -import { insertBefore } from '../shared/language-util'; -import javadoclike from './prism-javadoclike'; -import javascript from './prism-javascript'; -import typescript from './prism-typescript'; +import { insertBefore } from '../shared/language-util.js'; +import javadoclike from './prism-javadoclike.js'; +import javascript from './prism-javascript.js'; +import typescript from './prism-typescript.js'; import type { LanguageProto } from '../types'; export default { diff --git a/src/languages/prism-json5.ts b/src/languages/prism-json5.ts index fee0dcee6b..fc7f3079ae 100644 --- a/src/languages/prism-json5.ts +++ b/src/languages/prism-json5.ts @@ -1,4 +1,4 @@ -import json from './prism-json'; +import json from './prism-json.js'; import type { LanguageProto } from '../types'; export default { diff --git a/src/languages/prism-jsonp.ts b/src/languages/prism-jsonp.ts index 3748f128eb..bbc983e2e0 100644 --- a/src/languages/prism-jsonp.ts +++ b/src/languages/prism-jsonp.ts @@ -1,5 +1,5 @@ -import { insertBefore } from '../shared/language-util'; -import json from './prism-json'; +import { insertBefore } from '../shared/language-util.js'; +import json from './prism-json.js'; import type { LanguageProto } from '../types'; export default { diff --git a/src/languages/prism-jsx.ts b/src/languages/prism-jsx.ts index c2caa2ecc3..f578aa0c17 100644 --- a/src/languages/prism-jsx.ts +++ b/src/languages/prism-jsx.ts @@ -1,9 +1,9 @@ -import { Token, getTextContent } from '../core/token'; -import { insertBefore, withoutTokenize } from '../shared/language-util'; -import { rest, tokenize } from '../shared/symbols'; -import javascript from './prism-javascript'; -import markup from './prism-markup'; -import type { TokenStream } from '../core/token'; +import { Token, getTextContent } from '../core/token.js'; +import { insertBefore, withoutTokenize } from '../shared/language-util.js'; +import { rest, tokenize } from '../shared/symbols.js'; +import javascript from './prism-javascript.js'; +import markup from './prism-markup.js'; +import type { TokenStream } from '../core/token.js'; import type { Grammar, GrammarToken, LanguageProto } from '../types'; function stringifyToken(token: string | Token | TokenStream | undefined): string { diff --git a/src/languages/prism-kotlin.ts b/src/languages/prism-kotlin.ts index 1340a853f5..3d2214effc 100644 --- a/src/languages/prism-kotlin.ts +++ b/src/languages/prism-kotlin.ts @@ -1,5 +1,5 @@ -import { insertBefore } from '../shared/language-util'; -import clike from './prism-clike'; +import { insertBefore } from '../shared/language-util.js'; +import clike from './prism-clike.js'; import type { LanguageProto } from '../types'; export default { diff --git a/src/languages/prism-latte.ts b/src/languages/prism-latte.ts index dca0d4f8a4..ec480f9bd5 100644 --- a/src/languages/prism-latte.ts +++ b/src/languages/prism-latte.ts @@ -1,8 +1,8 @@ -import { insertBefore } from '../shared/language-util'; -import { embeddedIn } from '../shared/languages/templating'; -import { tokenize } from '../shared/symbols'; -import markup from './prism-markup'; -import php from './prism-php'; +import { insertBefore } from '../shared/language-util.js'; +import { embeddedIn } from '../shared/languages/templating.js'; +import { tokenize } from '../shared/symbols.js'; +import markup from './prism-markup.js'; +import php from './prism-php.js'; import type { Grammar, GrammarToken, LanguageProto } from '../types'; export default { diff --git a/src/languages/prism-less.ts b/src/languages/prism-less.ts index 90205ed563..f127475509 100644 --- a/src/languages/prism-less.ts +++ b/src/languages/prism-less.ts @@ -1,5 +1,5 @@ -import { insertBefore } from '../shared/language-util'; -import css from './prism-css'; +import { insertBefore } from '../shared/language-util.js'; +import css from './prism-css.js'; import type { LanguageProto } from '../types'; export default { diff --git a/src/languages/prism-lilypond.ts b/src/languages/prism-lilypond.ts index 90003c794f..1e2df9ed6d 100644 --- a/src/languages/prism-lilypond.ts +++ b/src/languages/prism-lilypond.ts @@ -1,5 +1,5 @@ -import { rest } from '../shared/symbols'; -import scheme from './prism-scheme'; +import { rest } from '../shared/symbols.js'; +import scheme from './prism-scheme.js'; import type { LanguageProto } from '../types'; export default { diff --git a/src/languages/prism-liquid.ts b/src/languages/prism-liquid.ts index 3262ae2a91..616efb262e 100644 --- a/src/languages/prism-liquid.ts +++ b/src/languages/prism-liquid.ts @@ -1,6 +1,6 @@ -import { embeddedIn } from '../shared/languages/templating'; -import { tokenize } from '../shared/symbols'; -import markup from './prism-markup'; +import { embeddedIn } from '../shared/languages/templating.js'; +import { tokenize } from '../shared/symbols.js'; +import markup from './prism-markup.js'; import type { LanguageProto } from '../types'; export default { diff --git a/src/languages/prism-lisp.ts b/src/languages/prism-lisp.ts index b8ff0e6e31..90ecd625da 100644 --- a/src/languages/prism-lisp.ts +++ b/src/languages/prism-lisp.ts @@ -1,4 +1,4 @@ -import { rest } from '../shared/symbols'; +import { rest } from '../shared/symbols.js'; import type { LanguageProto } from '../types'; export default { diff --git a/src/languages/prism-livescript.ts b/src/languages/prism-livescript.ts index 175f14525f..3dca0cbdb8 100644 --- a/src/languages/prism-livescript.ts +++ b/src/languages/prism-livescript.ts @@ -1,4 +1,4 @@ -import { rest } from '../shared/symbols'; +import { rest } from '../shared/symbols.js'; import type { LanguageProto } from '../types'; export default { diff --git a/src/languages/prism-markdown.ts b/src/languages/prism-markdown.ts index d2cfd1de2e..1bc82980fb 100644 --- a/src/languages/prism-markdown.ts +++ b/src/languages/prism-markdown.ts @@ -1,7 +1,7 @@ -import { getTextContent } from '../core/token'; -import { insertBefore, withoutTokenize } from '../shared/language-util'; -import { tokenize } from '../shared/symbols'; -import markup from './prism-markup'; +import { getTextContent } from '../core/token.js'; +import { insertBefore, withoutTokenize } from '../shared/language-util.js'; +import { tokenize } from '../shared/symbols.js'; +import markup from './prism-markup.js'; import type { Grammar, GrammarToken, LanguageProto } from '../types'; export default { diff --git a/src/languages/prism-markup.ts b/src/languages/prism-markup.ts index e4edd61d20..7304230c91 100644 --- a/src/languages/prism-markup.ts +++ b/src/languages/prism-markup.ts @@ -1,5 +1,5 @@ -import { insertBefore } from '../shared/language-util'; -import xml from './prism-xml'; +import { insertBefore } from '../shared/language-util.js'; +import xml from './prism-xml.js'; import type { Grammar, GrammarToken, LanguageProto } from '../types'; /** diff --git a/src/languages/prism-mongodb.ts b/src/languages/prism-mongodb.ts index 9fcb0b13e8..0bb394e2f3 100644 --- a/src/languages/prism-mongodb.ts +++ b/src/languages/prism-mongodb.ts @@ -1,5 +1,5 @@ -import { insertBefore } from '../shared/language-util'; -import javascript from './prism-javascript'; +import { insertBefore } from '../shared/language-util.js'; +import javascript from './prism-javascript.js'; import type { GrammarToken, LanguageProto } from '../types'; export default { diff --git a/src/languages/prism-n4js.ts b/src/languages/prism-n4js.ts index 8db9259275..1cfd7531a7 100644 --- a/src/languages/prism-n4js.ts +++ b/src/languages/prism-n4js.ts @@ -1,5 +1,5 @@ -import { insertBefore } from '../shared/language-util'; -import javascript from './prism-javascript'; +import { insertBefore } from '../shared/language-util.js'; +import javascript from './prism-javascript.js'; import type { LanguageProto } from '../types'; export default { diff --git a/src/languages/prism-naniscript.ts b/src/languages/prism-naniscript.ts index 888de6f0d3..a45449ca77 100644 --- a/src/languages/prism-naniscript.ts +++ b/src/languages/prism-naniscript.ts @@ -1,6 +1,6 @@ -import { getTextContent } from '../core/token'; -import { withoutTokenize } from '../shared/language-util'; -import { tokenize } from '../shared/symbols'; +import { getTextContent } from '../core/token.js'; +import { withoutTokenize } from '../shared/language-util.js'; +import { tokenize } from '../shared/symbols.js'; import type { LanguageProto } from '../types'; function isBracketsBalanced(input: string): boolean { diff --git a/src/languages/prism-objectivec.ts b/src/languages/prism-objectivec.ts index e691306604..e4e1954e96 100644 --- a/src/languages/prism-objectivec.ts +++ b/src/languages/prism-objectivec.ts @@ -1,4 +1,4 @@ -import c from './prism-c'; +import c from './prism-c.js'; import type { LanguageProto } from '../types'; export default { diff --git a/src/languages/prism-opencl.ts b/src/languages/prism-opencl.ts index 76e7dedef2..ce730b98e2 100644 --- a/src/languages/prism-opencl.ts +++ b/src/languages/prism-opencl.ts @@ -1,5 +1,5 @@ -import { insertBefore } from '../shared/language-util'; -import c from './prism-c'; +import { insertBefore } from '../shared/language-util.js'; +import c from './prism-c.js'; import type { LanguageProto } from '../types'; export default { diff --git a/src/languages/prism-parser.ts b/src/languages/prism-parser.ts index d00ed973c6..f2cde45f34 100644 --- a/src/languages/prism-parser.ts +++ b/src/languages/prism-parser.ts @@ -1,5 +1,5 @@ -import { insertBefore } from '../shared/language-util'; -import markup from './prism-markup'; +import { insertBefore } from '../shared/language-util.js'; +import markup from './prism-markup.js'; import type { Grammar, GrammarToken, LanguageProto } from '../types'; export default { diff --git a/src/languages/prism-php.ts b/src/languages/prism-php.ts index 6e3bebd156..c16f97ef0b 100644 --- a/src/languages/prism-php.ts +++ b/src/languages/prism-php.ts @@ -1,7 +1,7 @@ -import { insertBefore } from '../shared/language-util'; -import { embeddedIn } from '../shared/languages/templating'; -import { tokenize } from '../shared/symbols'; -import markup from './prism-markup'; +import { insertBefore } from '../shared/language-util.js'; +import { embeddedIn } from '../shared/languages/templating.js'; +import { tokenize } from '../shared/symbols.js'; +import markup from './prism-markup.js'; import type { LanguageProto } from '../types'; export default { diff --git a/src/languages/prism-phpdoc.ts b/src/languages/prism-phpdoc.ts index 6e01700ee7..9d58790f9d 100644 --- a/src/languages/prism-phpdoc.ts +++ b/src/languages/prism-phpdoc.ts @@ -1,5 +1,5 @@ -import { insertBefore } from '../shared/language-util'; -import javadoclike from './prism-javadoclike'; +import { insertBefore } from '../shared/language-util.js'; +import javadoclike from './prism-javadoclike.js'; import type { LanguageProto } from '../types'; export default { diff --git a/src/languages/prism-plsql.ts b/src/languages/prism-plsql.ts index f1357f47c5..4722a0c6b4 100644 --- a/src/languages/prism-plsql.ts +++ b/src/languages/prism-plsql.ts @@ -1,5 +1,5 @@ -import { insertBefore } from '../shared/language-util'; -import sql from './prism-sql'; +import { insertBefore } from '../shared/language-util.js'; +import sql from './prism-sql.js'; import type { LanguageProto } from '../types'; export default { diff --git a/src/languages/prism-processing.ts b/src/languages/prism-processing.ts index 948556b741..142d898802 100644 --- a/src/languages/prism-processing.ts +++ b/src/languages/prism-processing.ts @@ -1,5 +1,5 @@ -import { insertBefore } from '../shared/language-util'; -import clike from './prism-clike'; +import { insertBefore } from '../shared/language-util.js'; +import clike from './prism-clike.js'; import type { LanguageProto } from '../types'; export default { diff --git a/src/languages/prism-protobuf.ts b/src/languages/prism-protobuf.ts index f1ae260998..c700bda10f 100644 --- a/src/languages/prism-protobuf.ts +++ b/src/languages/prism-protobuf.ts @@ -1,5 +1,5 @@ -import { insertBefore } from '../shared/language-util'; -import clike from './prism-clike'; +import { insertBefore } from '../shared/language-util.js'; +import clike from './prism-clike.js'; import type { LanguageProto } from '../types'; export default { diff --git a/src/languages/prism-pug.ts b/src/languages/prism-pug.ts index 87848efcd4..6343fc3dc5 100644 --- a/src/languages/prism-pug.ts +++ b/src/languages/prism-pug.ts @@ -1,7 +1,7 @@ -import { insertBefore } from '../shared/language-util'; -import { rest } from '../shared/symbols'; -import javascript from './prism-javascript'; -import markup from './prism-markup'; +import { insertBefore } from '../shared/language-util.js'; +import { rest } from '../shared/symbols.js'; +import javascript from './prism-javascript.js'; +import markup from './prism-markup.js'; import type { GrammarTokens, LanguageProto } from '../types'; export default { diff --git a/src/languages/prism-puppet.ts b/src/languages/prism-puppet.ts index 2550927fe9..015b563d0b 100644 --- a/src/languages/prism-puppet.ts +++ b/src/languages/prism-puppet.ts @@ -1,4 +1,4 @@ -import { rest } from '../shared/symbols'; +import { rest } from '../shared/symbols.js'; import type { LanguageProto } from '../types'; export default { diff --git a/src/languages/prism-pure.ts b/src/languages/prism-pure.ts index e512e7521e..0af3a36b23 100644 --- a/src/languages/prism-pure.ts +++ b/src/languages/prism-pure.ts @@ -1,5 +1,5 @@ -import { insertBefore } from '../shared/language-util'; -import { rest } from '../shared/symbols'; +import { insertBefore } from '../shared/language-util.js'; +import { rest } from '../shared/symbols.js'; import type { LanguageProto } from '../types'; export default { diff --git a/src/languages/prism-purebasic.ts b/src/languages/prism-purebasic.ts index 682789674f..7c3958c61a 100644 --- a/src/languages/prism-purebasic.ts +++ b/src/languages/prism-purebasic.ts @@ -1,5 +1,5 @@ -import { insertBefore } from '../shared/language-util'; -import clike from './prism-clike'; +import { insertBefore } from '../shared/language-util.js'; +import clike from './prism-clike.js'; import type { LanguageProto } from '../types'; export default { diff --git a/src/languages/prism-purescript.ts b/src/languages/prism-purescript.ts index 3b9d48a274..1624b08a56 100644 --- a/src/languages/prism-purescript.ts +++ b/src/languages/prism-purescript.ts @@ -1,4 +1,4 @@ -import haskell, { asciiOperator, infixOperator } from './prism-haskell'; +import haskell, { asciiOperator, infixOperator } from './prism-haskell.js'; import type { LanguageProto } from '../types'; export default { diff --git a/src/languages/prism-python.ts b/src/languages/prism-python.ts index acbd559ad1..9e312ef9fa 100644 --- a/src/languages/prism-python.ts +++ b/src/languages/prism-python.ts @@ -1,4 +1,4 @@ -import { rest } from '../shared/symbols'; +import { rest } from '../shared/symbols.js'; import type { LanguageProto } from '../types'; export default { diff --git a/src/languages/prism-qml.ts b/src/languages/prism-qml.ts index c6d9584da2..80d47249b8 100644 --- a/src/languages/prism-qml.ts +++ b/src/languages/prism-qml.ts @@ -1,4 +1,4 @@ -import javascript from './prism-javascript'; +import javascript from './prism-javascript.js'; import type { LanguageProto } from '../types'; export default { diff --git a/src/languages/prism-qore.ts b/src/languages/prism-qore.ts index 7ab6809d38..db5b27c54e 100644 --- a/src/languages/prism-qore.ts +++ b/src/languages/prism-qore.ts @@ -1,4 +1,4 @@ -import clike from './prism-clike'; +import clike from './prism-clike.js'; import type { LanguageProto } from '../types'; export default { diff --git a/src/languages/prism-qsharp.ts b/src/languages/prism-qsharp.ts index 7cac5eea76..c1c715372f 100644 --- a/src/languages/prism-qsharp.ts +++ b/src/languages/prism-qsharp.ts @@ -1,5 +1,5 @@ -import { insertBefore } from '../shared/language-util'; -import clike from './prism-clike'; +import { insertBefore } from '../shared/language-util.js'; +import clike from './prism-clike.js'; import type { LanguageProto } from '../types'; export default { diff --git a/src/languages/prism-racket.ts b/src/languages/prism-racket.ts index 53a9ff8bb5..bf5c29bfeb 100644 --- a/src/languages/prism-racket.ts +++ b/src/languages/prism-racket.ts @@ -1,5 +1,5 @@ -import { insertBefore } from '../shared/language-util'; -import scheme from './prism-scheme'; +import { insertBefore } from '../shared/language-util.js'; +import scheme from './prism-scheme.js'; import type { LanguageProto } from '../types'; export default { diff --git a/src/languages/prism-reason.ts b/src/languages/prism-reason.ts index e90e9126db..67098979e0 100644 --- a/src/languages/prism-reason.ts +++ b/src/languages/prism-reason.ts @@ -1,5 +1,5 @@ -import { insertBefore } from '../shared/language-util'; -import clike from './prism-clike'; +import { insertBefore } from '../shared/language-util.js'; +import clike from './prism-clike.js'; import type { LanguageProto } from '../types'; export default { diff --git a/src/languages/prism-rescript.ts b/src/languages/prism-rescript.ts index 60e90568e5..7d9fbbb2bc 100644 --- a/src/languages/prism-rescript.ts +++ b/src/languages/prism-rescript.ts @@ -1,5 +1,5 @@ -import { insertBefore } from '../shared/language-util'; -import { rest } from '../shared/symbols'; +import { insertBefore } from '../shared/language-util.js'; +import { rest } from '../shared/symbols.js'; import type { LanguageProto } from '../types'; export default { diff --git a/src/languages/prism-ruby.ts b/src/languages/prism-ruby.ts index df527f228c..61938f181b 100644 --- a/src/languages/prism-ruby.ts +++ b/src/languages/prism-ruby.ts @@ -1,5 +1,5 @@ -import { insertBefore } from '../shared/language-util'; -import clike from './prism-clike'; +import { insertBefore } from '../shared/language-util.js'; +import clike from './prism-clike.js'; import type { LanguageProto } from '../types'; export default { diff --git a/src/languages/prism-rust.ts b/src/languages/prism-rust.ts index 8fb5f2ebfc..2dadf52ed1 100644 --- a/src/languages/prism-rust.ts +++ b/src/languages/prism-rust.ts @@ -1,4 +1,4 @@ -import { rest } from '../shared/symbols'; +import { rest } from '../shared/symbols.js'; import type { LanguageProto } from '../types'; export default { diff --git a/src/languages/prism-sas.ts b/src/languages/prism-sas.ts index ce108db86e..7b08908379 100644 --- a/src/languages/prism-sas.ts +++ b/src/languages/prism-sas.ts @@ -1,4 +1,4 @@ -import { rest } from '../shared/symbols'; +import { rest } from '../shared/symbols.js'; import type { LanguageProto } from '../types'; export default { diff --git a/src/languages/prism-sass.ts b/src/languages/prism-sass.ts index 4c8c20f6c6..d6c47cd518 100644 --- a/src/languages/prism-sass.ts +++ b/src/languages/prism-sass.ts @@ -1,5 +1,5 @@ -import { insertBefore } from '../shared/language-util'; -import css from './prism-css'; +import { insertBefore } from '../shared/language-util.js'; +import css from './prism-css.js'; import type { LanguageProto } from '../types'; export default { diff --git a/src/languages/prism-scala.ts b/src/languages/prism-scala.ts index 7f2c6f8757..5cb8a7fdd2 100644 --- a/src/languages/prism-scala.ts +++ b/src/languages/prism-scala.ts @@ -1,5 +1,5 @@ -import { insertBefore } from '../shared/language-util'; -import java from './prism-java'; +import { insertBefore } from '../shared/language-util.js'; +import java from './prism-java.js'; import type { LanguageProto } from '../types'; export default { diff --git a/src/languages/prism-scss.ts b/src/languages/prism-scss.ts index 2cf9d53c58..f325fe252f 100644 --- a/src/languages/prism-scss.ts +++ b/src/languages/prism-scss.ts @@ -1,6 +1,6 @@ -import { insertBefore } from '../shared/language-util'; -import { rest } from '../shared/symbols'; -import css from './prism-css'; +import { insertBefore } from '../shared/language-util.js'; +import { rest } from '../shared/symbols.js'; +import css from './prism-css.js'; import type { LanguageProto } from '../types'; export default { diff --git a/src/languages/prism-shell-session.ts b/src/languages/prism-shell-session.ts index 0215813fcf..edc115b565 100644 --- a/src/languages/prism-shell-session.ts +++ b/src/languages/prism-shell-session.ts @@ -1,4 +1,4 @@ -import bash from './prism-bash'; +import bash from './prism-bash.js'; import type { LanguageProto } from '../types'; export default { diff --git a/src/languages/prism-smarty.ts b/src/languages/prism-smarty.ts index 7fb1fd35be..1e0320687d 100644 --- a/src/languages/prism-smarty.ts +++ b/src/languages/prism-smarty.ts @@ -1,6 +1,6 @@ -import { embeddedIn } from '../shared/languages/templating'; -import { tokenize } from '../shared/symbols'; -import markup from './prism-markup'; +import { embeddedIn } from '../shared/languages/templating.js'; +import { tokenize } from '../shared/symbols.js'; +import markup from './prism-markup.js'; import type { GrammarToken, LanguageProto } from '../types'; export default { diff --git a/src/languages/prism-solidity.ts b/src/languages/prism-solidity.ts index c553a7117a..36f627ba0e 100644 --- a/src/languages/prism-solidity.ts +++ b/src/languages/prism-solidity.ts @@ -1,5 +1,5 @@ -import { insertBefore } from '../shared/language-util'; -import clike from './prism-clike'; +import { insertBefore } from '../shared/language-util.js'; +import clike from './prism-clike.js'; import type { LanguageProto } from '../types'; export default { diff --git a/src/languages/prism-soy.ts b/src/languages/prism-soy.ts index ee6cc73045..e2ed1af89d 100644 --- a/src/languages/prism-soy.ts +++ b/src/languages/prism-soy.ts @@ -1,6 +1,6 @@ -import { embeddedIn } from '../shared/languages/templating'; -import { tokenize } from '../shared/symbols'; -import markup from './prism-markup'; +import { embeddedIn } from '../shared/languages/templating.js'; +import { tokenize } from '../shared/symbols.js'; +import markup from './prism-markup.js'; import type { LanguageProto } from '../types'; export default { diff --git a/src/languages/prism-sparql.ts b/src/languages/prism-sparql.ts index 3ac5eba346..8d327f0dc8 100644 --- a/src/languages/prism-sparql.ts +++ b/src/languages/prism-sparql.ts @@ -1,5 +1,5 @@ -import { insertBefore } from '../shared/language-util'; -import turtle from './prism-turtle'; +import { insertBefore } from '../shared/language-util.js'; +import turtle from './prism-turtle.js'; import type { LanguageProto } from '../types'; export default { diff --git a/src/languages/prism-sqf.ts b/src/languages/prism-sqf.ts index 9c3499f4cb..efb1fa4f29 100644 --- a/src/languages/prism-sqf.ts +++ b/src/languages/prism-sqf.ts @@ -1,5 +1,5 @@ -import { insertBefore } from '../shared/language-util'; -import clike from './prism-clike'; +import { insertBefore } from '../shared/language-util.js'; +import clike from './prism-clike.js'; import type { LanguageProto } from '../types'; export default { diff --git a/src/languages/prism-squirrel.ts b/src/languages/prism-squirrel.ts index fb4e48e105..e40deed2b7 100644 --- a/src/languages/prism-squirrel.ts +++ b/src/languages/prism-squirrel.ts @@ -1,6 +1,6 @@ -import { insertBefore } from '../shared/language-util'; -import { toArray } from '../shared/util'; -import clike from './prism-clike'; +import { insertBefore } from '../shared/language-util.js'; +import { toArray } from '../shared/util.js'; +import clike from './prism-clike.js'; import type { LanguageProto } from '../types'; export default { diff --git a/src/languages/prism-stata.ts b/src/languages/prism-stata.ts index e2eaeac6c3..7a27fb9735 100644 --- a/src/languages/prism-stata.ts +++ b/src/languages/prism-stata.ts @@ -1,6 +1,6 @@ -import java from './prism-java'; -import mata from './prism-mata'; -import python from './prism-python'; +import java from './prism-java.js'; +import mata from './prism-mata.js'; +import python from './prism-python.js'; import type { LanguageProto } from '../types'; export default { diff --git a/src/languages/prism-stylus.ts b/src/languages/prism-stylus.ts index a962031f63..fa34882712 100644 --- a/src/languages/prism-stylus.ts +++ b/src/languages/prism-stylus.ts @@ -1,4 +1,4 @@ -import { rest } from '../shared/symbols'; +import { rest } from '../shared/symbols.js'; import type { Grammar, LanguageProto } from '../types'; export default { diff --git a/src/languages/prism-t4-cs.ts b/src/languages/prism-t4-cs.ts index 7c5a6cd0db..f954c0f3bb 100644 --- a/src/languages/prism-t4-cs.ts +++ b/src/languages/prism-t4-cs.ts @@ -1,5 +1,5 @@ -import { createT4 } from '../shared/languages/t4-templating'; -import csharp from './prism-csharp'; +import { createT4 } from '../shared/languages/t4-templating.js'; +import csharp from './prism-csharp.js'; import type { LanguageProto } from '../types'; export default { diff --git a/src/languages/prism-t4-vb.ts b/src/languages/prism-t4-vb.ts index 2c5d25e561..266354e625 100644 --- a/src/languages/prism-t4-vb.ts +++ b/src/languages/prism-t4-vb.ts @@ -1,5 +1,5 @@ -import { createT4 } from '../shared/languages/t4-templating'; -import vbnet from './prism-vbnet'; +import { createT4 } from '../shared/languages/t4-templating.js'; +import vbnet from './prism-vbnet.js'; import type { LanguageProto } from '../types'; export default { diff --git a/src/languages/prism-tap.ts b/src/languages/prism-tap.ts index a2cda5f62e..7b4a662f95 100644 --- a/src/languages/prism-tap.ts +++ b/src/languages/prism-tap.ts @@ -1,4 +1,4 @@ -import yaml from './prism-yaml'; +import yaml from './prism-yaml.js'; import type { LanguageProto } from '../types'; // https://en.wikipedia.org/wiki/Test_Anything_Protocol diff --git a/src/languages/prism-textile.ts b/src/languages/prism-textile.ts index 67608151c8..b6d55e1c54 100644 --- a/src/languages/prism-textile.ts +++ b/src/languages/prism-textile.ts @@ -1,4 +1,4 @@ -import markup from './prism-markup'; +import markup from './prism-markup.js'; import type { GrammarToken, LanguageProto } from '../types'; export default { diff --git a/src/languages/prism-treeview.ts b/src/languages/prism-treeview.ts index 1f07380f06..0a2482577f 100644 --- a/src/languages/prism-treeview.ts +++ b/src/languages/prism-treeview.ts @@ -1,6 +1,6 @@ -import { getTextContent } from '../core/token'; -import { withoutTokenize } from '../shared/language-util'; -import { tokenize } from '../shared/symbols'; +import { getTextContent } from '../core/token.js'; +import { withoutTokenize } from '../shared/language-util.js'; +import { tokenize } from '../shared/symbols.js'; import type { LanguageProto } from '../types'; export default { diff --git a/src/languages/prism-tsx.ts b/src/languages/prism-tsx.ts index 1b207e3737..ebb78600d8 100644 --- a/src/languages/prism-tsx.ts +++ b/src/languages/prism-tsx.ts @@ -1,5 +1,5 @@ -import jsx from './prism-jsx'; -import typescript from './prism-typescript'; +import jsx from './prism-jsx.js'; +import typescript from './prism-typescript.js'; import type { GrammarToken, LanguageProto } from '../types'; export default { diff --git a/src/languages/prism-tt2.ts b/src/languages/prism-tt2.ts index 072aaeace7..f375b5d8f4 100644 --- a/src/languages/prism-tt2.ts +++ b/src/languages/prism-tt2.ts @@ -1,8 +1,8 @@ -import { insertBefore } from '../shared/language-util'; -import { embeddedIn } from '../shared/languages/templating'; -import { tokenize } from '../shared/symbols'; -import clike from './prism-clike'; -import markup from './prism-markup'; +import { insertBefore } from '../shared/language-util.js'; +import { embeddedIn } from '../shared/languages/templating.js'; +import { tokenize } from '../shared/symbols.js'; +import clike from './prism-clike.js'; +import markup from './prism-markup.js'; import type { LanguageProto } from '../types'; export default { diff --git a/src/languages/prism-twig.ts b/src/languages/prism-twig.ts index f7d04a6a9c..8e9fcc74dc 100644 --- a/src/languages/prism-twig.ts +++ b/src/languages/prism-twig.ts @@ -1,6 +1,6 @@ -import { embeddedIn } from '../shared/languages/templating'; -import { tokenize } from '../shared/symbols'; -import markup from './prism-markup'; +import { embeddedIn } from '../shared/languages/templating.js'; +import { tokenize } from '../shared/symbols.js'; +import markup from './prism-markup.js'; import type { LanguageProto } from '../types'; export default { diff --git a/src/languages/prism-typescript.ts b/src/languages/prism-typescript.ts index 4fb2f370c3..0b90485e2c 100644 --- a/src/languages/prism-typescript.ts +++ b/src/languages/prism-typescript.ts @@ -1,6 +1,6 @@ -import { insertBefore } from '../shared/language-util'; -import { toArray } from '../shared/util'; -import javascript from './prism-javascript'; +import { insertBefore } from '../shared/language-util.js'; +import { toArray } from '../shared/util.js'; +import javascript from './prism-javascript.js'; import type { Grammar, LanguageProto } from '../types'; export default { diff --git a/src/languages/prism-v.ts b/src/languages/prism-v.ts index d049888aec..3080c2cc41 100644 --- a/src/languages/prism-v.ts +++ b/src/languages/prism-v.ts @@ -1,5 +1,5 @@ -import { insertBefore } from '../shared/language-util'; -import clike from './prism-clike'; +import { insertBefore } from '../shared/language-util.js'; +import clike from './prism-clike.js'; import type { LanguageProto } from '../types'; export default { diff --git a/src/languages/prism-vala.ts b/src/languages/prism-vala.ts index bfd4aef11f..77e022c759 100644 --- a/src/languages/prism-vala.ts +++ b/src/languages/prism-vala.ts @@ -1,6 +1,6 @@ -import { insertBefore } from '../shared/language-util'; -import { rest } from '../shared/symbols'; -import clike from './prism-clike'; +import { insertBefore } from '../shared/language-util.js'; +import { rest } from '../shared/symbols.js'; +import clike from './prism-clike.js'; import type { LanguageProto } from '../types'; export default { diff --git a/src/languages/prism-vbnet.ts b/src/languages/prism-vbnet.ts index 4c0f3e5351..61008db1ea 100644 --- a/src/languages/prism-vbnet.ts +++ b/src/languages/prism-vbnet.ts @@ -1,5 +1,5 @@ -import { insertBefore } from '../shared/language-util'; -import basic from './prism-basic'; +import { insertBefore } from '../shared/language-util.js'; +import basic from './prism-basic.js'; import type { LanguageProto } from '../types'; export default { diff --git a/src/languages/prism-velocity.ts b/src/languages/prism-velocity.ts index b28e00f4c2..a461e7ff92 100644 --- a/src/languages/prism-velocity.ts +++ b/src/languages/prism-velocity.ts @@ -1,6 +1,6 @@ -import { insertBefore } from '../shared/language-util'; -import { rest } from '../shared/symbols'; -import markup from './prism-markup'; +import { insertBefore } from '../shared/language-util.js'; +import { rest } from '../shared/symbols.js'; +import markup from './prism-markup.js'; import type { Grammar, GrammarToken, LanguageProto } from '../types'; export default { diff --git a/src/languages/prism-wiki.ts b/src/languages/prism-wiki.ts index ef175911ae..155b3b75b8 100644 --- a/src/languages/prism-wiki.ts +++ b/src/languages/prism-wiki.ts @@ -1,6 +1,6 @@ -import { insertBefore } from '../shared/language-util'; -import { rest } from '../shared/symbols'; -import markup from './prism-markup'; +import { insertBefore } from '../shared/language-util.js'; +import { rest } from '../shared/symbols.js'; +import markup from './prism-markup.js'; import type { GrammarToken, LanguageProto } from '../types'; export default { diff --git a/src/languages/prism-xeora.ts b/src/languages/prism-xeora.ts index 50f06349e0..9bc10e980c 100644 --- a/src/languages/prism-xeora.ts +++ b/src/languages/prism-xeora.ts @@ -1,4 +1,4 @@ -import markup from './prism-markup'; +import markup from './prism-markup.js'; import type { LanguageProto } from '../types'; export default { diff --git a/src/languages/prism-xml-doc.ts b/src/languages/prism-xml-doc.ts index 8168495556..b62fe2c3c5 100644 --- a/src/languages/prism-xml-doc.ts +++ b/src/languages/prism-xml-doc.ts @@ -1,4 +1,4 @@ -import markup from './prism-markup'; +import markup from './prism-markup.js'; import type { LanguageProto } from '../types'; export default { diff --git a/src/languages/prism-xml.ts b/src/languages/prism-xml.ts index 0890de0498..0a99ee81c5 100644 --- a/src/languages/prism-xml.ts +++ b/src/languages/prism-xml.ts @@ -1,4 +1,4 @@ -import { MARKUP_TAG } from '../shared/languages/patterns'; +import { MARKUP_TAG } from '../shared/languages/patterns.js'; import type { LanguageProto } from '../types'; export default { diff --git a/src/languages/prism-xquery.ts b/src/languages/prism-xquery.ts index f684e86fd2..2d8bd801bf 100644 --- a/src/languages/prism-xquery.ts +++ b/src/languages/prism-xquery.ts @@ -1,8 +1,8 @@ -import { Token, getTextContent } from '../core/token'; -import { withoutTokenize } from '../shared/language-util'; -import { tokenize } from '../shared/symbols'; -import markup from './prism-markup'; -import type { TokenStream } from '../core/token'; +import { Token, getTextContent } from '../core/token.js'; +import { withoutTokenize } from '../shared/language-util.js'; +import { tokenize } from '../shared/symbols.js'; +import markup from './prism-markup.js'; +import type { TokenStream } from '../core/token.js'; import type { Grammar, GrammarToken, LanguageProto } from '../types'; function walkTokens(tokens: TokenStream) { diff --git a/src/load-languages.ts b/src/load-languages.ts index 241f1102f9..1fc7b394c7 100644 --- a/src/load-languages.ts +++ b/src/load-languages.ts @@ -1,7 +1,7 @@ -import { resolveAlias } from './shared/meta/alias-data'; -import { knownLanguages } from './shared/meta/all-languages-data'; -import { toArray } from './shared/util'; -import type { Prism } from './core'; +import { resolveAlias } from './shared/meta/alias-data.js'; +import { knownLanguages } from './shared/meta/all-languages-data.js'; +import { toArray } from './shared/util.js'; +import type { Prism } from './core.js'; import type { ComponentProto } from './types'; function pathJoin(dir: string, file: string) { diff --git a/src/plugins/autolinker/prism-autolinker.ts b/src/plugins/autolinker/prism-autolinker.ts index 140d90402a..479b5f1013 100644 --- a/src/plugins/autolinker/prism-autolinker.ts +++ b/src/plugins/autolinker/prism-autolinker.ts @@ -1,5 +1,5 @@ -import { addHooks } from '../../shared/hooks-util'; -import { tokenizeStrings } from '../../shared/tokenize-strings'; +import { addHooks } from '../../shared/hooks-util.js'; +import { tokenizeStrings } from '../../shared/tokenize-strings.js'; import type { PluginProto } from '../../types'; export default { diff --git a/src/plugins/autoloader/prism-autoloader.ts b/src/plugins/autoloader/prism-autoloader.ts index 1e6b5c7dfb..6bd87ca741 100644 --- a/src/plugins/autoloader/prism-autoloader.ts +++ b/src/plugins/autoloader/prism-autoloader.ts @@ -1,7 +1,7 @@ -import { getParentPre } from '../../shared/dom-util'; -import { resolveAlias } from '../../shared/meta/alias-data'; -import { toArray } from '../../shared/util'; -import type { Prism } from '../../core'; +import { getParentPre } from '../../shared/dom-util.js'; +import { resolveAlias } from '../../shared/meta/alias-data.js'; +import { toArray } from '../../shared/util.js'; +import type { Prism } from '../../core.js'; import type { ComponentProto, PluginProto } from '../../types'; function getDefaultSrcPath() { diff --git a/src/plugins/command-line/prism-command-line.ts b/src/plugins/command-line/prism-command-line.ts index 1d77db0d3f..6a6f18d0f8 100644 --- a/src/plugins/command-line/prism-command-line.ts +++ b/src/plugins/command-line/prism-command-line.ts @@ -1,7 +1,7 @@ -import { getParentPre } from '../../shared/dom-util'; -import { addHooks } from '../../shared/hooks-util'; -import { htmlEncode } from '../../shared/util'; -import type { StateKey } from '../../core/hook-state'; +import { getParentPre } from '../../shared/dom-util.js'; +import { addHooks } from '../../shared/hooks-util.js'; +import { htmlEncode } from '../../shared/util.js'; +import type { StateKey } from '../../core/hook-state.js'; import type { PluginProto } from '../../types'; const CLASS_PATTERN = /(?:^|\s)command-line(?:\s|$)/; diff --git a/src/plugins/copy-to-clipboard/prism-copy-to-clipboard.ts b/src/plugins/copy-to-clipboard/prism-copy-to-clipboard.ts index 4d38b8412f..4154b8933c 100644 --- a/src/plugins/copy-to-clipboard/prism-copy-to-clipboard.ts +++ b/src/plugins/copy-to-clipboard/prism-copy-to-clipboard.ts @@ -1,4 +1,4 @@ -import toolbar from '../toolbar/prism-toolbar'; +import toolbar from '../toolbar/prism-toolbar.js'; import type { PluginProto } from '../../types'; interface CopyInfo { diff --git a/src/plugins/data-uri-highlight/prism-data-uri-highlight.ts b/src/plugins/data-uri-highlight/prism-data-uri-highlight.ts index f3ca32dd1a..040c7aef1e 100644 --- a/src/plugins/data-uri-highlight/prism-data-uri-highlight.ts +++ b/src/plugins/data-uri-highlight/prism-data-uri-highlight.ts @@ -1,4 +1,4 @@ -import { tokenizeStrings } from '../../shared/tokenize-strings'; +import { tokenizeStrings } from '../../shared/tokenize-strings.js'; import type { PluginProto } from '../../types'; export default { diff --git a/src/plugins/diff-highlight/prism-diff-highlight.ts b/src/plugins/diff-highlight/prism-diff-highlight.ts index d0216ccca8..df761078ba 100644 --- a/src/plugins/diff-highlight/prism-diff-highlight.ts +++ b/src/plugins/diff-highlight/prism-diff-highlight.ts @@ -1,8 +1,8 @@ -import { Token, getTextContent } from '../../core/token'; -import diff, { PREFIXES } from '../../languages/prism-diff'; -import { addHooks } from '../../shared/hooks-util'; -import type { BeforeSanityCheckEnv, BeforeTokenizeEnv } from '../../core/hooks'; -import type { TokenStream } from '../../core/token'; +import { Token, getTextContent } from '../../core/token.js'; +import diff, { PREFIXES } from '../../languages/prism-diff.js'; +import { addHooks } from '../../shared/hooks-util.js'; +import type { BeforeSanityCheckEnv, BeforeTokenizeEnv } from '../../core/hooks.js'; +import type { TokenStream } from '../../core/token.js'; import type { PluginProto } from '../../types'; export default { diff --git a/src/plugins/download-button/prism-download-button.ts b/src/plugins/download-button/prism-download-button.ts index b2d64601f6..e3ae3a035c 100644 --- a/src/plugins/download-button/prism-download-button.ts +++ b/src/plugins/download-button/prism-download-button.ts @@ -1,5 +1,5 @@ -import { getParentPre } from '../../shared/dom-util'; -import toolbar from '../toolbar/prism-toolbar'; +import { getParentPre } from '../../shared/dom-util.js'; +import toolbar from '../toolbar/prism-toolbar.js'; import type { PluginProto } from '../../types'; export default { diff --git a/src/plugins/file-highlight/prism-file-highlight.ts b/src/plugins/file-highlight/prism-file-highlight.ts index 451c268849..0c5eff384f 100644 --- a/src/plugins/file-highlight/prism-file-highlight.ts +++ b/src/plugins/file-highlight/prism-file-highlight.ts @@ -1,6 +1,6 @@ -import { setLanguage } from '../../shared/dom-util'; -import { addHooks } from '../../shared/hooks-util'; -import type { Prism } from '../../core'; +import { setLanguage } from '../../shared/dom-util.js'; +import { addHooks } from '../../shared/hooks-util.js'; +import type { Prism } from '../../core.js'; import type { PluginProto } from '../../types'; const FAILURE_MESSAGE = (status: number, message: string) => { diff --git a/src/plugins/filter-highlight-all/prism-filter-highlight-all.ts b/src/plugins/filter-highlight-all/prism-filter-highlight-all.ts index aa1c3c1f1c..319b38fb41 100644 --- a/src/plugins/filter-highlight-all/prism-filter-highlight-all.ts +++ b/src/plugins/filter-highlight-all/prism-filter-highlight-all.ts @@ -1,4 +1,4 @@ -import { getLanguage } from '../../shared/dom-util'; +import { getLanguage } from '../../shared/dom-util.js'; import type { PluginProto } from '../../types'; type Condition = (value: { element: Element; language: string }) => boolean; diff --git a/src/plugins/inline-color/prism-inline-color.ts b/src/plugins/inline-color/prism-inline-color.ts index 65fa5c771f..c4103068f3 100644 --- a/src/plugins/inline-color/prism-inline-color.ts +++ b/src/plugins/inline-color/prism-inline-color.ts @@ -1,5 +1,5 @@ -import cssExtras from '../../languages/prism-css-extras'; -import { MARKUP_TAG } from '../../shared/languages/patterns'; +import cssExtras from '../../languages/prism-css-extras.js'; +import { MARKUP_TAG } from '../../shared/languages/patterns.js'; import type { PluginProto } from '../../types'; const HTML_TAG = RegExp(MARKUP_TAG, 'g'); diff --git a/src/plugins/jsonp-highlight/prism-jsonp-highlight.ts b/src/plugins/jsonp-highlight/prism-jsonp-highlight.ts index be6fe22058..84f1a8f419 100644 --- a/src/plugins/jsonp-highlight/prism-jsonp-highlight.ts +++ b/src/plugins/jsonp-highlight/prism-jsonp-highlight.ts @@ -1,5 +1,5 @@ -import { addHooks } from '../../shared/hooks-util'; -import type { Prism } from '../../core'; +import { addHooks } from '../../shared/hooks-util.js'; +import type { Prism } from '../../core.js'; import type { PluginProto } from '../../types'; function getGlobal(): Record { diff --git a/src/plugins/keep-markup/prism-keep-markup.ts b/src/plugins/keep-markup/prism-keep-markup.ts index da99f76eea..206063584a 100644 --- a/src/plugins/keep-markup/prism-keep-markup.ts +++ b/src/plugins/keep-markup/prism-keep-markup.ts @@ -1,6 +1,6 @@ -import { isActive } from '../../shared/dom-util'; -import { addHooks } from '../../shared/hooks-util'; -import type { StateKey } from '../../core/hook-state'; +import { isActive } from '../../shared/dom-util.js'; +import { addHooks } from '../../shared/hooks-util.js'; +import type { StateKey } from '../../core/hook-state.js'; import type { PluginProto } from '../../types'; function isElement(child: ChildNode): child is Element { diff --git a/src/plugins/line-highlight/prism-line-highlight.ts b/src/plugins/line-highlight/prism-line-highlight.ts index 29faf57c2f..c57d7c6c7b 100644 --- a/src/plugins/line-highlight/prism-line-highlight.ts +++ b/src/plugins/line-highlight/prism-line-highlight.ts @@ -1,7 +1,7 @@ -import { isActive } from '../../shared/dom-util'; -import { combineCallbacks } from '../../shared/hooks-util'; -import { lazy, noop } from '../../shared/util'; -import type { Prism } from '../../core'; +import { isActive } from '../../shared/dom-util.js'; +import { combineCallbacks } from '../../shared/hooks-util.js'; +import { lazy, noop } from '../../shared/util.js'; +import type { Prism } from '../../core.js'; import type { PluginProto } from '../../types'; const LINE_NUMBERS_CLASS = 'line-numbers'; diff --git a/src/plugins/line-numbers/prism-line-numbers.ts b/src/plugins/line-numbers/prism-line-numbers.ts index 3f853f9d5f..54e9957869 100644 --- a/src/plugins/line-numbers/prism-line-numbers.ts +++ b/src/plugins/line-numbers/prism-line-numbers.ts @@ -1,6 +1,6 @@ -import { getParentPre, isActive } from '../../shared/dom-util'; -import { combineCallbacks } from '../../shared/hooks-util'; -import { isNonNull, noop } from '../../shared/util'; +import { getParentPre, isActive } from '../../shared/dom-util.js'; +import { combineCallbacks } from '../../shared/hooks-util.js'; +import { isNonNull, noop } from '../../shared/util.js'; import type { PluginProto } from '../../types'; /** diff --git a/src/plugins/match-braces/prism-match-braces.ts b/src/plugins/match-braces/prism-match-braces.ts index 6c7b045859..f648908f04 100644 --- a/src/plugins/match-braces/prism-match-braces.ts +++ b/src/plugins/match-braces/prism-match-braces.ts @@ -1,4 +1,4 @@ -import { getParentPre, isActive } from '../../shared/dom-util'; +import { getParentPre, isActive } from '../../shared/dom-util.js'; import type { PluginProto } from '../../types'; export default { diff --git a/src/plugins/normalize-whitespace/prism-normalize-whitespace.ts b/src/plugins/normalize-whitespace/prism-normalize-whitespace.ts index ca87080f9b..4625714d67 100644 --- a/src/plugins/normalize-whitespace/prism-normalize-whitespace.ts +++ b/src/plugins/normalize-whitespace/prism-normalize-whitespace.ts @@ -1,4 +1,4 @@ -import { getParentPre, isActive } from '../../shared/dom-util'; +import { getParentPre, isActive } from '../../shared/dom-util.js'; import type { PluginProto } from '../../types'; function tabLength(str: string) { diff --git a/src/plugins/previewers/prism-previewers.ts b/src/plugins/previewers/prism-previewers.ts index 70944b5ed0..660b1641d4 100644 --- a/src/plugins/previewers/prism-previewers.ts +++ b/src/plugins/previewers/prism-previewers.ts @@ -1,6 +1,6 @@ /* eslint-disable @typescript-eslint/no-non-null-assertion */ -import cssExtras from '../../languages/prism-css-extras'; -import { forEach } from '../../shared/util'; +import cssExtras from '../../languages/prism-css-extras.js'; +import { forEach } from '../../shared/util.js'; import type { PluginProto } from '../../types'; /** diff --git a/src/plugins/show-invisibles/prism-show-invisibles.ts b/src/plugins/show-invisibles/prism-show-invisibles.ts index d51f240d54..b84f6d2ce5 100644 --- a/src/plugins/show-invisibles/prism-show-invisibles.ts +++ b/src/plugins/show-invisibles/prism-show-invisibles.ts @@ -1,4 +1,4 @@ -import { tokenizeStrings } from '../../shared/tokenize-strings'; +import { tokenizeStrings } from '../../shared/tokenize-strings.js'; import type { PluginProto } from '../../types'; export default { diff --git a/src/plugins/show-language/prism-show-language.ts b/src/plugins/show-language/prism-show-language.ts index daeef836df..91b32fdae8 100644 --- a/src/plugins/show-language/prism-show-language.ts +++ b/src/plugins/show-language/prism-show-language.ts @@ -1,6 +1,6 @@ -import { getParentPre } from '../../shared/dom-util'; -import { getTitle } from '../../shared/meta/title-data'; -import toolbar from '../toolbar/prism-toolbar'; +import { getParentPre } from '../../shared/dom-util.js'; +import { getTitle } from '../../shared/meta/title-data.js'; +import toolbar from '../toolbar/prism-toolbar.js'; import type { PluginProto } from '../../types'; export default { diff --git a/src/plugins/toolbar/prism-toolbar.ts b/src/plugins/toolbar/prism-toolbar.ts index 135f9d42c4..da4e28eb19 100644 --- a/src/plugins/toolbar/prism-toolbar.ts +++ b/src/plugins/toolbar/prism-toolbar.ts @@ -1,6 +1,6 @@ -import { getParentPre } from '../../shared/dom-util'; -import { noop } from '../../shared/util'; -import type { CompleteEnv, HookCallback } from '../../core/hooks'; +import { getParentPre } from '../../shared/dom-util.js'; +import { noop } from '../../shared/util.js'; +import type { CompleteEnv, HookCallback } from '../../core/hooks.js'; import type { PluginProto } from '../../types'; /** diff --git a/src/plugins/treeview-icons/prism-treeview-icons.ts b/src/plugins/treeview-icons/prism-treeview-icons.ts index c899380720..6bd15199ea 100644 --- a/src/plugins/treeview-icons/prism-treeview-icons.ts +++ b/src/plugins/treeview-icons/prism-treeview-icons.ts @@ -1,4 +1,4 @@ -import treeview from '../../languages/prism-treeview'; +import treeview from '../../languages/prism-treeview.js'; import type { PluginProto } from '../../types'; export default { diff --git a/src/plugins/unescaped-markup/prism-unescaped-markup.ts b/src/plugins/unescaped-markup/prism-unescaped-markup.ts index d1d155069e..48e136e6fa 100644 --- a/src/plugins/unescaped-markup/prism-unescaped-markup.ts +++ b/src/plugins/unescaped-markup/prism-unescaped-markup.ts @@ -1,4 +1,4 @@ -import { addHooks } from '../../shared/hooks-util'; +import { addHooks } from '../../shared/hooks-util.js'; import type { PluginProto } from '../../types'; export default { diff --git a/src/plugins/wpd/prism-wpd.ts b/src/plugins/wpd/prism-wpd.ts index 3cb1c129df..7e2ad5ba4a 100644 --- a/src/plugins/wpd/prism-wpd.ts +++ b/src/plugins/wpd/prism-wpd.ts @@ -1,4 +1,4 @@ -import cssSelector from '../../languages/prism-css-selector'; +import cssSelector from '../../languages/prism-css-selector.js'; import type { PluginProto } from '../../types'; const htmlTags = new Set([ diff --git a/src/shared/hooks-util.ts b/src/shared/hooks-util.ts index 45d8e55f9a..345d406402 100644 --- a/src/shared/hooks-util.ts +++ b/src/shared/hooks-util.ts @@ -1,4 +1,4 @@ -import type { HookCallback, HookEnvMap, Hooks } from '../core/hooks'; +import type { HookCallback, HookEnvMap, Hooks } from '../core/hooks.js'; /** * Returns a single function that calls all the given functions. diff --git a/src/shared/language-util.ts b/src/shared/language-util.ts index 6078ab5701..62eeb39c8f 100644 --- a/src/shared/language-util.ts +++ b/src/shared/language-util.ts @@ -1,4 +1,4 @@ -import { rest, tokenize } from './symbols'; +import { rest, tokenize } from './symbols.js'; import type { Grammar, GrammarToken, GrammarTokens } from '../types'; // TODO: Update documentation diff --git a/src/shared/languages/templating.ts b/src/shared/languages/templating.ts index a42dd26d77..a840de1b68 100644 --- a/src/shared/languages/templating.ts +++ b/src/shared/languages/templating.ts @@ -1,10 +1,10 @@ -import { getTextContent } from '../../core/token'; -import { withoutTokenize } from '../language-util'; -import type { Prism } from '../../core'; -import type { Registry } from '../../core/registry'; -import type { Token, TokenStream } from '../../core/token'; +import { getTextContent } from '../../core/token.js'; +import { withoutTokenize } from '../language-util.js'; +import type { Prism } from '../../core.js'; +import type { Registry } from '../../core/registry.js'; +import type { Token, TokenStream } from '../../core/token.js'; import type { Grammar } from '../../types'; -import type { tokenize } from '../symbols'; +import type { tokenize } from '../symbols.js'; const placeholderPattern = /___PH\d+___/; diff --git a/src/shared/tokenize-strings.ts b/src/shared/tokenize-strings.ts index fd91017974..cca132ad42 100644 --- a/src/shared/tokenize-strings.ts +++ b/src/shared/tokenize-strings.ts @@ -1,4 +1,4 @@ -import type { TokenStream } from '../core/token'; +import type { TokenStream } from '../core/token.js'; /** * Given a token stream and a tokenization function, this will tokenize all diff --git a/src/types.d.ts b/src/types.d.ts index 09fb6f89b5..a65e122570 100644 --- a/src/types.d.ts +++ b/src/types.d.ts @@ -1,7 +1,7 @@ -import type { Prism } from './core/prism'; -import type { TokenStream } from './core/token'; +import type { Prism } from './core/prism.js'; +import type { TokenStream } from './core/token.js'; import type { KnownPlugins } from './known-plugins'; -import type { rest, tokenize } from './shared/symbols'; +import type { rest, tokenize } from './shared/symbols.js'; export interface GrammarOptions { readonly getLanguage: (id: string) => Grammar; diff --git a/tests/components-test.ts b/tests/components-test.ts index efa63e0367..7cbdb26df5 100644 --- a/tests/components-test.ts +++ b/tests/components-test.ts @@ -1,9 +1,11 @@ import { assert } from 'chai'; import { readFileSync } from 'fs'; import path from 'path'; -import { forEach, noop, toArray } from '../src/shared/util'; -import { getComponent, getComponentIds, getLanguageIds } from './helper/prism-loader'; +import { fileURLToPath } from 'url'; +import { forEach, noop, toArray } from '../src/shared/util.js'; +import { getComponent, getComponentIds, getLanguageIds } from './helper/prism-loader.js'; +const __dirname = path.dirname(fileURLToPath(import.meta.url)); describe('Components', () => { it('- should not have redundant optional dependencies', async function () { diff --git a/tests/core/greedy.ts b/tests/core/greedy.ts index e15c9438e9..091febbe8f 100644 --- a/tests/core/greedy.ts +++ b/tests/core/greedy.ts @@ -1,6 +1,6 @@ import { assert } from 'chai'; -import { Prism } from '../../src/core/prism'; -import { simplify } from '../helper/token-stream-transformer'; +import { Prism } from '../../src/core/prism.js'; +import { simplify } from '../helper/token-stream-transformer.js'; import type { Grammar } from '../../src/types'; function testTokens({ grammar, code, expected }: { grammar: Grammar, code: string, expected: unknown }) { diff --git a/tests/core/registry.ts b/tests/core/registry.ts index 131aec9c1c..f30ffc7ba2 100644 --- a/tests/core/registry.ts +++ b/tests/core/registry.ts @@ -1,5 +1,5 @@ import { assert } from 'chai'; -import { Prism } from '../../src/core/prism'; +import { Prism } from '../../src/core/prism.js'; describe('Registry', () => { it('should resolve aliases', () => { diff --git a/tests/coverage.ts b/tests/coverage.ts index e3ec4b612b..ee30757055 100644 --- a/tests/coverage.ts +++ b/tests/coverage.ts @@ -1,8 +1,8 @@ import { assert } from 'chai'; -import * as PrismLoader from './helper/prism-loader'; -import { runTestCase } from './helper/test-case'; -import { loadAllTests } from './helper/test-discovery'; -import { BFS, BFSPathToPrismTokenPath, isRegExp } from './helper/util'; +import * as PrismLoader from './helper/prism-loader.js'; +import { runTestCase } from './helper/test-case.js'; +import { loadAllTests } from './helper/test-discovery.js'; +import { BFS, BFSPathToPrismTokenPath, isRegExp } from './helper/util.js'; describe('Pattern test coverage', () => { interface PatternData { diff --git a/tests/examples-test.ts b/tests/examples-test.ts index 1d5a29aa4a..2dc95094b9 100644 --- a/tests/examples-test.ts +++ b/tests/examples-test.ts @@ -2,7 +2,10 @@ import { assert } from 'chai'; import { readFileSync, readdirSync } from 'fs'; import { Parser } from 'htmlparser2'; import path from 'path'; -import { getLanguageIds } from './helper/prism-loader'; +import { fileURLToPath } from 'url'; +import { getLanguageIds } from './helper/prism-loader.js'; + +const __dirname = path.dirname(fileURLToPath(import.meta.url)); const EXAMPLES_DIR = path.join(__dirname, '/../website/examples'); diff --git a/tests/helper/args.ts b/tests/helper/args.ts index 90a2388672..5f9f300001 100644 --- a/tests/helper/args.ts +++ b/tests/helper/args.ts @@ -1,4 +1,6 @@ -import { argv } from 'yargs'; +import yargs from 'yargs'; + +const { argv } = yargs; const args = argv as { language?: string | string[]; diff --git a/tests/helper/prism-dom-util.ts b/tests/helper/prism-dom-util.ts index 503d54a53e..5d355d743a 100644 --- a/tests/helper/prism-dom-util.ts +++ b/tests/helper/prism-dom-util.ts @@ -1,8 +1,8 @@ -import { createPrismDOM } from './prism-loader'; -import { assertEqual, useSnapshot } from './snapshot'; -import { formatHtml } from './util'; +import { createPrismDOM } from './prism-loader.js'; +import { assertEqual, useSnapshot } from './snapshot.js'; +import { formatHtml } from './util.js'; import type { KebabToCamelCase } from '../../src/types'; -import type { PrismDOM, PrismWindow } from './prism-loader'; +import type { PrismDOM, PrismWindow } from './prism-loader.js'; interface AssertOptions { language?: string; diff --git a/tests/helper/prism-loader.ts b/tests/helper/prism-loader.ts index 24b0775f0b..3ca100a18e 100644 --- a/tests/helper/prism-loader.ts +++ b/tests/helper/prism-loader.ts @@ -1,11 +1,13 @@ import { readdirSync } from 'fs'; import { JSDOM } from 'jsdom'; import path from 'path'; -import { Prism } from '../../src/core/prism'; -import { isNonNull, lazy, noop, toArray } from '../../src/shared/util'; +import { fileURLToPath } from 'url'; +import { Prism } from '../../src/core/prism.js'; +import { isNonNull, lazy, noop, toArray } from '../../src/shared/util.js'; import type { ComponentProto, LanguageProto, PluginProto } from '../../src/types'; import type { DOMWindow } from 'jsdom'; +const __dirname = path.dirname(fileURLToPath(import.meta.url)); const SRC_DIR = path.join(__dirname, '../../src'); export const getLanguageIds = lazy(() => { diff --git a/tests/helper/test-case.ts b/tests/helper/test-case.ts index 86eb44faab..2476512d65 100644 --- a/tests/helper/test-case.ts +++ b/tests/helper/test-case.ts @@ -1,10 +1,10 @@ import { assert } from 'chai'; import fs from 'fs'; -import { createInstance } from './prism-loader'; -import * as TokenStreamTransformer from './token-stream-transformer'; -import { formatHtml, getLeadingSpaces } from './util'; -import type { Prism } from '../../src/core'; -import type { TokenStream } from '../../src/core/token'; +import { createInstance } from './prism-loader.js'; +import * as TokenStreamTransformer from './token-stream-transformer.js'; +import { formatHtml, getLeadingSpaces } from './util.js'; +import type { Prism } from '../../src/core.js'; +import type { TokenStream } from '../../src/core/token.js'; const defaultCreateInstance = createInstance; diff --git a/tests/helper/test-discovery.ts b/tests/helper/test-discovery.ts index 68fbf3ed00..798ed46c40 100644 --- a/tests/helper/test-discovery.ts +++ b/tests/helper/test-discovery.ts @@ -1,6 +1,8 @@ import fs from 'fs'; import path from 'path'; +import { fileURLToPath } from 'url'; +const __dirname = path.dirname(fileURLToPath(import.meta.url)); const LANGUAGES_DIR = path.join(__dirname, '..', 'languages'); /** diff --git a/tests/helper/token-stream-transformer.ts b/tests/helper/token-stream-transformer.ts index ec34495c33..f97f0f966e 100644 --- a/tests/helper/token-stream-transformer.ts +++ b/tests/helper/token-stream-transformer.ts @@ -1,4 +1,4 @@ -import { getLeadingSpaces, getTrailingSpaces } from './util'; +import { getLeadingSpaces, getTrailingSpaces } from './util.js'; interface TokenStreamItem { type: string; diff --git a/tests/identifier-test.ts b/tests/identifier-test.ts index 237f221d6e..3a417af18f 100644 --- a/tests/identifier-test.ts +++ b/tests/identifier-test.ts @@ -1,9 +1,9 @@ import { assert } from 'chai'; -import { toArray } from '../src/shared/util'; -import { createInstance, getComponent, getLanguageIds } from './helper/prism-loader'; -import { prettyprint } from './helper/token-stream-transformer'; -import type { Prism, Token } from '../src/core'; -import type { TokenStream } from '../src/core/token'; +import { toArray } from '../src/shared/util.js'; +import { createInstance, getComponent, getLanguageIds } from './helper/prism-loader.js'; +import { prettyprint } from './helper/token-stream-transformer.js'; +import type { Prism, Token } from '../src/core.js'; +import type { TokenStream } from '../src/core/token.js'; // This is where you can exclude a language from the identifier test. diff --git a/tests/languages/antlr4/action_feature.test b/tests/languages/antlr4/action_feature.test index 4288ebb6d5..6a3c5465a3 100644 --- a/tests/languages/antlr4/action_feature.test +++ b/tests/languages/antlr4/action_feature.test @@ -3,7 +3,7 @@ options { superClass = LexerAdaptor; } @lexer::header { import { Token } from 'antlr4ts/Token'; import { CommonToken } from 'antlr4ts/CommonToken'; - import { Python3Parser } from './Python3Parser'; + import { Python3Parser } from './Python3Parser.js'; } END : 'end' {System.out.println("found an end");} ; diff --git a/tests/pattern-tests.ts b/tests/pattern-tests.ts index 4facdb9aab..3807c6d0aa 100644 --- a/tests/pattern-tests.ts +++ b/tests/pattern-tests.ts @@ -3,15 +3,15 @@ import { JS, NFA, Transformers, Words, combineTransformers, getIntersectionWordS import * as RAA from 'regexp-ast-analysis'; import { visitRegExpAST } from 'regexpp'; import * as scslre from 'scslre'; -import { lazy, toArray } from '../src/shared/util'; -import * as args from './helper/args'; -import { createInstance, getComponent, getLanguageIds } from './helper/prism-loader'; -import { TestCaseFile, parseLanguageNames } from './helper/test-case'; -import { loadAllTests } from './helper/test-discovery'; -import { BFS, BFSPathToPrismTokenPath, isRegExp, parseRegex } from './helper/util'; -import type { Prism } from '../src/core'; +import { lazy, toArray } from '../src/shared/util.js'; +import * as args from './helper/args.js'; +import { createInstance, getComponent, getLanguageIds } from './helper/prism-loader.js'; +import { TestCaseFile, parseLanguageNames } from './helper/test-case.js'; +import { loadAllTests } from './helper/test-discovery.js'; +import { BFS, BFSPathToPrismTokenPath, isRegExp, parseRegex } from './helper/util.js'; +import type { Prism } from '../src/core.js'; import type { Grammar, GrammarToken } from '../src/types'; -import type { LiteralAST, PathItem } from './helper/util'; +import type { LiteralAST, PathItem } from './helper/util.js'; import type { CapturingGroup, Element, Group, LookaroundAssertion, Node, Pattern } from 'regexpp/ast'; /** diff --git a/tests/plugins/autolinker/basic-functionality.ts b/tests/plugins/autolinker/basic-functionality.ts index d33f5312c2..bc87cf3bdb 100644 --- a/tests/plugins/autolinker/basic-functionality.ts +++ b/tests/plugins/autolinker/basic-functionality.ts @@ -1,4 +1,4 @@ -import { createTestSuite } from '../../helper/prism-dom-util'; +import { createTestSuite } from '../../helper/prism-dom-util.js'; describe('Autolinker', () => { const { it } = createTestSuite({ diff --git a/tests/plugins/copy-to-clipboard/basic-functionality.ts b/tests/plugins/copy-to-clipboard/basic-functionality.ts index 5e01af7a80..f57a5e2b8e 100644 --- a/tests/plugins/copy-to-clipboard/basic-functionality.ts +++ b/tests/plugins/copy-to-clipboard/basic-functionality.ts @@ -1,5 +1,5 @@ import { assert } from 'chai'; -import { createTestSuite } from '../../helper/prism-dom-util'; +import { createTestSuite } from '../../helper/prism-dom-util.js'; class DummyClipboard { diff --git a/tests/plugins/custom-class/basic-functionality.ts b/tests/plugins/custom-class/basic-functionality.ts index f18434d580..8bf4440391 100644 --- a/tests/plugins/custom-class/basic-functionality.ts +++ b/tests/plugins/custom-class/basic-functionality.ts @@ -1,4 +1,4 @@ -import { createTestSuite } from '../../helper/prism-dom-util'; +import { createTestSuite } from '../../helper/prism-dom-util.js'; describe('Custom class', () => { diff --git a/tests/plugins/data-uri-highlight/basic-functionality.ts b/tests/plugins/data-uri-highlight/basic-functionality.ts index 875784465c..73d84c2b64 100644 --- a/tests/plugins/data-uri-highlight/basic-functionality.ts +++ b/tests/plugins/data-uri-highlight/basic-functionality.ts @@ -1,4 +1,4 @@ -import { createTestSuite } from '../../helper/prism-dom-util'; +import { createTestSuite } from '../../helper/prism-dom-util.js'; describe('Data-URI Highlight', () => { diff --git a/tests/plugins/diff-highlight/basic-functionality.ts b/tests/plugins/diff-highlight/basic-functionality.ts index b2c194b7b5..b43c0418ab 100644 --- a/tests/plugins/diff-highlight/basic-functionality.ts +++ b/tests/plugins/diff-highlight/basic-functionality.ts @@ -1,4 +1,4 @@ -import { createTestSuite } from '../../helper/prism-dom-util'; +import { createTestSuite } from '../../helper/prism-dom-util.js'; const jsCode = ` @@ -4,6 +4,5 @@ diff --git a/tests/plugins/highlight-keywords/basic-functionality.ts b/tests/plugins/highlight-keywords/basic-functionality.ts index 382840fc90..0b27a9f566 100644 --- a/tests/plugins/highlight-keywords/basic-functionality.ts +++ b/tests/plugins/highlight-keywords/basic-functionality.ts @@ -1,4 +1,4 @@ -import { createTestSuite } from '../../helper/prism-dom-util'; +import { createTestSuite } from '../../helper/prism-dom-util.js'; describe('Highlight Keywords', () => { diff --git a/tests/plugins/keep-markup/test.ts b/tests/plugins/keep-markup/test.ts index d473985dd4..267b7cb2bc 100644 --- a/tests/plugins/keep-markup/test.ts +++ b/tests/plugins/keep-markup/test.ts @@ -1,6 +1,6 @@ import { assert } from 'chai'; -import { createTestSuite } from '../../helper/prism-dom-util'; -import type { PrismDOM } from '../../helper/prism-loader'; +import { createTestSuite } from '../../helper/prism-dom-util.js'; +import type { PrismDOM } from '../../helper/prism-loader.js'; describe('Keep Markup', () => { diff --git a/tests/plugins/line-highlight/basic-functionality.ts b/tests/plugins/line-highlight/basic-functionality.ts index bb69809fab..516131dcc6 100644 --- a/tests/plugins/line-highlight/basic-functionality.ts +++ b/tests/plugins/line-highlight/basic-functionality.ts @@ -1,4 +1,4 @@ -import { createTestSuite } from '../../helper/prism-dom-util'; +import { createTestSuite } from '../../helper/prism-dom-util.js'; // just a few lines of JS code, so we have something to highlight const exampleCode = String.raw`// foo diff --git a/tests/plugins/show-invisibles/basic-functionality.ts b/tests/plugins/show-invisibles/basic-functionality.ts index d835df7075..ec82b36a49 100644 --- a/tests/plugins/show-invisibles/basic-functionality.ts +++ b/tests/plugins/show-invisibles/basic-functionality.ts @@ -1,4 +1,4 @@ -import { createTestSuite } from '../../helper/prism-dom-util'; +import { createTestSuite } from '../../helper/prism-dom-util.js'; describe('Show Invisibles', () => { diff --git a/tests/plugins/show-language/basic-functionality.ts b/tests/plugins/show-language/basic-functionality.ts index 52fb1a4da8..f81e36c956 100644 --- a/tests/plugins/show-language/basic-functionality.ts +++ b/tests/plugins/show-language/basic-functionality.ts @@ -1,7 +1,7 @@ import { assert } from 'chai'; -import { knownTitles } from '../../../src/shared/meta/title-data'; -import { createTestSuite } from '../../helper/prism-dom-util'; -import type { PrismDOM } from '../../helper/prism-loader'; +import { knownTitles } from '../../../src/shared/meta/title-data.js'; +import { createTestSuite } from '../../helper/prism-dom-util.js'; +import type { PrismDOM } from '../../helper/prism-loader.js'; describe('Show language', () => { diff --git a/tests/plugins/unescaped-markup/basic-functionality.ts b/tests/plugins/unescaped-markup/basic-functionality.ts index ac0ba0def2..a13fabe91d 100644 --- a/tests/plugins/unescaped-markup/basic-functionality.ts +++ b/tests/plugins/unescaped-markup/basic-functionality.ts @@ -1,6 +1,6 @@ import { assert } from 'chai'; -import { createTestSuite } from '../../helper/prism-dom-util'; -import type { PrismDOM } from '../../helper/prism-loader'; +import { createTestSuite } from '../../helper/prism-dom-util.js'; +import type { PrismDOM } from '../../helper/prism-loader.js'; describe('Show language', () => { diff --git a/tests/plugins/wpd/basic-functionality.ts b/tests/plugins/wpd/basic-functionality.ts index be13d25188..1d2dab696b 100644 --- a/tests/plugins/wpd/basic-functionality.ts +++ b/tests/plugins/wpd/basic-functionality.ts @@ -1,4 +1,4 @@ -import { createTestSuite } from '../../helper/prism-dom-util'; +import { createTestSuite } from '../../helper/prism-dom-util.js'; describe('WPD', () => { diff --git a/tests/run.ts b/tests/run.ts index 0a60ae388f..55da15446f 100644 --- a/tests/run.ts +++ b/tests/run.ts @@ -1,7 +1,7 @@ import path from 'path'; -import { language, update } from './helper/args'; -import * as TestCase from './helper/test-case'; -import * as TestDiscovery from './helper/test-discovery'; +import { language, update } from './helper/args.js'; +import * as TestCase from './helper/test-case.js'; +import * as TestDiscovery from './helper/test-discovery.js'; const testSuite = language diff --git a/tests/testrunner-tests.ts b/tests/testrunner-tests.ts index 0c27aa519f..7363cf00b0 100644 --- a/tests/testrunner-tests.ts +++ b/tests/testrunner-tests.ts @@ -1,6 +1,6 @@ import { assert } from 'chai'; -import { parseLanguageNames } from './helper/test-case'; -import { simplify } from './helper/token-stream-transformer'; +import { parseLanguageNames } from './helper/test-case.js'; +import { simplify } from './helper/token-stream-transformer.js'; describe('The token stream transformer', () => { diff --git a/tests/tsconfig.json b/tests/tsconfig.json index a22ed79436..d5e22140df 100644 --- a/tests/tsconfig.json +++ b/tests/tsconfig.json @@ -1,78 +1,7 @@ { "extends": "../tsconfig.json", "compilerOptions": { - /* Visit https://aka.ms/tsconfig to read more about this file */ - - /* Projects */ - // "incremental": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */ - // "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */ - // "tsBuildInfoFile": "./.tsbuildinfo", /* Specify the path to .tsbuildinfo incremental compilation file. */ - // "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects. */ - // "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */ - // "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */ - - /* Language and Environment */ - "target": "ES2020", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */ - // "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */ - // "jsx": "preserve", /* Specify what JSX code is generated. */ - // "experimentalDecorators": true, /* Enable experimental support for TC39 stage 2 draft decorators. */ - // "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */ - // "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */ - // "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */ - // "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using 'jsx: react-jsx*'. */ - // "reactNamespace": "", /* Specify the object invoked for 'createElement'. This only applies when targeting 'react' JSX emit. */ - // "noLib": true, /* Disable including any library files, including the default lib.d.ts. */ - // "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */ - // "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */ - - /* Modules */ - "module": "commonjs", /* Specify what module code is generated. */ - // "rootDir": "./", /* Specify the root folder within your source files. */ - // "moduleResolution": "node", /* Specify how TypeScript looks up a file from a given module specifier. */ - // "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */ - // "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */ - // "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */ - // "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */ - // "types": [], /* Specify type package names to be included without being referenced in a source file. */ - // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */ - // "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */ - // "resolveJsonModule": true, /* Enable importing .json files. */ - // "noResolve": true, /* Disallow 'import's, 'require's or ''s from expanding the number of files TypeScript should add to a project. */ - - /* JavaScript Support */ - "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */ - "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */ - // "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */ - - /* Emit */ - // "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */ - // "declarationMap": true, /* Create sourcemaps for d.ts files. */ - // "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */ - // "sourceMap": true, /* Create source map files for emitted JavaScript files. */ - // "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */ - // "outDir": "./", /* Specify an output folder for all emitted files. */ - // "removeComments": true, /* Disable emitting comments. */ "noEmit": true, /* Disable emitting files from a compilation. */ - // "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */ - // "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types. */ - // "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */ - // "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */ - // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */ - // "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */ - // "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */ - // "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */ - // "newLine": "crlf", /* Set the newline character for emitting files. */ - // "stripInternal": true, /* Disable emitting declarations that have '@internal' in their JSDoc comments. */ - // "noEmitHelpers": true, /* Disable generating custom helper functions like '__extends' in compiled output. */ - // "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */ - // "preserveConstEnums": true, /* Disable erasing 'const enum' declarations in generated code. */ - // "declarationDir": "./", /* Specify the output directory for generated declaration files. */ - // "preserveValueImports": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */ - - /* Interop Constraints */ - // "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */ - // "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */ - "esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */ }, "include": ["./**/*"] } diff --git a/tsconfig.json b/tsconfig.json index 5d9eb85872..b211584cab 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -11,7 +11,7 @@ // "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */ /* Language and Environment */ - "target": "es2020", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */ + "target": "es2021", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */ // "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */ // "jsx": "preserve", /* Specify what JSX code is generated. */ // "experimentalDecorators": true, /* Enable experimental support for TC39 stage 2 draft decorators. */ @@ -25,35 +25,31 @@ // "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */ /* Modules */ - "module": "commonjs", /* Specify what module code is generated. */ + "module": "ESNext", /* Specify what module code is generated. */ // "rootDir": "./", /* Specify the root folder within your source files. */ - // "moduleResolution": "node", /* Specify how TypeScript looks up a file from a given module specifier. */ + "moduleResolution": "node", /* Specify how TypeScript looks up a file from a given module specifier. */ // "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */ // "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */ // "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */ // "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */ // "types": [], /* Specify type package names to be included without being referenced in a source file. */ - // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */ + "allowUmdGlobalAccess": false, /* Allow accessing UMD globals from modules. */ // "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */ // "resolveJsonModule": true, /* Enable importing .json files. */ // "noResolve": true, /* Disallow 'import's, 'require's or ''s from expanding the number of files TypeScript should add to a project. */ - /* JavaScript Support */ - "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */ - "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */ - // "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */ - /* Emit */ - // "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */ - // "declarationMap": true, /* Create sourcemaps for d.ts files. */ + "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */ + "declarationMap": true, /* Create sourcemaps for d.ts files. */ // "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */ - // "sourceMap": true, /* Create source map files for emitted JavaScript files. */ + "sourceMap": true, /* Create source map files for emitted JavaScript files. */ // "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */ - // "outDir": "./", /* Specify an output folder for all emitted files. */ + "outDir": "dist", /* Specify an output folder for all emitted files. */ // "removeComments": true, /* Disable emitting comments. */ - "noEmit": true, /* Disable emitting files from a compilation. */ + // "noEmit": true, /* Disable emitting files from a compilation. */ // "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */ - // "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types. */ + // "importsNotUsedAsValues": "error", /* Specify emit/checking behavior for imports that are only used for types. */ + "verbatimModuleSyntax": true, // "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */ // "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */ // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */ @@ -70,7 +66,7 @@ /* Interop Constraints */ // "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */ - // "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */ + "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */ "esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */ // "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */ "forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */