@staticbolt/core 1.0.0-beta.30 → 1.0.0-beta.32

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -21,7 +21,7 @@
21
21
  - [HTML Markdown Plugin](./src/plugins/html-markdown/README.md)
22
22
  - [HTML Inline Script Plugin](./src/plugins/html-inline-script/README.md)
23
23
  - [HTML Inline Style Plugin](./src/plugins/html-inline-style/README.md)
24
- - [HTML Inline SVG Plugin](./src/plugins/html-import/README.md)
24
+ - [HTML Inline SVG Plugin](./src/plugins/html-inline-svg/README.md)
25
25
  - [HTML Inline Text Plugin](./src/plugins/html-inline-text/README.md)
26
26
  - [HTML Bundle Script Plugin](./src/plugins/html-bundle-script/README.md)
27
27
  - [HTML Bundle Style Plugin](./src/plugins/html-bundle-style/README.md)
@@ -29,6 +29,7 @@
29
29
  - [HTML Build Time Script Plugin](./src/plugins/html-build-time-script/README.md)
30
30
  - [HTML Preload Plugin](./src/plugins/html-preload/README.md)
31
31
  - [HTML Merge Styles Plugin](./src/plugins/html-merge-styles/README.md)
32
+ - [HTML Env Only Plugin](./src/plugins/html-env-only/README.md)
32
33
 
33
34
  ### Scripts and Styles
34
35
 
package/lib/cli/index.mjs CHANGED
@@ -1,6 +1,8 @@
1
1
  #!/usr/bin/env node
2
- import { c as isAbsolute, d as join, r as Log, t as CONFIG_FILE_NAME, v as resolve } from "../common-DUFKS3lW.mjs";
3
- import { t as loadConfigFile } from "../load-config-D-FtbUws.mjs";
2
+ import { c as isAbsolute, d as join, r as Log, t as CONFIG_FILE_NAME, v as resolve } from "../common-D1QTZ8ra.mjs";
3
+ import { t as loadConfigFile } from "../load-config-CsbiJ01A.mjs";
4
+ import { createRequire } from "node:module";
5
+ import { existsSync } from "node:fs";
4
6
  import * as z from "zod";
5
7
  import { coerce, defineArguments, defineCLI, defineOptions, defineSubcommand } from "@staticbolt/args-parser";
6
8
 
@@ -29,6 +31,8 @@ helpCommand.onExecute((results) => {
29
31
 
30
32
  //#endregion
31
33
  //#region src/cli/cli.ts
34
+ /** The package's own manifest, which sits two levels up from both `src/cli` and `lib/cli`. */
35
+ const { version: packageVersion } = createRequire(import.meta.url)("../../package.json");
32
36
  var CliProgram = class CliProgram {
33
37
  program = defineCLI({
34
38
  cliName: "staticbolt",
@@ -76,7 +80,7 @@ var CliProgram = class CliProgram {
76
80
  return;
77
81
  }
78
82
  if (version) {
79
- console.log("v0.0.0");
83
+ console.log(`v${packageVersion}`);
80
84
  return;
81
85
  }
82
86
  console.error("No arguments provided. Use `staticbolt --help` for more information");
@@ -155,11 +159,7 @@ const cliArguments = process.argv.slice(2);
155
159
  const projectDirectory = resolve(takeOption(cliArguments, "cwd") ?? process.cwd());
156
160
  const configFile = takeOption(cliArguments, "config") ?? ".staticbolt.ts";
157
161
  const configPath = isAbsolute(configFile) ? configFile : join(projectDirectory, configFile);
158
- const [config, configError] = await loadConfigFile(configPath, projectDirectory);
159
- if (configError) {
160
- Log.error(`Failed to load config file at "${configPath}"`);
161
- throw configError;
162
- }
162
+ const config = await loadConfig();
163
163
  const results = (await CliProgram.init(config, configPath, projectDirectory)).run(cliArguments);
164
164
  if (results.error) {
165
165
  console.error(results.error.message);
@@ -182,6 +182,29 @@ function takeOption(cliArguments, name) {
182
182
  }
183
183
  return value;
184
184
  }
185
+ /** The project's config. Without a config file only the root options are served, so `--help` and `--version` still answer. */
186
+ async function loadConfig() {
187
+ if (!existsSync(configPath)) {
188
+ if (cliArguments.some((argument) => [
189
+ "--help",
190
+ "-h",
191
+ "--version",
192
+ "-v"
193
+ ].includes(argument))) return { root: projectDirectory };
194
+ Log.error(`No config file at "${configPath}". Create one, or point at it with --cwd or --config.`);
195
+ process.exit(1);
196
+ }
197
+ const [config, configError] = await loadConfigFile(configPath, projectDirectory);
198
+ if (configError) {
199
+ Log.error(`Failed to load the config file at "${configPath}":`);
200
+ console.error(isCompileError(configError) ? configError.message : configError);
201
+ process.exit(1);
202
+ }
203
+ return config;
204
+ }
205
+ function isCompileError(error) {
206
+ return "errors" in error || error.cause instanceof Error && "errors" in error.cause;
207
+ }
185
208
 
186
209
  //#endregion
187
210
  export { };
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":["#programWideType"],"sources":["../../src/cli/commands/help.ts","../../src/cli/cli.ts","../../src/cli/index.ts"],"sourcesContent":["import { defineSubcommand } from \"@staticbolt/args-parser\";\nimport * as z from \"zod\";\n\nexport const helpCommand = defineSubcommand({\n name: \"help\",\n meta: {\n placeholder: \"<command>\",\n description: \"Print help message for a specific command.\",\n example: \"staticbolt help build\",\n },\n\n arguments: {\n command: {\n schema: z.string().optional(),\n meta: {\n description: \"The command to get help for.\",\n },\n },\n },\n});\n\nhelpCommand.onExecute(results => {\n const { command } = results.arguments;\n\n if (!helpCommand.generateCliHelpMessage || !helpCommand.generateSubcommandHelpMessage) {\n throw new Error(\"internal error: missing help functions\");\n }\n\n if (command) {\n console.log(helpCommand.generateSubcommandHelpMessage(command));\n return;\n }\n\n console.log(helpCommand.generateCliHelpMessage());\n});\n","import { coerce, defineArguments, defineCLI, defineOptions, defineSubcommand } from \"@staticbolt/args-parser\";\nimport * as z from \"zod\";\n\nimport { CONFIG_FILE_NAME } from \"../types/common.ts\";\nimport { Log } from \"../utilities/logger.ts\";\nimport { helpCommand } from \"./commands/help.ts\";\n\nimport type { Argument, Cli, Option, Subcommand } from \"@staticbolt/args-parser\";\nimport type { AppConfig } from \"@staticbolt/core\";\n\nexport class CliProgram {\n program = defineCLI({\n cliName: \"staticbolt\",\n meta: {\n description: \"Build fast static websites.\",\n example: \"staticbolt build \\nstaticbolt serve\",\n },\n\n options: {\n cwd: {\n schema: z.string().optional(),\n meta: {\n placeholder: \"<directory>\",\n description: \"The directory to run in. Works with every command.\",\n },\n },\n config: {\n schema: z.string().optional(),\n meta: {\n placeholder: \"<path>\",\n description: `The config file, relative to the directory. Works with every command. Defaults to \"${CONFIG_FILE_NAME}\".`,\n },\n },\n help: {\n aliases: [\"h\"],\n schema: z.boolean().optional(),\n coerce: coerce.boolean,\n meta: {\n description: \"Show this help message.\",\n },\n },\n version: {\n aliases: [\"v\"],\n schema: z.boolean().optional(),\n coerce: coerce.boolean,\n meta: {\n description: \"Show current version.\",\n },\n },\n },\n });\n\n #programWideType: Cli = this.program;\n\n constructor() {\n this.addCommand(helpCommand);\n\n this.program.onExecute(results => {\n const { help, version } = results.options;\n\n if (help) {\n if (!this.program.generateCliHelpMessage) throw new Error(\"internal error: missing help functions\");\n console.log(this.program.generateCliHelpMessage());\n return;\n }\n\n if (version) {\n console.log(\"v0.0.0\");\n return;\n }\n\n console.error(\"No arguments provided. Use `staticbolt --help` for more information\");\n });\n }\n\n async initializePlugins(config: AppConfig, configPath: string, projectDirectory: string) {\n const plugins = config.plugins ?? [];\n\n for (const pluginOrPlugins of plugins) {\n const pluginsAsArray = Array.isArray(pluginOrPlugins) ? pluginOrPlugins : [pluginOrPlugins];\n\n for (const plugin of pluginsAsArray) {\n if (plugin.cli) {\n await plugin.cli.call(this, config, configPath, projectDirectory);\n }\n }\n }\n }\n\n static async init(config: AppConfig, configPath: string, projectDirectory: string) {\n const cliProgram = new CliProgram();\n await cliProgram.initializePlugins(config, configPath, projectDirectory);\n return cliProgram;\n }\n\n run(cliArguments: string[]) {\n return this.program.run(cliArguments);\n }\n\n readonly defineSubcommand = defineSubcommand;\n readonly defineOptions = defineOptions;\n readonly defineArguments = defineArguments;\n readonly coerce = coerce;\n\n addCommand(newSubcommand: Subcommand) {\n if (!this.#programWideType.subcommands) {\n this.#programWideType.subcommands = [newSubcommand];\n return;\n }\n\n this.#programWideType.subcommands.push(newSubcommand);\n\n return this.#programWideType.subcommands.length;\n }\n\n addOptions(newOptions: Record<string, Option>) {\n if (!this.#programWideType.options) {\n this.#programWideType.options = newOptions;\n return;\n }\n\n return Object.assign(this.#programWideType.options, newOptions);\n }\n\n addArguments(newArguments: Record<string, Argument>) {\n if (!this.#programWideType.arguments) {\n this.#programWideType.arguments = newArguments;\n return;\n }\n\n return Object.assign(this.#programWideType.arguments, newArguments);\n }\n\n addOptionsToCommand(commandName: string, newOptions: Record<string, Option>) {\n const command = this.#programWideType.subcommands?.find(command => command.name === commandName);\n if (!command) {\n Log.error(`Command \"${commandName}\" not found`);\n return;\n }\n\n if (!command.options) {\n command.options = newOptions;\n return;\n }\n\n return Object.assign(command.options, newOptions);\n }\n\n addArgumentsToCommand(commandName: string, newArguments: Record<string, Argument>) {\n const command = this.#programWideType.subcommands?.find(command => command.name === commandName);\n if (!command) {\n Log.error(`Command \"${commandName}\" not found`);\n return;\n }\n\n if (!command.arguments) {\n command.arguments = newArguments;\n return;\n }\n\n return Object.assign(command.arguments, newArguments);\n }\n}\n","#!/usr/bin/env node\nimport { loadConfigFile } from \"../helpers/load-config.ts\";\nimport { CONFIG_FILE_NAME } from \"../types/common.ts\";\nimport { Log } from \"../utilities/logger.ts\";\nimport { isAbsolute, join, resolve } from \"../utilities/path.ts\";\nimport { CliProgram } from \"./cli.ts\";\n\nconst cliArguments = process.argv.slice(2);\n\nconst projectDirectory = resolve(takeOption(cliArguments, \"cwd\") ?? process.cwd());\nconst configFile = takeOption(cliArguments, \"config\") ?? CONFIG_FILE_NAME;\nconst configPath = isAbsolute(configFile) ? configFile : join(projectDirectory, configFile);\n\nconst [config, configError] = await loadConfigFile(configPath, projectDirectory);\nif (configError) {\n Log.error(`Failed to load config file at \"${configPath}\"`);\n throw configError;\n}\n\nconst cli = await CliProgram.init(config, configPath, projectDirectory);\nconst results = cli.run(cliArguments);\n\nif (results.error) {\n console.error(results.error.message);\n console.log(\"\\n`staticbolt --help` for more information, or `staticbolt help <command>` for command-specific help\\n\");\n process.exit(1);\n}\n\n/** Removes every `--name value` or `--name=value` from the arguments and returns the last value. */\nfunction takeOption(cliArguments: string[], name: string): string | undefined {\n const flag = `--${name}`;\n const findFlag = () => cliArguments.findIndex(argument => argument === flag || argument.startsWith(`${flag}=`));\n let value: string | undefined;\n\n for (let index = findFlag(); index !== -1; index = findFlag()) {\n const isInlineValue = cliArguments[index] !== flag;\n value = isInlineValue ? cliArguments[index].slice(flag.length + 1) : cliArguments[index + 1];\n\n if (!value || (!isInlineValue && value.startsWith(\"-\"))) {\n console.error(`Option ${flag} requires a value`);\n process.exit(1);\n }\n\n cliArguments.splice(index, isInlineValue ? 1 : 2);\n }\n\n return value;\n}\n"],"mappings":";;;;;;;AAGA,MAAa,cAAc,iBAAiB;CAC1C,MAAM;CACN,MAAM;EACJ,aAAa;EACb,aAAa;EACb,SAAS;CACX;CAEA,WAAW,EACT,SAAS;EACP,QAAQ,EAAE,OAAO,CAAC,CAAC,SAAS;EAC5B,MAAM,EACJ,aAAa,+BACf;CACF,EACF;AACF,CAAC;AAED,YAAY,WAAU,YAAW;CAC/B,MAAM,EAAE,YAAY,QAAQ;CAE5B,IAAI,CAAC,YAAY,0BAA0B,CAAC,YAAY,+BACtD,MAAM,IAAI,MAAM,wCAAwC;CAG1D,IAAI,SAAS;EACX,QAAQ,IAAI,YAAY,8BAA8B,OAAO,CAAC;EAC9D;CACF;CAEA,QAAQ,IAAI,YAAY,uBAAuB,CAAC;AAClD,CAAC;;;;ACxBD,IAAa,aAAb,MAAa,WAAW;CACtB,UAAU,UAAU;EAClB,SAAS;EACT,MAAM;GACJ,aAAa;GACb,SAAS;EACX;EAEA,SAAS;GACP,KAAK;IACH,QAAQ,EAAE,OAAO,CAAC,CAAC,SAAS;IAC5B,MAAM;KACJ,aAAa;KACb,aAAa;IACf;GACF;GACA,QAAQ;IACN,QAAQ,EAAE,OAAO,CAAC,CAAC,SAAS;IAC5B,MAAM;KACJ,aAAa;KACb,aAAa,sFAAsF,iBAAiB;IACtH;GACF;GACA,MAAM;IACJ,SAAS,CAAC,GAAG;IACb,QAAQ,EAAE,QAAQ,CAAC,CAAC,SAAS;IAC7B,QAAQ,OAAO;IACf,MAAM,EACJ,aAAa,0BACf;GACF;GACA,SAAS;IACP,SAAS,CAAC,GAAG;IACb,QAAQ,EAAE,QAAQ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MAAM,WAAU,MADE,WAAW,KAAK,QAAQ,YAAY,gBAAgB,EACnD,CAAC,IAAI,YAAY;AAEpC,IAAI,QAAQ,OAAO;CACjB,QAAQ,MAAM,QAAQ,MAAM,OAAO;CACnC,QAAQ,IAAI,wGAAwG;CACpH,QAAQ,KAAK,CAAC;AAChB;;AAGA,SAAS,WAAW,cAAwB,MAAkC;CAC5E,MAAM,OAAO,KAAK;CAClB,MAAM,iBAAiB,aAAa,WAAU,aAAY,aAAa,QAAQ,SAAS,WAAW,GAAG,KAAK,EAAE,CAAC;CAC9G,IAAI;CAEJ,KAAK,IAAI,QAAQ,SAAS,GAAG,UAAU,IAAI,QAAQ,SAAS,GAAG;EAC7D,MAAM,gBAAgB,aAAa,WAAW;EAC9C,QAAQ,gBAAgB,aAAa,MAAM,CAAC,MAAM,KAAK,SAAS,CAAC,IAAI,aAAa,QAAQ;EAE1F,IAAI,CAAC,SAAU,CAAC,iBAAiB,MAAM,WAAW,GAAG,GAAI;GACvD,QAAQ,MAAM,UAAU,KAAK,kBAAkB;GAC/C,QAAQ,KAAK,CAAC;EAChB;EAEA,aAAa,OAAO,OAAO,gBAAgB,IAAI,CAAC;CAClD;CAEA,OAAO;AACT"}
1
+ {"version":3,"file":"index.mjs","names":["#programWideType"],"sources":["../../src/cli/commands/help.ts","../../src/cli/cli.ts","../../src/cli/index.ts"],"sourcesContent":["import { defineSubcommand } from \"@staticbolt/args-parser\";\nimport * as z from \"zod\";\n\nexport const helpCommand = defineSubcommand({\n name: \"help\",\n meta: {\n placeholder: \"<command>\",\n description: \"Print help message for a specific command.\",\n example: \"staticbolt help build\",\n },\n\n arguments: {\n command: {\n schema: z.string().optional(),\n meta: {\n description: \"The command to get help for.\",\n },\n },\n },\n});\n\nhelpCommand.onExecute(results => {\n const { command } = results.arguments;\n\n if (!helpCommand.generateCliHelpMessage || !helpCommand.generateSubcommandHelpMessage) {\n throw new Error(\"internal error: missing help functions\");\n }\n\n if (command) {\n console.log(helpCommand.generateSubcommandHelpMessage(command));\n return;\n }\n\n console.log(helpCommand.generateCliHelpMessage());\n});\n","import { createRequire } from \"node:module\";\nimport { coerce, defineArguments, defineCLI, defineOptions, defineSubcommand } from \"@staticbolt/args-parser\";\nimport * as z from \"zod\";\n\nimport { CONFIG_FILE_NAME } from \"../types/common.ts\";\nimport { Log } from \"../utilities/logger.ts\";\nimport { helpCommand } from \"./commands/help.ts\";\n\nimport type { Argument, Cli, Option, Subcommand } from \"@staticbolt/args-parser\";\nimport type { AppConfig } from \"@staticbolt/core\";\n\n/** The package's own manifest, which sits two levels up from both `src/cli` and `lib/cli`. */\nconst { version: packageVersion } = createRequire(import.meta.url)(\"../../package.json\") as { version: string };\n\nexport class CliProgram {\n program = defineCLI({\n cliName: \"staticbolt\",\n meta: {\n description: \"Build fast static websites.\",\n example: \"staticbolt build \\nstaticbolt serve\",\n },\n\n options: {\n cwd: {\n schema: z.string().optional(),\n meta: {\n placeholder: \"<directory>\",\n description: \"The directory to run in. Works with every command.\",\n },\n },\n config: {\n schema: z.string().optional(),\n meta: {\n placeholder: \"<path>\",\n description: `The config file, relative to the directory. Works with every command. Defaults to \"${CONFIG_FILE_NAME}\".`,\n },\n },\n help: {\n aliases: [\"h\"],\n schema: z.boolean().optional(),\n coerce: coerce.boolean,\n meta: {\n description: \"Show this help message.\",\n },\n },\n version: {\n aliases: [\"v\"],\n schema: z.boolean().optional(),\n coerce: coerce.boolean,\n meta: {\n description: \"Show current version.\",\n },\n },\n },\n });\n\n #programWideType: Cli = this.program;\n\n constructor() {\n this.addCommand(helpCommand);\n\n this.program.onExecute(results => {\n const { help, version } = results.options;\n\n if (help) {\n if (!this.program.generateCliHelpMessage) throw new Error(\"internal error: missing help functions\");\n console.log(this.program.generateCliHelpMessage());\n return;\n }\n\n if (version) {\n console.log(`v${packageVersion}`);\n return;\n }\n\n console.error(\"No arguments provided. Use `staticbolt --help` for more information\");\n });\n }\n\n async initializePlugins(config: AppConfig, configPath: string, projectDirectory: string) {\n const plugins = config.plugins ?? [];\n\n for (const pluginOrPlugins of plugins) {\n const pluginsAsArray = Array.isArray(pluginOrPlugins) ? pluginOrPlugins : [pluginOrPlugins];\n\n for (const plugin of pluginsAsArray) {\n if (plugin.cli) {\n await plugin.cli.call(this, config, configPath, projectDirectory);\n }\n }\n }\n }\n\n static async init(config: AppConfig, configPath: string, projectDirectory: string) {\n const cliProgram = new CliProgram();\n await cliProgram.initializePlugins(config, configPath, projectDirectory);\n return cliProgram;\n }\n\n run(cliArguments: string[]) {\n return this.program.run(cliArguments);\n }\n\n readonly defineSubcommand = defineSubcommand;\n readonly defineOptions = defineOptions;\n readonly defineArguments = defineArguments;\n readonly coerce = coerce;\n\n addCommand(newSubcommand: Subcommand) {\n if (!this.#programWideType.subcommands) {\n this.#programWideType.subcommands = [newSubcommand];\n return;\n }\n\n this.#programWideType.subcommands.push(newSubcommand);\n\n return this.#programWideType.subcommands.length;\n }\n\n addOptions(newOptions: Record<string, Option>) {\n if (!this.#programWideType.options) {\n this.#programWideType.options = newOptions;\n return;\n }\n\n return Object.assign(this.#programWideType.options, newOptions);\n }\n\n addArguments(newArguments: Record<string, Argument>) {\n if (!this.#programWideType.arguments) {\n this.#programWideType.arguments = newArguments;\n return;\n }\n\n return Object.assign(this.#programWideType.arguments, newArguments);\n }\n\n addOptionsToCommand(commandName: string, newOptions: Record<string, Option>) {\n const command = this.#programWideType.subcommands?.find(command => command.name === commandName);\n if (!command) {\n Log.error(`Command \"${commandName}\" not found`);\n return;\n }\n\n if (!command.options) {\n command.options = newOptions;\n return;\n }\n\n return Object.assign(command.options, newOptions);\n }\n\n addArgumentsToCommand(commandName: string, newArguments: Record<string, Argument>) {\n const command = this.#programWideType.subcommands?.find(command => command.name === commandName);\n if (!command) {\n Log.error(`Command \"${commandName}\" not found`);\n return;\n }\n\n if (!command.arguments) {\n command.arguments = newArguments;\n return;\n }\n\n return Object.assign(command.arguments, newArguments);\n }\n}\n","#!/usr/bin/env node\nimport { existsSync } from \"node:fs\";\n\nimport { loadConfigFile } from \"../helpers/load-config.ts\";\nimport { CONFIG_FILE_NAME } from \"../types/common.ts\";\nimport { Log } from \"../utilities/logger.ts\";\nimport { isAbsolute, join, resolve } from \"../utilities/path.ts\";\nimport { CliProgram } from \"./cli.ts\";\n\nimport type { AppConfig } from \"@staticbolt/core\";\n\nconst cliArguments = process.argv.slice(2);\n\nconst projectDirectory = resolve(takeOption(cliArguments, \"cwd\") ?? process.cwd());\nconst configFile = takeOption(cliArguments, \"config\") ?? CONFIG_FILE_NAME;\nconst configPath = isAbsolute(configFile) ? configFile : join(projectDirectory, configFile);\nconst config = await loadConfig();\n\nconst cli = await CliProgram.init(config, configPath, projectDirectory);\nconst results = cli.run(cliArguments);\n\nif (results.error) {\n console.error(results.error.message);\n console.log(\"\\n`staticbolt --help` for more information, or `staticbolt help <command>` for command-specific help\\n\");\n process.exit(1);\n}\n\n/** Removes every `--name value` or `--name=value` from the arguments and returns the last value. */\nfunction takeOption(cliArguments: string[], name: string): string | undefined {\n const flag = `--${name}`;\n const findFlag = () => cliArguments.findIndex(argument => argument === flag || argument.startsWith(`${flag}=`));\n let value: string | undefined;\n\n for (let index = findFlag(); index !== -1; index = findFlag()) {\n const isInlineValue = cliArguments[index] !== flag;\n value = isInlineValue ? cliArguments[index].slice(flag.length + 1) : cliArguments[index + 1];\n\n if (!value || (!isInlineValue && value.startsWith(\"-\"))) {\n console.error(`Option ${flag} requires a value`);\n process.exit(1);\n }\n\n cliArguments.splice(index, isInlineValue ? 1 : 2);\n }\n\n return value;\n}\n\n/** The project's config. Without a config file only the root options are served, so `--help` and `--version` still answer. */\nasync function loadConfig(): Promise<AppConfig> {\n if (!existsSync(configPath)) {\n const isAskingAbout = cliArguments.some(argument => [\"--help\", \"-h\", \"--version\", \"-v\"].includes(argument));\n if (isAskingAbout) return { root: projectDirectory };\n\n Log.error(`No config file at \"${configPath}\". Create one, or point at it with --cwd or --config.`);\n process.exit(1);\n }\n\n const [config, configError] = await loadConfigFile(configPath, projectDirectory);\n if (configError) {\n Log.error(`Failed to load the config file at \"${configPath}\":`);\n // A compile error already says where it is; a stack would only point into esbuild\n console.error(isCompileError(configError) ? configError.message : configError);\n process.exit(1);\n }\n\n return config;\n}\n\nfunction isCompileError(error: Error): boolean {\n return \"errors\" in error || (error.cause instanceof Error && \"errors\" in error.cause);\n}\n"],"mappings":";;;;;;;;;AAGA,MAAa,cAAc,iBAAiB;CAC1C,MAAM;CACN,MAAM;EACJ,aAAa;EACb,aAAa;EACb,SAAS;CACX;CAEA,WAAW,EACT,SAAS;EACP,QAAQ,EAAE,OAAO,CAAC,CAAC,SAAS;EAC5B,MAAM,EACJ,aAAa,+BACf;CACF,EACF;AACF,CAAC;AAED,YAAY,WAAU,YAAW;CAC/B,MAAM,EAAE,YAAY,QAAQ;CAE5B,IAAI,CAAC,YAAY,0BAA0B,CAAC,YAAY,+BACtD,MAAM,IAAI,MAAM,wCAAwC;CAG1D,IAAI,SAAS;EACX,QAAQ,IAAI,YAAY,8BAA8B,OAAO,CAAC;EAC9D;CACF;CAEA,QAAQ,IAAI,YAAY,uBAAuB,CAAC;AAClD,CAAC;;;;;ACtBD,MAAM,EAAE,SAAS,mBAAmB,cAAc,YAAY,GAAG,CAAC,CAAC,oBAAoB;AAEvF,IAAa,aAAb,MAAa,WAAW;CACtB,UAAU,UAAU;EAClB,SAAS;EACT,MAAM;GACJ,aAAa;GACb,SAAS;EACX;EAEA,SAAS;GACP,KAAK;IACH,QAAQ,EAAE,OAAO,CAAC,CAAC,SAAS;IAC5B,MAAM;KACJ,aAAa;KACb,aAAa;IACf;GACF;GACA,QAAQ;IACN,QAAQ,EAAE,OAAO,CAAC,CAAC,SAAS;IAC5B,MAAM;KACJ,aAAa;KACb,aAAa,sFAAsF,iBAAiB;IACtH;GACF;GACA,MAAM;IACJ,SAAS,CAAC,GAAG;IACb,QAAQ,EAAE,QAAQ,CAAC,CAAC,SAAS;IAC7B,QAAQ,OAAO;IACf,MAAM,EACJ,aAAa,0BACf;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O,YAAY,SAAU,MAAM,iBAAiB,SAAS,YAAY,MAAM;AACjF"}
@@ -218,7 +218,7 @@ function logFormatter(title, style, ...messages) {
218
218
  if (index > 0) {
219
219
  const width = logConfig.titleWidth / logConfig.spacer.length;
220
220
  const spacer = logConfig.spacer.repeat(width).padEnd(logConfig.titleWidth);
221
- message += "\n" + style.dim(spacer + "");
221
+ message += "\n" + style.dim(spacer + " ");
222
222
  }
223
223
  message += splitByNewline;
224
224
  }
@@ -246,4 +246,4 @@ const CONFIG_FILE_NAME = ".staticbolt.ts";
246
246
 
247
247
  //#endregion
248
248
  export { replaceExtension as _, basename as a, isAbsolute as c, join as d, normalize as f, relative as g, path_exports as h, createLog as i, isPathMatch as l, parsePatterns as m, CUSTOM_ATTRIBUTES as n, dirname as o, parse as p, Log as r, extname as s, CONFIG_FILE_NAME as t, isSubpath as u, resolve as v };
249
- //# sourceMappingURL=common-DUFKS3lW.mjs.map
249
+ //# sourceMappingURL=common-D1QTZ8ra.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"common-DUFKS3lW.mjs","names":[],"sources":["../src/utilities/path.ts","../src/utilities/logger.ts","../src/types/common.ts"],"sourcesContent":["import nodePath from \"node:path\";\nimport micromatch from \"micromatch\";\n\nexport { basename, extname, isAbsolute, parse, resolve } from \"node:path\";\n\n// For ESM and CSS compatibility:\n// - Always use unix separators (except `resolve`, which returns an absolute path)\n// - Relative paths should always start with `./`\n\nconst separatorRe = /\\\\/g;\n\n/** Normalizes a path result to unix separators and ensures relative paths start with `./` */\nfunction unixify(path: string): string {\n const unix = path.includes(\"\\\\\") ? path.replace(separatorRe, \"/\") : path;\n\n // Example: dirname(\"index.html\") => \".\"\n if (unix === \".\") {\n return \"./\";\n }\n\n if (unix === \"/\" || nodePath.isAbsolute(unix)) {\n return unix;\n }\n\n if (unix.startsWith(\"./\") || unix.startsWith(\"../\")) {\n return unix;\n }\n\n return `./${unix}`;\n}\n\nexport const join = (...arguments_: string[]) => unixify(nodePath.join(...arguments_));\n\n/** `relative` is pure and called with highly repetitive inputs on hot paths, so cache results. */\nconst relativeCache = new Map<string, string>();\n\nexport const relative = (from: string, to: string) => {\n const key = from + \"\\u{0}\" + to;\n\n let result = relativeCache.get(key);\n if (result === undefined) {\n result = unixify(nodePath.relative(from, to));\n relativeCache.set(key, result);\n }\n\n return result;\n};\n\nexport const dirname = (path: string) => unixify(nodePath.dirname(path));\n\nexport const normalize = (path: string) => unixify(nodePath.normalize(path));\n\n/**\n * Recalculates the relative path for a resource after a file has been moved.\n *\n * @param source - The source found in the `oldPath` file.\n * @param oldPath - Absolute or relative original path of the file.\n * @param newPath - Absolute or relative new path of the file.\n * @returns The updated relative path from the new file's directory to the same resource.\n */\nexport function rebaseRelativePath(source: string, oldPath: string, newPath: string): string {\n return relative(dirname(newPath), join(dirname(oldPath), source));\n}\n\n/**\n * Checks if a path (child) is a subpath of another (parent).\n *\n * Note: both paths must be of the same type — either both absolute or both relative. Mixing them will produce incorrect results.\n *\n * @param parentDirectory - The parent directory.\n * @param childPath - The child path (file or directory).\n */\nexport function isSubpath(parentDirectory: string, childPath: string): boolean {\n if (childPath === \"./\") return false;\n const relativePath = relative(normalize(parentDirectory), normalize(childPath));\n return relativePath === \"\" || (!relativePath.startsWith(\"..\") && !nodePath.isAbsolute(relativePath));\n}\n\ninterface SourceRelativeToRootOptions {\n /** The root directory (absolute or resolvable) */\n root: string;\n /** The file path that contains the source path */\n filePath: string;\n /** The source path */\n sourcePath: string;\n}\n\n/** Calculates the relative path of a source path to the root. */\nexport function sourceRelativeToRoot({ root, filePath, sourcePath }: SourceRelativeToRootOptions): string {\n const absRoot = nodePath.resolve(root);\n return relative(absRoot, nodePath.join(absRoot, dirname(filePath), sourcePath));\n}\n\n/** Replaces the extension of a given path. */\nexport function replaceExtension(filePath: string, extension: string): string {\n const { dir, name } = nodePath.parse(filePath);\n return normalize(nodePath.format({ dir, name, ext: extension }));\n}\n\n/** Appends a forward slash to the end of a path if it doesn't already end with one. */\nexport const appendForwardSlash = (path: string) => (path.endsWith(\"/\") ? path : `${path}/`);\n\n/** Removes the leading `./` from a path. */\nexport const trimDotPrefix = (path: string) => (path.startsWith(\"./\") ? path.slice(2) : path);\n\n/** Returns the first segment of a path. */\nexport function firstPart(path: string): string {\n const cleaned = normalize(path).replace(/\\/$/, \"\");\n return cleaned.split(\"/\", 1)[0] ?? \"\";\n}\n\n/**\n * Splits a semicolon-separated attribute value into an array of trimmed glob patterns.\n *\n * Returns `undefined` when the input is not a string, and an empty array for an empty string.\n */\nexport function parsePatterns(string: string | null | undefined): string[] | undefined {\n if (typeof string !== \"string\") return;\n\n if (!string) return [];\n\n return string.split(\";\").flatMap(pattern => {\n const trimmed = pattern.trim();\n return trimmed ? [trimmed] : [];\n });\n}\n\ninterface MatchPathOptions {\n include: string | string[];\n ignore?: string | string[];\n root: string;\n}\n\nconst matcherCache = new Map<string, (path: string) => boolean>();\n\n/** `micromatch.isMatch` compiles its patterns on every call; cache the compiled matcher per patterns+options instead. */\nfunction getMatcher(include: string | string[], ignore: string | string[] | undefined, cwd: string | undefined) {\n const key = JSON.stringify([include, ignore, cwd]);\n\n let matcher = matcherCache.get(key);\n if (!matcher) {\n // The underlying picomatch accepts `string | string[]` patterns, the micromatch typings are just too narrow\n matcher = micromatch.matcher(include as string, cwd === undefined ? { ignore } : { cwd, ignore });\n matcherCache.set(key, matcher);\n }\n\n return matcher;\n}\n\n/** Checks if a file path matches a set of patterns. */\nexport function isPathMatch(filePath: string, { include, ignore, root }: MatchPathOptions): boolean {\n // Case: outside the root directory\n if (filePath.startsWith(\"..\")) {\n return getMatcher(include, ignore, undefined)(join(root, filePath));\n }\n\n // Case: inside the root dir\n const withoutDotPrefix = filePath.replace(/^\\.\\//, \"\");\n return getMatcher(include, ignore, root)(withoutDotPrefix);\n}\n","import chalk from \"chalk\";\n\ntype ChalkInstance = typeof chalk;\n\nconst logConfig = {\n verboseEnabled: false,\n verboseFilter: null as null | RegExp,\n titleWidth: 10,\n spacer: \" \",\n style: {\n success: chalk.green,\n error: chalk.red,\n fatal: chalk.red,\n warning: chalk.yellow,\n verbose: chalk.dim,\n info: chalk.blueBright,\n tip: chalk.magenta,\n log: chalk.white,\n spacer: chalk.dim,\n },\n};\n\nexport function createLog(...defaultMessages: string[]) {\n function Log(...messages: unknown[]) {\n console.log(formatLogTitle(\"LOG\", logConfig.style.log), ...defaultMessages, ...messages);\n }\n\n Log.warn = (...messages: string[]) => {\n logFormatter(\"WARNING\", logConfig.style.warning, ...defaultMessages, ...messages);\n };\n\n Log.success = (...messages: string[]) => {\n logFormatter(\"SUCCESS\", logConfig.style.success, ...defaultMessages, ...messages);\n };\n\n Log.error = (...messages: string[]) => {\n logFormatter(\"ERROR\", logConfig.style.error, ...defaultMessages, ...messages);\n };\n\n Log.fatal = (...messages: string[]) => {\n logFormatter(\"FATAL\", logConfig.style.fatal, ...defaultMessages, ...messages);\n\n // eslint-disable-next-line unicorn/no-process-exit\n process.exit(1);\n };\n\n Log.info = (...messages: string[]) => {\n logFormatter(\"INFO\", logConfig.style.info, ...defaultMessages, ...messages);\n };\n\n Log.tip = (...messages: string[]) => {\n logFormatter(\"TIP\", logConfig.style.tip, ...defaultMessages, ...messages);\n };\n\n Log.debug = (...messages: string[]) => {\n if (!logConfig.verboseEnabled) return;\n\n const joined = defaultMessages.concat(messages).join(\" \");\n if (logConfig.verboseFilter && !logConfig.verboseFilter.test(joined)) return;\n\n logFormatter(\"DEBUG\", logConfig.style.verbose, joined);\n };\n\n Log.enableVerbose = (isEnabled: boolean) => {\n logConfig.verboseEnabled = isEnabled;\n };\n\n Log.setVerboseFilter = (filter: RegExp) => {\n logConfig.verboseFilter = filter;\n };\n\n return Log;\n}\n\n/**\n * - Prints a styled message to the console.\n *\n * @example\n * Log(\"Hello World!\"); // Prints: | LOG | Hello World! |\n * Log.success(\"Hello World!\"); // Prints: | SUCCESS | Hello World! |\n * Log.info(\"Hello World!\"); // Prints: | INFO | Hello World! |\n * Log.error(\"Hello World!\"); // Prints: | ERROR | Hello World! |\n * Log.fatal(\"Hello World!\"); // Prints: | FATAL | Hello World! |\n * Log.warn(\"Hello World!\"); // Prints: | WARNING | Hello World! |\n */\nexport const Log = createLog();\n\nfunction formatLogTitle(title: string, style: ChalkInstance) {\n const width = logConfig.titleWidth;\n const paddingLength = title.length >= width ? 0 : (width - title.length) / 2;\n const paddingStart = \" \".repeat(paddingLength);\n const paddingEnd = \" \".repeat(paddingLength);\n\n title = paddingStart + title + paddingEnd;\n\n // Ensure that the final string has width length\n title = title.padEnd(width, \" \");\n\n // apply style\n title = style(title + \"|\");\n\n return title;\n}\n\nfunction logFormatter(title: string, style: ChalkInstance, ...messages: string[]) {\n const { prefixNewlines, content, suffixNewlines } = splitOnNewline(messages);\n const formattedTitle = formatLogTitle(title, style);\n\n const splitByNewLines = content.split(\"\\n\");\n\n let message = \"\";\n for (const [index, splitByNewline] of splitByNewLines.entries()) {\n if (index > 0) {\n const width = logConfig.titleWidth / logConfig.spacer.length;\n const spacer = logConfig.spacer.repeat(width).padEnd(logConfig.titleWidth);\n message += \"\\n\" + style.dim(spacer + \"↪ \");\n }\n\n message += splitByNewline;\n }\n\n console.log(prefixNewlines + formattedTitle, message, suffixNewlines);\n}\n\nfunction splitOnNewline(input: string[]) {\n const message = input.join(\" \");\n\n // Check for leading newlines\n let newlineStart = 0;\n while (newlineStart < message.length && message[newlineStart] == \"\\n\") {\n newlineStart++;\n }\n\n // Check for trailing newlines\n let newlineEnd = message.length;\n while (newlineEnd > newlineStart && message[newlineEnd - 1] == \"\\n\") {\n newlineEnd--;\n }\n\n const results = {\n prefixNewlines: message.slice(0, Math.max(0, newlineStart)),\n content: message.slice(newlineStart, newlineEnd),\n suffixNewlines: message.slice(Math.max(0, newlineEnd)),\n };\n\n return results;\n}\n","import type { ParseResult } from \"@babel/parser\";\nimport type { Plugin } from \"@staticbolt/core\";\nimport type { Root } from \"mdast\";\nimport type postcss from \"postcss\";\n\nexport type { NodePath } from \"@babel/traverse\";\n\nexport type BabelAst = ParseResult;\nexport type PostcssAst = postcss.Root;\nexport type { HTMLElement, Document } from \"@staticbolt/node-html-parser\";\n\nexport interface MarkdownAst {\n root: Root;\n frontmatter: Record<string, string>;\n render(): Promise<string>;\n}\n\nexport const CUSTOM_ATTRIBUTES = Object.freeze({\n /** For script and style tags to grab the metadata */\n MetadataID: \"data-metadata-id\",\n});\n\nexport const CONFIG_FILE_NAME = \".staticbolt.ts\";\n\nexport interface AppConfig {\n /**\n * The project root. Relative paths in the config are resolved against it.\n *\n * @default process.cwd()\n */\n root?: string;\n\n /** Plugins to run, in order. Nested arrays are flattened, so a plugin preset can be spread in as a single entry. */\n plugins?: (Plugin[] | Plugin)[];\n\n /**\n * The output directory, either absolute or relative to {@link AppConfig.root}.\n *\n * @default \"./dist\"\n */\n outdir?: string;\n\n /**\n * Whether to build for production. In development the project is watched for file changes.\n *\n * @default false\n */\n production?: boolean;\n\n /**\n * Browsers to target, as [browserslist](https://github.com/browserslist/browserslist) queries. Defaults to the project's\n * browserslist configuration.\n *\n * @example\n * [\"last 2 Chrome versions\", \"last 2 Safari versions\"];\n */\n browserslist?: string[];\n\n /**\n * Whether to time each plugin hook and print a breakdown when the build finishes.\n *\n * @default false\n */\n measureExecutionTime?: boolean;\n\n /**\n * Path aliases, merged on top of the ones resolved from `tsconfig.json` — entries defined here win on key conflicts.\n *\n * Keys ending with `/` are directory aliases, otherwise the key is matched as a whole. Values are resolved relative to the\n * project root.\n *\n * @example\n * { \"~/\": \"./src/\", \"@config\": \"./src/config.ts\" }\n */\n aliases?: Record<string, string>;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AASA,MAAM,cAAc;;AAGpB,SAAS,QAAQ,MAAsB;CACrC,MAAM,OAAO,KAAK,SAAS,IAAI,IAAI,KAAK,QAAQ,aAAa,GAAG,IAAI;CAGpE,IAAI,SAAS,KACX,OAAO;CAGT,IAAI,SAAS,OAAO,SAAS,WAAW,IAAI,GAC1C,OAAO;CAGT,IAA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AG,YAAY,CAAC;EAC1D,SAAS,QAAQ,MAAM,cAAc,UAAU;EAC/C,gBAAgB,QAAQ,MAAM,KAAK,IAAI,GAAG,UAAU,CAAC;CAG1C;AACf;;;;ACjIA,MAAa,oBAAoB,OAAO,OAAO;;AAE7C,YAAY,mBACd,CAAC;AAED,MAAa,mBAAmB"}
1
+ {"version":3,"file":"common-D1QTZ8ra.mjs","names":[],"sources":["../src/utilities/path.ts","../src/utilities/logger.ts","../src/types/common.ts"],"sourcesContent":["import nodePath from \"node:path\";\nimport micromatch from \"micromatch\";\n\nexport { basename, extname, isAbsolute, parse, resolve } from \"node:path\";\n\n// For ESM and CSS compatibility:\n// - Always use unix separators (except `resolve`, which returns an absolute path)\n// - Relative paths should always start with `./`\n\nconst separatorRe = /\\\\/g;\n\n/** Normalizes a path result to unix separators and ensures relative paths start with `./` */\nfunction unixify(path: string): string {\n const unix = path.includes(\"\\\\\") ? path.replace(separatorRe, \"/\") : path;\n\n // Example: dirname(\"index.html\") => \".\"\n if (unix === \".\") {\n return \"./\";\n }\n\n if (unix === \"/\" || nodePath.isAbsolute(unix)) {\n return unix;\n }\n\n if (unix.startsWith(\"./\") || unix.startsWith(\"../\")) {\n return unix;\n }\n\n return `./${unix}`;\n}\n\nexport const join = (...arguments_: string[]) => unixify(nodePath.join(...arguments_));\n\n/** `relative` is pure and called with highly repetitive inputs on hot paths, so cache results. */\nconst relativeCache = new Map<string, string>();\n\nexport const relative = (from: string, to: string) => {\n const key = from + \"\\u{0}\" + to;\n\n let result = relativeCache.get(key);\n if (result === undefined) {\n result = unixify(nodePath.relative(from, to));\n relativeCache.set(key, result);\n }\n\n return result;\n};\n\nexport const dirname = (path: string) => unixify(nodePath.dirname(path));\n\nexport const normalize = (path: string) => unixify(nodePath.normalize(path));\n\n/**\n * Recalculates the relative path for a resource after a file has been moved.\n *\n * @param source - The source found in the `oldPath` file.\n * @param oldPath - Absolute or relative original path of the file.\n * @param newPath - Absolute or relative new path of the file.\n * @returns The updated relative path from the new file's directory to the same resource.\n */\nexport function rebaseRelativePath(source: string, oldPath: string, newPath: string): string {\n return relative(dirname(newPath), join(dirname(oldPath), source));\n}\n\n/**\n * Checks if a path (child) is a subpath of another (parent).\n *\n * Note: both paths must be of the same type — either both absolute or both relative. Mixing them will produce incorrect results.\n *\n * @param parentDirectory - The parent directory.\n * @param childPath - The child path (file or directory).\n */\nexport function isSubpath(parentDirectory: string, childPath: string): boolean {\n if (childPath === \"./\") return false;\n const relativePath = relative(normalize(parentDirectory), normalize(childPath));\n return relativePath === \"\" || (!relativePath.startsWith(\"..\") && !nodePath.isAbsolute(relativePath));\n}\n\ninterface SourceRelativeToRootOptions {\n /** The root directory (absolute or resolvable) */\n root: string;\n /** The file path that contains the source path */\n filePath: string;\n /** The source path */\n sourcePath: string;\n}\n\n/** Calculates the relative path of a source path to the root. */\nexport function sourceRelativeToRoot({ root, filePath, sourcePath }: SourceRelativeToRootOptions): string {\n const absRoot = nodePath.resolve(root);\n return relative(absRoot, nodePath.join(absRoot, dirname(filePath), sourcePath));\n}\n\n/** Replaces the extension of a given path. */\nexport function replaceExtension(filePath: string, extension: string): string {\n const { dir, name } = nodePath.parse(filePath);\n return normalize(nodePath.format({ dir, name, ext: extension }));\n}\n\n/** Appends a forward slash to the end of a path if it doesn't already end with one. */\nexport const appendForwardSlash = (path: string) => (path.endsWith(\"/\") ? path : `${path}/`);\n\n/** Removes the leading `./` from a path. */\nexport const trimDotPrefix = (path: string) => (path.startsWith(\"./\") ? path.slice(2) : path);\n\n/** Returns the first segment of a path. */\nexport function firstPart(path: string): string {\n const cleaned = normalize(path).replace(/\\/$/, \"\");\n return cleaned.split(\"/\", 1)[0] ?? \"\";\n}\n\n/**\n * Splits a semicolon-separated attribute value into an array of trimmed glob patterns.\n *\n * Returns `undefined` when the input is not a string, and an empty array for an empty string.\n */\nexport function parsePatterns(string: string | null | undefined): string[] | undefined {\n if (typeof string !== \"string\") return;\n\n if (!string) return [];\n\n return string.split(\";\").flatMap(pattern => {\n const trimmed = pattern.trim();\n return trimmed ? [trimmed] : [];\n });\n}\n\ninterface MatchPathOptions {\n include: string | string[];\n ignore?: string | string[];\n root: string;\n}\n\nconst matcherCache = new Map<string, (path: string) => boolean>();\n\n/** `micromatch.isMatch` compiles its patterns on every call; cache the compiled matcher per patterns+options instead. */\nfunction getMatcher(include: string | string[], ignore: string | string[] | undefined, cwd: string | undefined) {\n const key = JSON.stringify([include, ignore, cwd]);\n\n let matcher = matcherCache.get(key);\n if (!matcher) {\n // The underlying picomatch accepts `string | string[]` patterns, the micromatch typings are just too narrow\n matcher = micromatch.matcher(include as string, cwd === undefined ? { ignore } : { cwd, ignore });\n matcherCache.set(key, matcher);\n }\n\n return matcher;\n}\n\n/** Checks if a file path matches a set of patterns. */\nexport function isPathMatch(filePath: string, { include, ignore, root }: MatchPathOptions): boolean {\n // Case: outside the root directory\n if (filePath.startsWith(\"..\")) {\n return getMatcher(include, ignore, undefined)(join(root, filePath));\n }\n\n // Case: inside the root dir\n const withoutDotPrefix = filePath.replace(/^\\.\\//, \"\");\n return getMatcher(include, ignore, root)(withoutDotPrefix);\n}\n","import chalk from \"chalk\";\n\ntype ChalkInstance = typeof chalk;\n\nconst logConfig = {\n verboseEnabled: false,\n verboseFilter: null as null | RegExp,\n titleWidth: 10,\n spacer: \" \",\n style: {\n success: chalk.green,\n error: chalk.red,\n fatal: chalk.red,\n warning: chalk.yellow,\n verbose: chalk.dim,\n info: chalk.blueBright,\n tip: chalk.magenta,\n log: chalk.white,\n spacer: chalk.dim,\n },\n};\n\nexport function createLog(...defaultMessages: string[]) {\n function Log(...messages: unknown[]) {\n console.log(formatLogTitle(\"LOG\", logConfig.style.log), ...defaultMessages, ...messages);\n }\n\n Log.warn = (...messages: string[]) => {\n logFormatter(\"WARNING\", logConfig.style.warning, ...defaultMessages, ...messages);\n };\n\n Log.success = (...messages: string[]) => {\n logFormatter(\"SUCCESS\", logConfig.style.success, ...defaultMessages, ...messages);\n };\n\n Log.error = (...messages: string[]) => {\n logFormatter(\"ERROR\", logConfig.style.error, ...defaultMessages, ...messages);\n };\n\n Log.fatal = (...messages: string[]) => {\n logFormatter(\"FATAL\", logConfig.style.fatal, ...defaultMessages, ...messages);\n\n // eslint-disable-next-line unicorn/no-process-exit\n process.exit(1);\n };\n\n Log.info = (...messages: string[]) => {\n logFormatter(\"INFO\", logConfig.style.info, ...defaultMessages, ...messages);\n };\n\n Log.tip = (...messages: string[]) => {\n logFormatter(\"TIP\", logConfig.style.tip, ...defaultMessages, ...messages);\n };\n\n Log.debug = (...messages: string[]) => {\n if (!logConfig.verboseEnabled) return;\n\n const joined = defaultMessages.concat(messages).join(\" \");\n if (logConfig.verboseFilter && !logConfig.verboseFilter.test(joined)) return;\n\n logFormatter(\"DEBUG\", logConfig.style.verbose, joined);\n };\n\n Log.enableVerbose = (isEnabled: boolean) => {\n logConfig.verboseEnabled = isEnabled;\n };\n\n Log.setVerboseFilter = (filter: RegExp) => {\n logConfig.verboseFilter = filter;\n };\n\n return Log;\n}\n\n/**\n * - Prints a styled message to the console.\n *\n * @example\n * Log(\"Hello World!\"); // Prints: | LOG | Hello World! |\n * Log.success(\"Hello World!\"); // Prints: | SUCCESS | Hello World! |\n * Log.info(\"Hello World!\"); // Prints: | INFO | Hello World! |\n * Log.error(\"Hello World!\"); // Prints: | ERROR | Hello World! |\n * Log.fatal(\"Hello World!\"); // Prints: | FATAL | Hello World! |\n * Log.warn(\"Hello World!\"); // Prints: | WARNING | Hello World! |\n */\nexport const Log = createLog();\n\nfunction formatLogTitle(title: string, style: ChalkInstance) {\n const width = logConfig.titleWidth;\n const paddingLength = title.length >= width ? 0 : (width - title.length) / 2;\n const paddingStart = \" \".repeat(paddingLength);\n const paddingEnd = \" \".repeat(paddingLength);\n\n title = paddingStart + title + paddingEnd;\n\n // Ensure that the final string has width length\n title = title.padEnd(width, \" \");\n\n // apply style\n title = style(title + \"|\");\n\n return title;\n}\n\nfunction logFormatter(title: string, style: ChalkInstance, ...messages: string[]) {\n const { prefixNewlines, content, suffixNewlines } = splitOnNewline(messages);\n const formattedTitle = formatLogTitle(title, style);\n\n const splitByNewLines = content.split(\"\\n\");\n\n let message = \"\";\n for (const [index, splitByNewline] of splitByNewLines.entries()) {\n if (index > 0) {\n const width = logConfig.titleWidth / logConfig.spacer.length;\n const spacer = logConfig.spacer.repeat(width).padEnd(logConfig.titleWidth);\n message += \"\\n\" + style.dim(spacer + \" \");\n }\n\n message += splitByNewline;\n }\n\n console.log(prefixNewlines + formattedTitle, message, suffixNewlines);\n}\n\nfunction splitOnNewline(input: string[]) {\n const message = input.join(\" \");\n\n // Check for leading newlines\n let newlineStart = 0;\n while (newlineStart < message.length && message[newlineStart] == \"\\n\") {\n newlineStart++;\n }\n\n // Check for trailing newlines\n let newlineEnd = message.length;\n while (newlineEnd > newlineStart && message[newlineEnd - 1] == \"\\n\") {\n newlineEnd--;\n }\n\n const results = {\n prefixNewlines: message.slice(0, Math.max(0, newlineStart)),\n content: message.slice(newlineStart, newlineEnd),\n suffixNewlines: message.slice(Math.max(0, newlineEnd)),\n };\n\n return results;\n}\n","import type { ParseResult } from \"@babel/parser\";\nimport type { Plugin } from \"@staticbolt/core\";\nimport type { Root } from \"mdast\";\nimport type postcss from \"postcss\";\n\nexport type { NodePath } from \"@babel/traverse\";\n\nexport type BabelAst = ParseResult;\nexport type PostcssAst = postcss.Root;\nexport type { HTMLElement, Document } from \"@staticbolt/node-html-parser\";\n\nexport interface MarkdownAst {\n root: Root;\n frontmatter: Record<string, string>;\n render(): Promise<string>;\n}\n\nexport const CUSTOM_ATTRIBUTES = Object.freeze({\n /** For script and style tags to grab the metadata */\n MetadataID: \"data-metadata-id\",\n});\n\nexport const CONFIG_FILE_NAME = \".staticbolt.ts\";\n\nexport interface AppConfig {\n /**\n * The project root. Relative paths in the config are resolved against it.\n *\n * @default process.cwd()\n */\n root?: string;\n\n /** Plugins to run, in order. Nested arrays are flattened, so a plugin preset can be spread in as a single entry. */\n plugins?: (Plugin[] | Plugin)[];\n\n /**\n * The output directory, either absolute or relative to {@link AppConfig.root}.\n *\n * @default \"./dist\"\n */\n outdir?: string;\n\n /**\n * Whether to build for production. In development the project is watched for file changes.\n *\n * @default false\n */\n production?: boolean;\n\n /**\n * Browsers to target, as [browserslist](https://github.com/browserslist/browserslist) queries. Defaults to the project's\n * browserslist configuration.\n *\n * @example\n * [\"last 2 Chrome versions\", \"last 2 Safari versions\"];\n */\n browserslist?: string[];\n\n /**\n * Whether to time each plugin hook and print a breakdown when the build finishes.\n *\n * @default false\n */\n measureExecutionTime?: boolean;\n\n /**\n * Path aliases, merged on top of the ones resolved from `tsconfig.json` — entries defined here win on key conflicts.\n *\n * Keys ending with `/` are directory aliases, otherwise the key is matched as a whole. Values are resolved relative to the\n * project root.\n *\n * @example\n * { \"~/\": \"./src/\", \"@config\": \"./src/config.ts\" }\n */\n aliases?: Record<string, string>;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AASA,MAAM,cAAc;;AAGpB,SAAS,QAAQ,MAAsB;CACrC,MAAM,OAAO,KAAK,SAAS,IAAI,IAAI,KAAK,QAAQ,aAAa,GAAG,IAAI;CAGpE,IAAI,SAAS,KACX,OAAO;CAGT,IAAI,SAAS,OAAO,SAAS,WAAW,IAAI,GAC1C,OAAO;CAGT,IAAI,KAAK,WAAW,IAAI,KAAK,KAAK,WAAW,KAAK,GAChD,OAAO;CAGT,OAAO,KAAK;AACd;AAEA,MAAa,QAAQ,GAAG,eAAyB,QAAQ,SAAS,KAAK,GAAG,UAAU,CAAC;;AAGrF,MAAM,gCAAgB,IAAI,IAAoB;AAE9C,MAAa,YAAY,MAAc,OAAe;CACpD,MAAM,MAAM,OAAO,OAAU;CAE7B,IAAI,SAAS,cAAc,IAAI,GAAG;CAClC,IAAI,WAAW,QAAW;EACxB,SAAS,QAAQ,SAAS,SAAS,MAAM,EAAE,CAAC;EAC5C,cAAc,IAAI,KAAK,MAAM;CAC/B;CAEA,OAAO;AACT;AAEA,MAA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AG;CAEzB,OAAO;AACT;AAEA,SAAS,aAAa,OAAe,OAAsB,GAAG,UAAoB;CAChF,MAAM,EAAE,gBAAgB,SAAS,mBAAmB,eAAe,QAAQ;CAC3E,MAAM,iBAAiB,eAAe,OAAO,KAAK;CAElD,MAAM,kBAAkB,QAAQ,MAAM,IAAI;CAE1C,IAAI,UAAU;CACd,KAAK,MAAM,CAAC,OAAO,mBAAmB,gBAAgB,QAAQ,GAAG;EAC/D,IAAI,QAAQ,GAAG;GACb,MAAM,QAAQ,UAAU,aAAa,UAAU,OAAO;GACtD,MAAM,SAAS,UAAU,OAAO,OAAO,KAAK,CAAC,CAAC,OAAO,UAAU,UAAU;GACzE,WAAW,OAAO,MAAM,IAAI,SAAS,IAAI;EAC3C;EAEA,WAAW;CACb;CAEA,QAAQ,IAAI,iBAAiB,gBAAgB,SAAS,cAAc;AACtE;AAEA,SAAS,eAAe,OAAiB;CACvC,MAAM,UAAU,MAAM,KAAK,GAAG;CAG9B,IAAI,eAAe;CACnB,OAAO,eAAe,QAAQ,UAAU,QAAQ,iBAAiB,MAC/D;CAIF,IAAI,aAAa,QAAQ;CACzB,OAAO,aAAa,gBAAgB,QAAQ,aAAa,MAAM,MAC7D;CASF,OAAO;EALL,gBAAgB,QAAQ,MAAM,GAAG,KAAK,IAAI,GAAG,YAAY,CAAC;EAC1D,SAAS,QAAQ,MAAM,cAAc,UAAU;EAC/C,gBAAgB,QAAQ,MAAM,KAAK,IAAI,GAAG,UAAU,CAAC;CAG1C;AACf;;;;ACjIA,MAAa,oBAAoB,OAAO,OAAO;;AAE7C,YAAY,mBACd,CAAC;AAED,MAAa,mBAAmB"}
package/lib/index.d.mts CHANGED
@@ -1,5 +1,5 @@
1
- import { ObjectEncodingOptions, OpenMode, PathLike, PathOrFileDescriptor } from "node:fs";
2
1
  import { basename, extname, isAbsolute, parse as parse$1, resolve } from "node:path";
2
+ import { ObjectEncodingOptions, OpenMode, PathLike, PathOrFileDescriptor } from "node:fs";
3
3
  import { FileHandle } from "node:fs/promises";
4
4
  import { Document, HTMLElement, HTMLElement as HTMLElement$1, Node } from "@staticbolt/node-html-parser";
5
5
  import postcss, { Node as Node$1, Postcss } from "postcss";
@@ -1386,9 +1386,11 @@ declare class Resolver {
1386
1386
  files: Set<string>;
1387
1387
  directories: Set<string>;
1388
1388
  misses: Set<string>;
1389
+ /** Whether a source that resolves to a missing file is logged, once. The result says so either way. */
1390
+ shouldWarnOnMissing: boolean;
1389
1391
  static JS_EXTENSIONS: Set<string>;
1390
1392
  static HTML_EXTENSIONS: Set<string>;
1391
- constructor(root: string, isProduction?: boolean, configAliases?: Record<string, string>);
1393
+ constructor(root: string, isProduction?: boolean, configAliases?: Record<string, string>, shouldWarnOnMissing?: boolean);
1392
1394
  resolve(sourceOrLink: string, filePath: string): ResolveResult$1 | undefined;
1393
1395
  resolveAlias(source: string): string | undefined;
1394
1396
  normalize(filePath: string): string;
@@ -1648,6 +1650,123 @@ interface HTMLDataV1 {
1648
1650
  valueSets?: IValueSet[];
1649
1651
  }
1650
1652
  //#endregion
1653
+ //#region src/types/lsp.d.ts
1654
+ /**
1655
+ * JavaScript a plugin embeds in HTML, described for the language server: which files carry it, where it sits in their text, and
1656
+ * what the code can see. The server serves those regions through the project's TypeScript, as TypeScript.
1657
+ */
1658
+ interface EmbeddedLanguage {
1659
+ /** Names the virtual document the regions are served from, so diagnostics say where they come from. */
1660
+ name: string;
1661
+ /** Whether a file carries this language, given its path relative to the project root. */
1662
+ filter: (file: string) => boolean;
1663
+ /**
1664
+ * The regions in a matching document, as offsets into its text, in order and not overlapping. A region a plugin earlier in the
1665
+ * config claimed already stays that plugin's: the core plugin, last in the config, only gets the scripts nobody else knows.
1666
+ */
1667
+ findRegions: (document: DocumentInfo) => EmbeddedRegion[];
1668
+ /**
1669
+ * Whether the editor's own grammar colours the regions, a `<script type="application/x-typescript">` body say. The server then
1670
+ * colours only what TypeScript knows about the identifiers; otherwise it colours the keywords, literals and operators as well.
1671
+ */
1672
+ isColouredByEditor?: boolean;
1673
+ /**
1674
+ * Appended to the virtual document: declarations for what the regions' code can see. In a module they shadow globals of the
1675
+ * same name; in a script, whose top level is the global scope, they are those globals.
1676
+ */
1677
+ prelude?: string | ((document: DocumentInfo) => string);
1678
+ }
1679
+ /** A stretch of a document, as offsets into its text. */
1680
+ interface TextRange {
1681
+ start: number;
1682
+ end: number;
1683
+ }
1684
+ /** A stretch of a document in an embedded language. */
1685
+ interface EmbeddedRegion extends TextRange {
1686
+ /**
1687
+ * Whether the code is a module of its own, a `<script type="module">` say: served as its own file, so its top level is its
1688
+ * alone, rather than with the language's other regions, which share a scope like classic scripts do.
1689
+ */
1690
+ isModule?: boolean;
1691
+ /**
1692
+ * The whole construct the code sits in, delimiters included, `{{ … }}` for a placeholder: what the languages around it see as a
1693
+ * hole. The region itself when left out.
1694
+ */
1695
+ extent?: TextRange;
1696
+ }
1697
+ /**
1698
+ * A document as the language server parsed it, so a plugin never has to: the elements with their attributes and where everything
1699
+ * sits, and a resolver for the sources they point at.
1700
+ */
1701
+ interface DocumentInfo {
1702
+ /** The document's path relative to the project root. */
1703
+ file: string;
1704
+ /** The document's HTML text. For a markdown document, the parts that can never be HTML are blanked out. */
1705
+ text: string;
1706
+ /** Every element in document order. */
1707
+ elements: ElementInfo[];
1708
+ /** The elements with one of the given tag names. */
1709
+ select: (...names: string[]) => ElementInfo[];
1710
+ /** The text of a range, an element's content say. */
1711
+ textOf: (range: TextRange) => string;
1712
+ /** Resolves a source the way the build does, relative to the document and through the project's aliases. */
1713
+ resolve: (source: string) => ResolvedSource | undefined;
1714
+ }
1715
+ /** Where a source lands once resolved. */
1716
+ interface ResolvedSource {
1717
+ /** The absolute path the source lands on. */
1718
+ path: string;
1719
+ /** Whether there is a file there. */
1720
+ exists: boolean;
1721
+ }
1722
+ /** An element of the document, with its attributes and where it sits. */
1723
+ interface ElementInfo {
1724
+ /** The tag name, lower case. */
1725
+ name: string;
1726
+ /** The attributes in the start tag, in order. */
1727
+ attributes: AttributeInfo[];
1728
+ /** The enclosing element, or nothing at the top level. */
1729
+ parent: ElementInfo | undefined;
1730
+ /** The elements directly inside. */
1731
+ children: ElementInfo[];
1732
+ /** The whole element, from its `<` to the end of its end tag, or of its start tag when it has none. */
1733
+ range: TextRange;
1734
+ /** The tag name in the start tag. */
1735
+ nameRange: TextRange;
1736
+ /** Between the start and the end tag, or up to where the element ends when it has no end tag; nothing for a void element. */
1737
+ contentRange: TextRange | undefined;
1738
+ /** The attribute with a name, matched regardless of case. */
1739
+ attribute: (name: string) => AttributeInfo | undefined;
1740
+ /** Whether an attribute with a name is there, regardless of case. */
1741
+ has: (name: string) => boolean;
1742
+ }
1743
+ /** An attribute of an element, with its value unquoted. */
1744
+ interface AttributeInfo {
1745
+ /** The attribute name as written. */
1746
+ name: string;
1747
+ /** The value without its quotes, or nothing for an attribute written without a value. */
1748
+ value: string | undefined;
1749
+ /** The element the attribute is on. */
1750
+ element: ElementInfo;
1751
+ /** The attribute name in the start tag. */
1752
+ nameRange: TextRange;
1753
+ /** The value without its quotes, when there is one. */
1754
+ valueRange: TextRange | undefined;
1755
+ }
1756
+ /** Where a problem is: an element underlines its tag name, an attribute its value or else its name, a range itself. */
1757
+ type ProblemTarget = ElementInfo | AttributeInfo | TextRange;
1758
+ /** Collects what a plugin finds wrong with a document, each problem shown at its target with the plugin's name. */
1759
+ interface ProblemReporter {
1760
+ /** Something the build would reject. */
1761
+ error: (target: ProblemTarget, message: string) => void;
1762
+ /** Something the build accepts but that is likely a mistake. */
1763
+ warn: (target: ProblemTarget, message: string) => void;
1764
+ /** Something worth knowing. */
1765
+ info: (target: ProblemTarget, message: string) => void;
1766
+ /** A suggestion, shown without underlining. */
1767
+ hint: (target: ProblemTarget, message: string) => void;
1768
+ }
1769
+ //#endregion
1651
1770
  //#region src/types/plugin.d.ts
1652
1771
  type FastifyHandlerParameters = Parameters<onRequestHookHandler>;
1653
1772
  type ServerReply = FastifyHandlerParameters[1];
@@ -1717,7 +1836,17 @@ interface Plugin {
1717
1836
  * `projectDirectory` — the directory the CLI was pointed at.
1718
1837
  */
1719
1838
  cli?: (this: CliProgram$1, config: AppConfig$1, configPath: string, projectDirectory: string) => void | Promise<void>;
1839
+ /** The tags and attributes the plugin adds to HTML, for completion and hover in the editor. */
1720
1840
  lspHtmlData?: () => HTMLDataV1 | undefined | Promise<HTMLDataV1 | undefined>;
1841
+ /** Languages the plugin embeds in HTML, for the language server to serve their regions through the project's TypeScript. */
1842
+ lspEmbeddedLanguages?: () => EmbeddedLanguage[];
1843
+ /**
1844
+ * Checks a document for the language server, reporting what the plugin finds wrong: misused tags, attributes, values. Runs on
1845
+ * every edit, over the source as written, before any plugin has run: a value another plugin fills in later (see `isDynamic`) or
1846
+ * a tag another plugin rewrites first is not a mistake, so only report what no plugin order can make right. `checkFileExists`
1847
+ * and the other helpers exported by the package cover the common checks.
1848
+ */
1849
+ lspValidate?: (document: DocumentInfo, report: ProblemReporter) => void | Promise<void>;
1721
1850
  }
1722
1851
  type RemoveThis<T> = Required<{ [K in keyof T]: T[K] extends ((this: App$1, ...arguments_: infer A) => infer R) | undefined ? (...arguments_: A) => R : T[K]; }>;
1723
1852
  type BoundPlugin = RemoveThis<Plugin>;
@@ -1740,6 +1869,25 @@ declare class DependencyTracker {
1740
1869
  getSources(importer: string): ReadonlySet<string>;
1741
1870
  }
1742
1871
  //#endregion
1872
+ //#region src/helpers/lsp-checks.d.ts
1873
+ /** Whether an attribute value is only known later: it holds a placeholder something else fills in. */
1874
+ declare function isDynamic(value: string): boolean;
1875
+ /**
1876
+ * Reports an attribute whose value is a path to a file that is not there. A URL, an absolute link or a value with a placeholder
1877
+ * is left alone.
1878
+ */
1879
+ declare function checkFileExists(attribute: AttributeInfo, document: DocumentInfo, report: ProblemReporter): void;
1880
+ /** Reports an attribute whose value is not the JSON of an object. A value with a placeholder is left alone. */
1881
+ declare function checkJsonObject(attribute: AttributeInfo, report: ProblemReporter): void;
1882
+ /** Whether a string is the JSON of an object. */
1883
+ declare function isJsonObject(text: string): boolean;
1884
+ /** Whether a script element holds JavaScript, going by its `type`: the build leaves any other kind of script alone. */
1885
+ declare function isJavaScript(script: ElementInfo): boolean;
1886
+ /** Whether a `<script>` is marked as TypeScript for the editor, which also keeps the editor's own script support out. */
1887
+ declare function isTypeScriptScript(script: ElementInfo): boolean;
1888
+ /** Whether an element has nothing but whitespace between its tags. */
1889
+ declare function isEmptyElement(element: ElementInfo, document: DocumentInfo): boolean;
1890
+ //#endregion
1743
1891
  //#region src/utilities/html-links.d.ts
1744
1892
  /**
1745
1893
  * Checks if the link is an HTML link (not a file link)
@@ -1955,5 +2103,5 @@ declare function escapeHtml(input: string): string;
1955
2103
  */
1956
2104
  declare function defineConfig(config: AppConfig): AppConfig;
1957
2105
  //#endregion
1958
- export { type App, type AppConfig, type BabelAst, type Baseline, type BaselineStatus, type BinaryAssetMetadata, type BoundPlugin, type CONFIG_FILE_NAME, type CUSTOM_ATTRIBUTES, type CliProgram, type DeferredPass, type DeferredPassHandler, DependencyTracker, type Document, type HTMLDataV1, type HTMLElement, type HtmlMetadata, type IAttributeData, type IReference, type ITagData, type IValueData, type IValueSet, METADATA_TYPES, type MarkdownAst, type MarkdownMetadata, type MarkupContent, type MarkupKind, type MetadataBase, type MetadataSource, type MetadataTypes, type NodePath, type PackageMetadata, type Plugin, type PostcssAst, PrintFormattedError, type ResolveResult, Resolver, type ScriptMetadata, type ServerReply, type ServerRequest, type StringifyOptions, type StyleMetadata, type SvgMetadata, type TextAssetMetadata, ValueOrError, type WebManifestMetadata, assign, bytesToKB, camelCaseToKebabCase, capitalize, clamp, clearLn, cloneObject, defineConfig, downloadContent, escapeHtml, filterScriptMetadata, filterStyleMetadata, getLineColumn, handleError, hashContent, humanReadableBytes, isBinaryAssetMetadata, isDefined, isHtmlLink, isHtmlMetadata, isMarkdownMetadata, isObject, isPackageMetadata, isScriptMetadata, isStyleMetadata, isSvgMetadata, isTextAssetMetadata, isURL, isValidRelativePath, isWebManifestMetadata, kebabToCamelCase, mergeMaps, path_d_exports as path, print, printFmtError, safeReadFile, safeReadFileSync, splitHtmlLink, valueOrError };
2106
+ export { type App, type AppConfig, type AttributeInfo, type BabelAst, type Baseline, type BaselineStatus, type BinaryAssetMetadata, type BoundPlugin, type CONFIG_FILE_NAME, type CUSTOM_ATTRIBUTES, type CliProgram, type DeferredPass, type DeferredPassHandler, DependencyTracker, type Document, type DocumentInfo, type ElementInfo, type EmbeddedLanguage, type EmbeddedRegion, type HTMLDataV1, type HTMLElement, type HtmlMetadata, type IAttributeData, type IReference, type ITagData, type IValueData, type IValueSet, METADATA_TYPES, type MarkdownAst, type MarkdownMetadata, type MarkupContent, type MarkupKind, type MetadataBase, type MetadataSource, type MetadataTypes, type NodePath, type PackageMetadata, type Plugin, type PostcssAst, PrintFormattedError, type ProblemReporter, type ProblemTarget, type ResolveResult, type ResolvedSource, Resolver, type ScriptMetadata, type ServerReply, type ServerRequest, type StringifyOptions, type StyleMetadata, type SvgMetadata, type TextAssetMetadata, type TextRange, ValueOrError, type WebManifestMetadata, assign, bytesToKB, camelCaseToKebabCase, capitalize, checkFileExists, checkJsonObject, clamp, clearLn, cloneObject, defineConfig, downloadContent, escapeHtml, filterScriptMetadata, filterStyleMetadata, getLineColumn, handleError, hashContent, humanReadableBytes, isBinaryAssetMetadata, isDefined, isDynamic, isEmptyElement, isHtmlLink, isHtmlMetadata, isJavaScript, isJsonObject, isMarkdownMetadata, isObject, isPackageMetadata, isScriptMetadata, isStyleMetadata, isSvgMetadata, isTextAssetMetadata, isTypeScriptScript, isURL, isValidRelativePath, isWebManifestMetadata, kebabToCamelCase, mergeMaps, path_d_exports as path, print, printFmtError, safeReadFile, safeReadFileSync, splitHtmlLink, valueOrError };
1959
2107
  //# sourceMappingURL=index.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","names":[],"sources":["../../../node_modules/@types/unist/index.d.ts","../../../node_modules/@types/mdast/index.d.ts","../src/types/common.ts","../src/cli/cli.ts","../src/resolver/resolver.ts","../src/main.ts","../src/types/metadata.ts","../src/types/html-data.ts","../src/types/plugin.ts","../src/helpers/dependency-tracker.ts","../src/utilities/html-links.ts","../src/utilities/metadata-utilities.ts","../src/utilities/path.ts","../src/utilities/print-formatted-error.ts","../src/utilities/value-or-error.ts","../src/utilities/read-file.ts","../src/utilities/utilities.ts","../src/index.ts"],"x_google_ignoreList":[0,1],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UAqBiB;;;;UAKA;;;;EAIb;;;;EAKA;;;;EAIA;;;;;;;UAQa;;;;EAIb,OAAO;;;;EAKP,KAAK;;;;;;;;;;;;UA6BQ;;;;EAIb;;;;EAKA,OAAO;;;;;;;EAQP,WAAW;;;;;;;;;;;;;;;;;;;;;;KCjFH;;;;;;;;;;KAWA;;;;;UAOK;;;;;EAKb;;;;;;;;;;;UAYa;;;;;;;;;;;;;;EAcb;;;;;;;;;;EAWA;;;;;UAMa,kBAAkB;;;;EAI/B,eAAe;;;;;UAMF;;;;EAIb;;;;;EAKA;;;;;;;;;;;;;;;;;;;;;UAuBa,aAAa;;;;;;;;;KAWlB,eAAe,sBAAsB;;;;;;;;;;;;;;;;;;UAmBhC;EACb,YAAY;EACZ,MAAM;EACN,SAAS;EACT,MAAM;EACN,MAAM;EACN,WAAW;EACX,OAAO;EACP,eAAe;;;;;;;;;KAUP,oBAAoB,2BAA2B;;;;;;;;;;;;;;;;;UAkB1C;EACb,YAAY;EACZ,oBAAoB;;;;;;;;;KAwCZ,cAAc,qBAAqB;;;;;;;;;;;;;;;;;UAkB9B;EACb,UAAU;;;;;;;;;KAUF,kBAAkB,yBAAyB;;;;;;;;;;;;;;;;;;UAmBtC;EACb,OAAO;EACP,QAAQ;EACR,UAAU;EACV,mBAAmB;EACnB,MAAM;EACN,OAAO;EACP,gBAAgB;EAChB,YAAY;EACZ,MAAM;EACN,eAAe;EACf,QAAQ;EACR,MAAM;;;;;;;;KASE,cAAc,qBAAqB;;;;;;;;;;;;;;;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AY,MAAM,QAAQ,SAAS,YAAY,MAAM,QAAQ,aAAa;GACjH,GAAG,qBAAqB,eAAe,YAAY,MAAM,QAAQ,YAAY,MAAM,aAAa;;cAGtF,cAA2C;;;iBCnDlC,aACpB,MAAM,WAAW,YACjB;EAEM;EACA,OAAO;IACL,oBAEP,QAAQ,aAAa;iBAEF,aACpB,MAAM,WAAW,YACjB;EAEM,UAAU;EACV,OAAO;IACL,aACJ,iBACH,QAAQ;iBAEW,aACpB,MAAM,WAAW,YACjB,WACK,wBACC;EACE,OAAO;KAEX,wBAEH,QAAQ,sBAAsB;iBAoBjB,iBACd,MAAM,sBACN;EACE;EACA;WAED,aAAa;iBAEA,iBACd,MAAM,sBACN,SACI;EAEE,UAAU;EACV;IAEL;iBAEa,iBACd,MAAM,sBACN,WACK;EACC;KAEF,wBAEH,sBAAsB;;;;iBC9ET,SAAS;;iBAKT;;iBAUA,OAAO,GAAG,iBAAiB,IAAI;;iBAK/B,SAAS,iBAAiB,SAAS;iBAInC,iBAAiB;iBAIjB,qBAAqB;iBAIrB,WAAW;;;;;;;;iBAWX,cAAc,cAAc;;iBAkB5B,mBAAmB;iBAUnB,UAAU;;iBAKV,MAAM,eAAe,aAAa;iBAIlC,UAAU,GAAG,OAAO,gBAAgB,SAAS;;;;;;;;;;;iBAc7C,UAAU,GAAG,GAAG,QAAQ,IAAI,GAAG,IAAI,QAAQ,IAAI,GAAG,KAAK,IAAI,GAAG;;iBAUxD,gBAAgB,cAAc,QAAQ;iBAuB5C,MAAM;;iBAKN,YAAY,kBAAkB,QAAQ,IAAI;iBAI1C,YAAY;iBAMZ,WAAW;;;;;;;;;iBC7IX,aAAa,QAAQ,YAAS"}
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../../../node_modules/@types/unist/index.d.ts","../../../node_modules/@types/mdast/index.d.ts","../src/types/common.ts","../src/cli/cli.ts","../src/resolver/resolver.ts","../src/main.ts","../src/types/metadata.ts","../src/types/html-data.ts","../src/types/lsp.ts","../src/types/plugin.ts","../src/helpers/dependency-tracker.ts","../src/helpers/lsp-checks.ts","../src/utilities/html-links.ts","../src/utilities/metadata-utilities.ts","../src/utilities/path.ts","../src/utilities/print-formatted-error.ts","../src/utilities/value-or-error.ts","../src/utilities/read-file.ts","../src/utilities/utilities.ts","../src/index.ts"],"x_google_ignoreList":[0,1],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UAqBiB;;;;UAKA;;;;EAIb;;;;EAKA;;;;EAIA;;;;;;;UAQa;;;;EAIb,OAAO;;;;EAKP,KAAK;;;;;;;;;;;;UA6BQ;;;;EAIb;;;;EAKA,OAAO;;;;;;;EAQP,WAAW;;;;;;;;;;;;;;;;;;;;;;KCjFH;;;;;;;;;;KAWA;;;;;UAOK;;;;;EAKb;;;;;;;;;;;UAYa;;;;;;;;;;;;;;EAcb;;;;;;;;;;EAWA;;;;;UAMa,kBAAkB;;;;EAI/B,eAAe;;;;;UAMF;;;;EAIb;;;;;EAKA;;;;;;;;;;;;;;;;;;;;;UAuBa,aAAa;;;;;;;;;KAWlB,eAAe,sBAAsB;;;;;;;;;;;;;;;;;;UAmBhC;EACb,YAAY;EACZ,MAAM;EACN,SAAS;EACT,MAAM;EACN,MAAM;EACN,WAAW;EACX,OAAO;EACP,eAAe;;;;;;;;;KAUP,oBAAoB,2BAA2B;;;;;;;;;;;;;;;;;UAkB1C;EACb,YAAY;EACZ,oBAAoB;;;;;;;;;KAwCZ,cAAc,qBAAqB;;;;;;;;;;;;;;;;;UAkB9B;EACb,UAAU;;;;;;;;;KAUF,kBAAkB,yBAAyB;;;;;;;;;;;;;;;;;;UAmBtC;EACb,OAAO;EACP,QAAQ;EACR,UAAU;EACV,mBAAmB;EACnB,MAAM;EACN,OAAO;EACP,gBAAgB;EAChB,YAAY;EACZ,MAAM;EACN,eAAe;EACf,QAAQ;EACR,MAAM;;;;;;;;KASE,cAAc,qBAAqB;;;;;;;;;;;;;;;;;;;;UAqB9B;EACb,YAAY;EACZ,O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AAO;KAEX,wBAEH,QAAQ,sBAAsB;iBAoBjB,iBACd,MAAM,sBACN;EACE;EACA;WAED,aAAa;iBAEA,iBACd,MAAM,sBACN,SACI;EAEE,UAAU;EACV;IAEL;iBAEa,iBACd,MAAM,sBACN,WACK;EACC;KAEF,wBAEH,sBAAsB;;;;iBC9ET,SAAS;;iBAKT;;iBAUA,OAAO,GAAG,iBAAiB,IAAI;;iBAK/B,SAAS,iBAAiB,SAAS;iBAInC,iBAAiB;iBAIjB,qBAAqB;iBAIrB,WAAW;;;;;;;;iBAWX,cAAc,cAAc;;iBAkB5B,mBAAmB;iBAUnB,UAAU;;iBAKV,MAAM,eAAe,aAAa;iBAIlC,UAAU,GAAG,OAAO,gBAAgB,SAAS;;;;;;;;;;;iBAc7C,UAAU,GAAG,GAAG,QAAQ,IAAI,GAAG,IAAI,QAAQ,IAAI,GAAG,KAAK,IAAI,GAAG;;iBAUxD,gBAAgB,cAAc,QAAQ;iBAuB5C,MAAM;;iBAKN,YAAY,kBAAkB,QAAQ,IAAI;iBAI1C,YAAY;iBAMZ,WAAW;;;;;;;;;iBC7IX,aAAa,QAAQ,YAAS"}
package/lib/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
- import { A as isTextAssetMetadata, B as isHtmlLink, C as isBinaryAssetMetadata, D as isScriptMetadata, E as isPackageMetadata, H as splitHtmlLink, I as safeReadFile, L as safeReadFileSync, N as METADATA_TYPES, O as isStyleMetadata, P as Resolver, R as handleError, S as filterStyleMetadata, T as isMarkdownMetadata, U as DependencyTracker, V as isValidRelativePath, _ as mergeMaps, a as clamp, b as printFmtError, c as downloadContent, d as hashContent, f as humanReadableBytes, g as kebabToCamelCase, h as isURL, i as capitalize, j as isWebManifestMetadata, k as isSvgMetadata, l as escapeHtml, m as isObject, n as bytesToKB, o as clearLn, p as isDefined, r as camelCaseToKebabCase, s as cloneObject, t as assign, u as getLineColumn, v as print, w as isHtmlMetadata, x as filterScriptMetadata, y as PrintFormattedError, z as valueOrError } from "./utilities-D0KXIZ-B.mjs";
2
- import { h as path_exports } from "./common-DUFKS3lW.mjs";
1
+ import { A as isTextAssetMetadata, B as checkJsonObject, C as isBinaryAssetMetadata, D as isScriptMetadata, E as isPackageMetadata, F as safeReadFile, G as isTypeScriptScript, H as isEmptyElement, I as safeReadFileSync, J as isHtmlLink, L as handleError, M as METADATA_TYPES, N as Resolver, O as isStyleMetadata, R as valueOrError, S as filterStyleMetadata, T as isMarkdownMetadata, U as isJavaScript, V as isDynamic, W as isJsonObject, X as splitHtmlLink, Y as isValidRelativePath, Z as DependencyTracker, _ as mergeMaps, a as clamp, b as printFmtError, c as downloadContent, d as hashContent, f as humanReadableBytes, g as kebabToCamelCase, h as isURL, i as capitalize, j as isWebManifestMetadata, k as isSvgMetadata, l as escapeHtml, m as isObject, n as bytesToKB, o as clearLn, p as isDefined, r as camelCaseToKebabCase, s as cloneObject, t as assign, u as getLineColumn, v as print, w as isHtmlMetadata, x as filterScriptMetadata, y as PrintFormattedError, z as checkFileExists } from "./utilities-jK4uUZBV.mjs";
2
+ import { h as path_exports } from "./common-D1QTZ8ra.mjs";
3
3
 
4
4
  //#region src/index.ts
5
5
  /**
@@ -13,5 +13,5 @@ function defineConfig(config) {
13
13
  }
14
14
 
15
15
  //#endregion
16
- export { DependencyTracker, METADATA_TYPES, PrintFormattedError, Resolver, assign, bytesToKB, camelCaseToKebabCase, capitalize, clamp, clearLn, cloneObject, defineConfig, downloadContent, escapeHtml, filterScriptMetadata, filterStyleMetadata, getLineColumn, handleError, hashContent, humanReadableBytes, isBinaryAssetMetadata, isDefined, isHtmlLink, isHtmlMetadata, isMarkdownMetadata, isObject, isPackageMetadata, isScriptMetadata, isStyleMetadata, isSvgMetadata, isTextAssetMetadata, isURL, isValidRelativePath, isWebManifestMetadata, kebabToCamelCase, mergeMaps, path_exports as path, print, printFmtError, safeReadFile, safeReadFileSync, splitHtmlLink, valueOrError };
16
+ export { DependencyTracker, METADATA_TYPES, PrintFormattedError, Resolver, assign, bytesToKB, camelCaseToKebabCase, capitalize, checkFileExists, checkJsonObject, clamp, clearLn, cloneObject, defineConfig, downloadContent, escapeHtml, filterScriptMetadata, filterStyleMetadata, getLineColumn, handleError, hashContent, humanReadableBytes, isBinaryAssetMetadata, isDefined, isDynamic, isEmptyElement, isHtmlLink, isHtmlMetadata, isJavaScript, isJsonObject, isMarkdownMetadata, isObject, isPackageMetadata, isScriptMetadata, isStyleMetadata, isSvgMetadata, isTextAssetMetadata, isTypeScriptScript, isURL, isValidRelativePath, isWebManifestMetadata, kebabToCamelCase, mergeMaps, path_exports as path, print, printFmtError, safeReadFile, safeReadFileSync, splitHtmlLink, valueOrError };
17
17
  //# sourceMappingURL=index.mjs.map
package/lib/index.mjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":[],"sources":["../src/index.ts"],"sourcesContent":["import type { AppConfig } from \"./types/common.ts\";\n\n/**\n * Types the config file's default export.\n *\n * The config file runs as CommonJS, so it cannot use top-level `await`. Create plugins inside it rather than importing shared\n * instances: only the config file itself is evaluated again when the dev server reloads it.\n */\nexport function defineConfig(config: AppConfig) {\n return config;\n}\n\nexport type * from \"./cli/cli.ts\";\nexport type { App } from \"./main.ts\";\nexport type * from \"./types/common.ts\";\nexport type * from \"./types/metadata.ts\";\nexport type * from \"./types/plugin.ts\";\n\nexport { DependencyTracker } from \"./helpers/dependency-tracker.ts\";\nexport { Resolver } from \"./resolver/resolver.ts\";\nexport { METADATA_TYPES } from \"./types/metadata.ts\";\nexport * from \"./utilities/html-links.ts\";\nexport * from \"./utilities/metadata-utilities.ts\";\nexport * as path from \"./utilities/path.ts\";\nexport * from \"./utilities/print-formatted-error.ts\";\nexport * from \"./utilities/read-file.ts\";\nexport * from \"./utilities/utilities.ts\";\nexport * from \"./utilities/value-or-error.ts\";\n"],"mappings":";;;;;;;;;;AAQA,SAAgB,aAAa,QAAmB;CAC9C,OAAO;AACT"}
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../src/index.ts"],"sourcesContent":["import type { AppConfig } from \"./types/common.ts\";\n\n/**\n * Types the config file's default export.\n *\n * The config file runs as CommonJS, so it cannot use top-level `await`. Create plugins inside it rather than importing shared\n * instances: only the config file itself is evaluated again when the dev server reloads it.\n */\nexport function defineConfig(config: AppConfig) {\n return config;\n}\n\nexport type * from \"./cli/cli.ts\";\nexport type { App } from \"./main.ts\";\nexport type * from \"./types/common.ts\";\nexport type * from \"./types/metadata.ts\";\nexport type * from \"./types/plugin.ts\";\n\nexport { DependencyTracker } from \"./helpers/dependency-tracker.ts\";\nexport * from \"./helpers/lsp-checks.ts\";\nexport { Resolver } from \"./resolver/resolver.ts\";\nexport { METADATA_TYPES } from \"./types/metadata.ts\";\nexport * from \"./utilities/html-links.ts\";\nexport * from \"./utilities/metadata-utilities.ts\";\nexport * as path from \"./utilities/path.ts\";\nexport * from \"./utilities/print-formatted-error.ts\";\nexport * from \"./utilities/read-file.ts\";\nexport * from \"./utilities/utilities.ts\";\nexport * from \"./utilities/value-or-error.ts\";\n"],"mappings":";;;;;;;;;;AAQA,SAAgB,aAAa,QAAmB;CAC9C,OAAO;AACT"}
@@ -1,4 +1,4 @@
1
- import { o as dirname, v as resolve } from "./common-DUFKS3lW.mjs";
1
+ import { o as dirname, v as resolve } from "./common-D1QTZ8ra.mjs";
2
2
  import { Module, createRequire } from "node:module";
3
3
  import { readFileSync } from "node:fs";
4
4
  import { transform } from "esbuild";
@@ -54,4 +54,4 @@ async function compileConfigFile(configPath) {
54
54
 
55
55
  //#endregion
56
56
  export { loadConfigFile as t };
57
- //# sourceMappingURL=load-config-D-FtbUws.mjs.map
57
+ //# sourceMappingURL=load-config-CsbiJ01A.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"load-config-D-FtbUws.mjs","names":[],"sources":["../src/helpers/load-config.ts"],"sourcesContent":["import { readFileSync } from \"node:fs\";\nimport { createRequire, Module } from \"node:module\";\nimport { pathToFileURL } from \"node:url\";\nimport { transform } from \"esbuild\";\n\nimport { dirname, resolve } from \"../utilities/path.ts\";\n\nimport type { ValueOrError } from \"../utilities/value-or-error.ts\";\nimport type { AppConfig } from \"@staticbolt/core\";\n\ninterface ConfigModule extends Module {\n exports: { default?: AppConfig };\n _compile(code: string, filename: string): void;\n}\n\n/**\n * Evaluates the config file afresh every time it is called, so a changed file comes back changed. What the file imports is loaded\n * once and shared. The project root is made absolute against `projectDirectory`, which it falls back to when the config sets\n * none.\n */\nexport async function loadConfigFile(configPath: string, projectDirectory: string): Promise<ValueOrError<AppConfig>> {\n try {\n const config = await evaluateConfigFile(configPath);\n config.root = resolve(projectDirectory, config.root ?? \".\");\n\n return [config, null];\n } catch (error) {\n return [null, error as Error];\n }\n}\n\n/** Compiles the file to CommonJS and runs it as a module of its own, kept out of the module cache so it can be let go of. */\nasync function evaluateConfigFile(configPath: string): Promise<AppConfig> {\n const code = await compileConfigFile(configPath);\n\n const module = new Module(configPath) as ConfigModule;\n module.filename = configPath;\n module.paths = createRequire(configPath).resolve.paths(\"\") ?? [];\n module._compile(code, configPath);\n\n if (!module.exports.default) {\n throw new Error(`Failed to load config file at \"${configPath}\"`);\n }\n\n return module.exports.default;\n}\n\n/** `import.meta.resolve` is kept working through a hoisted helper; the other `import.meta` members become constants. */\nasync function compileConfigFile(configPath: string): Promise<string> {\n try {\n const { code } = await transform(readFileSync(configPath, \"utf8\"), {\n loader: \"ts\",\n format: \"cjs\",\n platform: \"node\",\n target: \"esnext\",\n sourcefile: configPath,\n define: {\n \"import.meta.url\": JSON.stringify(pathToFileURL(configPath).href),\n \"import.meta.filename\": JSON.stringify(configPath),\n \"import.meta.dirname\": JSON.stringify(dirname(configPath)),\n \"import.meta.resolve\": \"__importMetaResolve\",\n },\n });\n\n return (\n code +\n '\\nfunction __importMetaResolve(specifier) { return require(\"node:url\").pathToFileURL(require.resolve(specifier)).href; }\\n'\n );\n } catch (error) {\n const messages = (error as { errors?: { text: string }[] }).errors ?? [];\n if (messages.some(message => message.text.includes(\"Top-level await\"))) {\n throw new Error(`\"${configPath}\" uses top-level await, which the config file does not support`, { cause: error });\n }\n\n throw error;\n }\n}\n"],"mappings":";;;;;;;;;;;;AAoBA,eAAsB,eAAe,YAAoB,kBAA4D;CACnH,IAAI;EACF,MAAM,SAAS,MAAM,mBAAmB,UAAU;EAClD,OAAO,OAAO,QAAQ,kBAAkB,OAAO,QAAQ,GAAG;EAE1D,OAAO,CAAC,QAAQ,IAAI;CACtB,SAAS,OAAO;EACd,OAAO,CAAC,MAAM,KAAc;CAC9B;AACF;;AAGA,eAAe,mBAAmB,YAAwC;CACxE,MAAM,OAAO,MAAM,kBAAkB,UAAU;CAE/C,MAAM,SAAS,IAAI,OAAO,UAAU;CACpC,OAAO,WAAW;CAClB,OAAO,QAAQ,cAAc,UAAU,CAAC,CAAC,QAAQ,MAAM,EAAE,KAAK,CAAC;CAC/D,OAAO,SAAS,MAAM,UAAU;CAEhC,IAAI,CAAC,OAAO,QAAQ,SAClB,MAAM,IAAI,MAAM,kCAAkC,WAAW,EAAE;CAGjE,OAAO,OAAO,QAAQ;AACxB;;AAGA,eAAe,kBAAkB,YAAqC;CACpE,IAAI;EACF,MAAM,EAAE,SAAS,MAAM,UAAU,aAAa,YAAY,MAAM,GAAG;GACjE,QAAQ;GACR,QAAQ;GACR,UAAU;GACV,QAAQ;GACR,YAAY;GACZ,QAAQ;IACN,mBAAmB,KAAK,UAAU,cAAc,UAAU,CAAC,CAAC,IAAI;IAChE,wBAAwB,KAAK,UAAU,UAAU;IACjD,uBAAuB,KAAK,UAAU,QAAQ,UAAU,CAAC;IACzD,uBAAuB;GACzB;EACF,CAAC;EAED,OACE,OACA;CAEJ,SAAS,OAAO;EAEd,KADkB,MAA0C,UAAU,CAAC,EAC3D,CAAC,MAAK,YAAW,QAAQ,KAAK,SAAS,iBAAiB,CAAC,GACnE,MAAM,IAAI,MAAM,IAAI,WAAW,iEAAiE,EAAE,OAAO,MAAM,CAAC;EAGlH,MAAM;CACR;AACF"}
1
+ {"version":3,"file":"load-config-CsbiJ01A.mjs","names":[],"sources":["../src/helpers/load-config.ts"],"sourcesContent":["import { readFileSync } from \"node:fs\";\nimport { createRequire, Module } from \"node:module\";\nimport { pathToFileURL } from \"node:url\";\nimport { transform } from \"esbuild\";\n\nimport { dirname, resolve } from \"../utilities/path.ts\";\n\nimport type { ValueOrError } from \"../utilities/value-or-error.ts\";\nimport type { AppConfig } from \"@staticbolt/core\";\n\ninterface ConfigModule extends Module {\n exports: { default?: AppConfig };\n _compile(code: string, filename: string): void;\n}\n\n/**\n * Evaluates the config file afresh every time it is called, so a changed file comes back changed. What the file imports is loaded\n * once and shared. The project root is made absolute against `projectDirectory`, which it falls back to when the config sets\n * none.\n */\nexport async function loadConfigFile(configPath: string, projectDirectory: string): Promise<ValueOrError<AppConfig>> {\n try {\n const config = await evaluateConfigFile(configPath);\n config.root = resolve(projectDirectory, config.root ?? \".\");\n\n return [config, null];\n } catch (error) {\n return [null, error as Error];\n }\n}\n\n/** Compiles the file to CommonJS and runs it as a module of its own, kept out of the module cache so it can be let go of. */\nasync function evaluateConfigFile(configPath: string): Promise<AppConfig> {\n const code = await compileConfigFile(configPath);\n\n const module = new Module(configPath) as ConfigModule;\n module.filename = configPath;\n module.paths = createRequire(configPath).resolve.paths(\"\") ?? [];\n module._compile(code, configPath);\n\n if (!module.exports.default) {\n throw new Error(`Failed to load config file at \"${configPath}\"`);\n }\n\n return module.exports.default;\n}\n\n/** `import.meta.resolve` is kept working through a hoisted helper; the other `import.meta` members become constants. */\nasync function compileConfigFile(configPath: string): Promise<string> {\n try {\n const { code } = await transform(readFileSync(configPath, \"utf8\"), {\n loader: \"ts\",\n format: \"cjs\",\n platform: \"node\",\n target: \"esnext\",\n sourcefile: configPath,\n define: {\n \"import.meta.url\": JSON.stringify(pathToFileURL(configPath).href),\n \"import.meta.filename\": JSON.stringify(configPath),\n \"import.meta.dirname\": JSON.stringify(dirname(configPath)),\n \"import.meta.resolve\": \"__importMetaResolve\",\n },\n });\n\n return (\n code +\n '\\nfunction __importMetaResolve(specifier) { return require(\"node:url\").pathToFileURL(require.resolve(specifier)).href; }\\n'\n );\n } catch (error) {\n const messages = (error as { errors?: { text: string }[] }).errors ?? [];\n if (messages.some(message => message.text.includes(\"Top-level await\"))) {\n throw new Error(`\"${configPath}\" uses top-level await, which the config file does not support`, { cause: error });\n }\n\n throw error;\n }\n}\n"],"mappings":";;;;;;;;;;;;AAoBA,eAAsB,eAAe,YAAoB,kBAA4D;CACnH,IAAI;EACF,MAAM,SAAS,MAAM,mBAAmB,UAAU;EAClD,OAAO,OAAO,QAAQ,kBAAkB,OAAO,QAAQ,GAAG;EAE1D,OAAO,CAAC,QAAQ,IAAI;CACtB,SAAS,OAAO;EACd,OAAO,CAAC,MAAM,KAAc;CAC9B;AACF;;AAGA,eAAe,mBAAmB,YAAwC;CACxE,MAAM,OAAO,MAAM,kBAAkB,UAAU;CAE/C,MAAM,SAAS,IAAI,OAAO,UAAU;CACpC,OAAO,WAAW;CAClB,OAAO,QAAQ,cAAc,UAAU,CAAC,CAAC,QAAQ,MAAM,EAAE,KAAK,CAAC;CAC/D,OAAO,SAAS,MAAM,UAAU;CAEhC,IAAI,CAAC,OAAO,QAAQ,SAClB,MAAM,IAAI,MAAM,kCAAkC,WAAW,EAAE;CAGjE,OAAO,OAAO,QAAQ;AACxB;;AAGA,eAAe,kBAAkB,YAAqC;CACpE,IAAI;EACF,MAAM,EAAE,SAAS,MAAM,UAAU,aAAa,YAAY,MAAM,GAAG;GACjE,QAAQ;GACR,QAAQ;GACR,UAAU;GACV,QAAQ;GACR,YAAY;GACZ,QAAQ;IACN,mBAAmB,KAAK,UAAU,cAAc,UAAU,CAAC,CAAC,IAAI;IAChE,wBAAwB,KAAK,UAAU,UAAU;IACjD,uBAAuB,KAAK,UAAU,QAAQ,UAAU,CAAC;IACzD,uBAAuB;GACzB;EACF,CAAC;EAED,OACE,OACA;CAEJ,SAAS,OAAO;EAEd,KADkB,MAA0C,UAAU,CAAC,EAC3D,CAAC,MAAK,YAAW,QAAQ,KAAK,SAAS,iBAAiB,CAAC,GACnE,MAAM,IAAI,MAAM,IAAI,WAAW,iEAAiE,EAAE,OAAO,MAAM,CAAC;EAGlH,MAAM;CACR;AACF"}