@staticbolt/core 1.0.0-beta.29 → 1.0.0-beta.30
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/lib/cli/index.mjs +45 -38
- package/lib/cli/index.mjs.map +1 -1
- package/lib/index.d.mts +91 -5
- package/lib/index.d.mts.map +1 -1
- package/lib/index.mjs +6 -0
- package/lib/index.mjs.map +1 -1
- package/lib/load-config-D-FtbUws.mjs +57 -0
- package/lib/load-config-D-FtbUws.mjs.map +1 -0
- package/lib/plugins/index.d.mts +6 -1
- package/lib/plugins/index.d.mts.map +1 -1
- package/lib/plugins/index.mjs +308 -134
- package/lib/plugins/index.mjs.map +1 -1
- package/package.json +4 -3
package/lib/cli/index.mjs
CHANGED
|
@@ -1,21 +1,9 @@
|
|
|
1
|
-
#!/usr/bin/env
|
|
1
|
+
#!/usr/bin/env node
|
|
2
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";
|
|
3
4
|
import * as z from "zod";
|
|
4
|
-
import { parseArgs } from "node:util";
|
|
5
5
|
import { coerce, defineArguments, defineCLI, defineOptions, defineSubcommand } from "@staticbolt/args-parser";
|
|
6
6
|
|
|
7
|
-
//#region src/helpers/load-config.ts
|
|
8
|
-
async function loadConfigFile(configPath) {
|
|
9
|
-
try {
|
|
10
|
-
const loadedConfig = await import(configPath + `?update=${Date.now()}`);
|
|
11
|
-
if (!loadedConfig.default) return [null, /* @__PURE__ */ new Error(`Failed to load config file at "${configPath}"`)];
|
|
12
|
-
return [loadedConfig.default, null];
|
|
13
|
-
} catch (error) {
|
|
14
|
-
return [null, error];
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
//#endregion
|
|
19
7
|
//#region src/cli/commands/help.ts
|
|
20
8
|
const helpCommand = defineSubcommand({
|
|
21
9
|
name: "help",
|
|
@@ -49,6 +37,20 @@ var CliProgram = class CliProgram {
|
|
|
49
37
|
example: "staticbolt build \nstaticbolt serve"
|
|
50
38
|
},
|
|
51
39
|
options: {
|
|
40
|
+
cwd: {
|
|
41
|
+
schema: z.string().optional(),
|
|
42
|
+
meta: {
|
|
43
|
+
placeholder: "<directory>",
|
|
44
|
+
description: "The directory to run in. Works with every command."
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
config: {
|
|
48
|
+
schema: z.string().optional(),
|
|
49
|
+
meta: {
|
|
50
|
+
placeholder: "<path>",
|
|
51
|
+
description: `The config file, relative to the directory. Works with every command. Defaults to "${CONFIG_FILE_NAME}".`
|
|
52
|
+
}
|
|
53
|
+
},
|
|
52
54
|
help: {
|
|
53
55
|
aliases: ["h"],
|
|
54
56
|
schema: z.boolean().optional(),
|
|
@@ -77,19 +79,19 @@ var CliProgram = class CliProgram {
|
|
|
77
79
|
console.log("v0.0.0");
|
|
78
80
|
return;
|
|
79
81
|
}
|
|
80
|
-
console.error("No arguments provided. Use `
|
|
82
|
+
console.error("No arguments provided. Use `staticbolt --help` for more information");
|
|
81
83
|
});
|
|
82
84
|
}
|
|
83
|
-
async initializePlugins(config, configPath) {
|
|
85
|
+
async initializePlugins(config, configPath, projectDirectory) {
|
|
84
86
|
const plugins = config.plugins ?? [];
|
|
85
87
|
for (const pluginOrPlugins of plugins) {
|
|
86
88
|
const pluginsAsArray = Array.isArray(pluginOrPlugins) ? pluginOrPlugins : [pluginOrPlugins];
|
|
87
|
-
for (const plugin of pluginsAsArray) if (plugin.cli) await plugin.cli.call(this, config, configPath);
|
|
89
|
+
for (const plugin of pluginsAsArray) if (plugin.cli) await plugin.cli.call(this, config, configPath, projectDirectory);
|
|
88
90
|
}
|
|
89
91
|
}
|
|
90
|
-
static async init(config, configPath) {
|
|
92
|
+
static async init(config, configPath, projectDirectory) {
|
|
91
93
|
const cliProgram = new CliProgram();
|
|
92
|
-
await cliProgram.initializePlugins(config, configPath);
|
|
94
|
+
await cliProgram.initializePlugins(config, configPath, projectDirectory);
|
|
93
95
|
return cliProgram;
|
|
94
96
|
}
|
|
95
97
|
run(cliArguments) {
|
|
@@ -149,32 +151,37 @@ var CliProgram = class CliProgram {
|
|
|
149
151
|
|
|
150
152
|
//#endregion
|
|
151
153
|
//#region src/cli/index.ts
|
|
152
|
-
const
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
allowPositionals: true,
|
|
158
|
-
strict: false
|
|
159
|
-
});
|
|
160
|
-
const inputCwd = values.cwd ?? process.cwd();
|
|
161
|
-
const inputConfigPath = values.config ?? ".staticbolt.ts";
|
|
162
|
-
const projectDirectory = resolve(inputCwd);
|
|
163
|
-
const configPath = isAbsolute(inputConfigPath) ? inputConfigPath : join(projectDirectory, inputConfigPath);
|
|
164
|
-
const [loadedConfig, configError] = await loadConfigFile(configPath);
|
|
154
|
+
const cliArguments = process.argv.slice(2);
|
|
155
|
+
const projectDirectory = resolve(takeOption(cliArguments, "cwd") ?? process.cwd());
|
|
156
|
+
const configFile = takeOption(cliArguments, "config") ?? ".staticbolt.ts";
|
|
157
|
+
const configPath = isAbsolute(configFile) ? configFile : join(projectDirectory, configFile);
|
|
158
|
+
const [config, configError] = await loadConfigFile(configPath, projectDirectory);
|
|
165
159
|
if (configError) {
|
|
166
|
-
Log.
|
|
160
|
+
Log.error(`Failed to load config file at "${configPath}"`);
|
|
167
161
|
throw configError;
|
|
168
162
|
}
|
|
169
|
-
const
|
|
170
|
-
if (config.root && !isAbsolute(config.root)) config.root = join(projectDirectory, config.root);
|
|
171
|
-
if (!config.root) config.root = projectDirectory;
|
|
172
|
-
const results = (await CliProgram.init(config, configPath)).run(process.argv.slice(2));
|
|
163
|
+
const results = (await CliProgram.init(config, configPath, projectDirectory)).run(cliArguments);
|
|
173
164
|
if (results.error) {
|
|
174
165
|
console.error(results.error.message);
|
|
175
|
-
console.log("\n`
|
|
166
|
+
console.log("\n`staticbolt --help` for more information, or `staticbolt help <command>` for command-specific help\n");
|
|
176
167
|
process.exit(1);
|
|
177
168
|
}
|
|
169
|
+
/** Removes every `--name value` or `--name=value` from the arguments and returns the last value. */
|
|
170
|
+
function takeOption(cliArguments, name) {
|
|
171
|
+
const flag = `--${name}`;
|
|
172
|
+
const findFlag = () => cliArguments.findIndex((argument) => argument === flag || argument.startsWith(`${flag}=`));
|
|
173
|
+
let value;
|
|
174
|
+
for (let index = findFlag(); index !== -1; index = findFlag()) {
|
|
175
|
+
const isInlineValue = cliArguments[index] !== flag;
|
|
176
|
+
value = isInlineValue ? cliArguments[index].slice(flag.length + 1) : cliArguments[index + 1];
|
|
177
|
+
if (!value || !isInlineValue && value.startsWith("-")) {
|
|
178
|
+
console.error(`Option ${flag} requires a value`);
|
|
179
|
+
process.exit(1);
|
|
180
|
+
}
|
|
181
|
+
cliArguments.splice(index, isInlineValue ? 1 : 2);
|
|
182
|
+
}
|
|
183
|
+
return value;
|
|
184
|
+
}
|
|
178
185
|
|
|
179
186
|
//#endregion
|
|
180
187
|
export { };
|
package/lib/cli/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":["#programWideType"],"sources":["../../src/helpers/load-config.ts","../../src/cli/commands/help.ts","../../src/cli/cli.ts","../../src/cli/index.ts"],"sourcesContent":["import type { ValueOrError } from \"../utilities/value-or-error.ts\";\nimport type { AppConfig } from \"@staticbolt/core\";\n\nexport async function loadConfigFile(configPath: string): Promise<ValueOrError<AppConfig>> {\n try {\n const loadedConfig = (await import(configPath + `?update=${Date.now()}`)) as { default: AppConfig };\n if (!loadedConfig.default) {\n return [null, new Error(`Failed to load config file at \"${configPath}\"`)];\n }\n\n return [loadedConfig.default, null];\n } catch (error) {\n return [null, error as Error];\n }\n}\n","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 { 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 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 `static --help` for more information\");\n });\n }\n\n async initializePlugins(config: AppConfig, configPath: string) {\n const plugins = config.plugins ?? [];\n\n for (const pluginOrPlugins of plugins) {\n const pluginsAsArray = Array.isArray(pluginOrPlugins) ? pluginOrPlugins : [pluginOrPlugins];\n for (const plugin of pluginsAsArray) {\n if (plugin.cli) {\n await plugin.cli.call(this, config, configPath);\n }\n }\n }\n }\n\n static async init(config: AppConfig, configPath: string) {\n const cliProgram = new CliProgram();\n await cliProgram.initializePlugins(config, configPath);\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 -S node --experimental-vm-modules --no-warnings\nimport { parseArgs } from \"node:util\";\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\nconst { values } = parseArgs({\n options: {\n cwd: {\n type: \"string\",\n },\n config: {\n type: \"string\",\n },\n },\n allowPositionals: true,\n strict: false,\n});\n\nconst inputCwd: string = (values.cwd ?? process.cwd()) as string;\nconst inputConfigPath: string = (values.config ?? CONFIG_FILE_NAME) as string;\n\nconst projectDirectory = resolve(inputCwd);\nconst configPath = isAbsolute(inputConfigPath) ? inputConfigPath : join(projectDirectory, inputConfigPath);\n\nconst [loadedConfig, configError] = await loadConfigFile(configPath);\nif (configError) {\n Log.warn(`Failed to load config file at \"${configPath}\"`);\n throw configError;\n}\n\nconst config = loadedConfig ?? {};\n\nif (config.root && !isAbsolute(config.root)) {\n config.root = join(projectDirectory, config.root);\n}\n\nif (!config.root) {\n config.root = projectDirectory;\n}\n\nconst cli = await CliProgram.init(config, configPath);\nconst results = cli.run(process.argv.slice(2));\n\nif (results.error) {\n console.error(results.error.message);\n console.log(\"\\n`static --help` for more information, or `static help <command>` for command-specific help\\n\");\n process.exit(1);\n}\n"],"mappings":";;;;;;;AAGA,eAAsB,eAAe,YAAsD;CACzF,IAAI;EACF,MAAM,eAAgB,MAAM,OAAO,aAAa,WAAW,KAAK,IAAI;EACpE,IAAI,CAAC,aAAa,SAChB,OAAO,CAAC,sBAAM,IAAI,MAAM,kCAAkC,WAAW,EAAE,CAAC;EAG1E,OAAO,CAAC,aAAa,SAAS,IAAI;CACpC,SAAS,OAAO;EACd,OAAO,CAAC,MAAM,KAAc;CAC9B;AACF;;;;ACXA,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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EAEA,IAAI,CAAC,QAAQ,WAAW;GACtB,QAAQ,YAAY;GACpB;EACF;EAEA,OAAO,OAAO,OAAO,QAAQ,WAAW,YAAY;CACtD;AACF;;;;ACzIA,MAAM,EAAE,WAAW,UAAU;CAC3B,SAAS;EACP,KAAK,EACH,MAAM,SACR;EACA,QAAQ,EACN,MAAM,SACR;CACF;CACA,kBAAkB;CAClB,QAAQ;AACV,CAAC;AAED,MAAM,WAAoB,OAAO,OAAO,QAAQ,IAAI;AACpD,MAAM,kBAA2B,OAAO;AAExC,MAAM,mBAAmB,QAAQ,QAAQ;AACzC,MAAM,aAAa,WAAW,eAAe,IAAI,kBAAkB,KAAK,kBAAkB,eAAe;AAEzG,MAAM,CAAC,cAAc,eAAe,MAAM,eAAe,UAAU;AACnE,IAAI,aAAa;CACf,IAAI,KAAK,kCAAkC,WAAW,EAAE;CACxD,MAAM;AACR;AAEA,MAAM,SAAS,gBAAgB,CAAC;AAEhC,IAAI,OAAO,QAAQ,CAAC,WAAW,OAAO,IAAI,GACxC,OAAO,OAAO,KAAK,kBAAkB,OAAO,IAAI;AAGlD,IAAI,CAAC,OAAO,MACV,OAAO,OAAO;AAIhB,MAAM,WAAU,MADE,WAAW,KAAK,QAAQ,UAAU,EACjC,CAAC,IAAI,QAAQ,KAAK,MAAM,CAAC,CAAC;AAE7C,IAAI,QAAQ,OAAO;CACjB,QAAQ,MAAM,QAAQ,MAAM,OAAO;CACnC,QAAQ,IAAI,gGAAgG;CAC5G,QAAQ,KAAK,CAAC;AAChB"}
|
|
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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,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"}
|
package/lib/index.d.mts
CHANGED
|
@@ -1115,6 +1115,20 @@ declare class CliProgram {
|
|
|
1115
1115
|
example: string;
|
|
1116
1116
|
};
|
|
1117
1117
|
options: {
|
|
1118
|
+
cwd: {
|
|
1119
|
+
schema: z.ZodOptional<z.ZodString>;
|
|
1120
|
+
meta: {
|
|
1121
|
+
placeholder: string;
|
|
1122
|
+
description: string;
|
|
1123
|
+
};
|
|
1124
|
+
};
|
|
1125
|
+
config: {
|
|
1126
|
+
schema: z.ZodOptional<z.ZodString>;
|
|
1127
|
+
meta: {
|
|
1128
|
+
placeholder: string;
|
|
1129
|
+
description: string;
|
|
1130
|
+
};
|
|
1131
|
+
};
|
|
1118
1132
|
help: {
|
|
1119
1133
|
aliases: string[];
|
|
1120
1134
|
schema: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -1141,6 +1155,8 @@ declare class CliProgram {
|
|
|
1141
1155
|
onExecute: (handler: (data: {
|
|
1142
1156
|
subcommand: undefined;
|
|
1143
1157
|
options: {
|
|
1158
|
+
cwd?: string | undefined;
|
|
1159
|
+
config?: string | undefined;
|
|
1144
1160
|
help?: boolean | undefined;
|
|
1145
1161
|
version?: boolean | undefined;
|
|
1146
1162
|
};
|
|
@@ -1149,6 +1165,8 @@ declare class CliProgram {
|
|
|
1149
1165
|
context: {
|
|
1150
1166
|
subcommand: undefined;
|
|
1151
1167
|
options: {
|
|
1168
|
+
cwd: import("@staticbolt/args-parser").OptionContext<z.ZodOptional<z.ZodString>>;
|
|
1169
|
+
config: import("@staticbolt/args-parser").OptionContext<z.ZodOptional<z.ZodString>>;
|
|
1152
1170
|
help: import("@staticbolt/args-parser").OptionContext<z.ZodOptional<z.ZodBoolean>>;
|
|
1153
1171
|
version: import("@staticbolt/args-parser").OptionContext<z.ZodOptional<z.ZodBoolean>>;
|
|
1154
1172
|
};
|
|
@@ -1158,6 +1176,8 @@ declare class CliProgram {
|
|
|
1158
1176
|
}) => void) => () => void;
|
|
1159
1177
|
execute: (input?: {
|
|
1160
1178
|
options?: {
|
|
1179
|
+
cwd?: string | undefined;
|
|
1180
|
+
config?: string | undefined;
|
|
1161
1181
|
help?: boolean | undefined;
|
|
1162
1182
|
version?: boolean | undefined;
|
|
1163
1183
|
} | undefined;
|
|
@@ -1166,6 +1186,8 @@ declare class CliProgram {
|
|
|
1166
1186
|
} | undefined) => void;
|
|
1167
1187
|
executeAsync: (input?: {
|
|
1168
1188
|
options?: {
|
|
1189
|
+
cwd?: string | undefined;
|
|
1190
|
+
config?: string | undefined;
|
|
1169
1191
|
help?: boolean | undefined;
|
|
1170
1192
|
version?: boolean | undefined;
|
|
1171
1193
|
} | undefined;
|
|
@@ -1181,6 +1203,20 @@ declare class CliProgram {
|
|
|
1181
1203
|
example: string;
|
|
1182
1204
|
};
|
|
1183
1205
|
options: {
|
|
1206
|
+
cwd: {
|
|
1207
|
+
schema: z.ZodOptional<z.ZodString>;
|
|
1208
|
+
meta: {
|
|
1209
|
+
placeholder: string;
|
|
1210
|
+
description: string;
|
|
1211
|
+
};
|
|
1212
|
+
};
|
|
1213
|
+
config: {
|
|
1214
|
+
schema: z.ZodOptional<z.ZodString>;
|
|
1215
|
+
meta: {
|
|
1216
|
+
placeholder: string;
|
|
1217
|
+
description: string;
|
|
1218
|
+
};
|
|
1219
|
+
};
|
|
1184
1220
|
help: {
|
|
1185
1221
|
aliases: string[];
|
|
1186
1222
|
schema: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -1212,6 +1248,20 @@ declare class CliProgram {
|
|
|
1212
1248
|
example: string;
|
|
1213
1249
|
};
|
|
1214
1250
|
options: {
|
|
1251
|
+
cwd: {
|
|
1252
|
+
schema: z.ZodOptional<z.ZodString>;
|
|
1253
|
+
meta: {
|
|
1254
|
+
placeholder: string;
|
|
1255
|
+
description: string;
|
|
1256
|
+
};
|
|
1257
|
+
};
|
|
1258
|
+
config: {
|
|
1259
|
+
schema: z.ZodOptional<z.ZodString>;
|
|
1260
|
+
meta: {
|
|
1261
|
+
placeholder: string;
|
|
1262
|
+
description: string;
|
|
1263
|
+
};
|
|
1264
|
+
};
|
|
1215
1265
|
help: {
|
|
1216
1266
|
aliases: string[];
|
|
1217
1267
|
schema: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -1238,8 +1288,8 @@ declare class CliProgram {
|
|
|
1238
1288
|
}>>;
|
|
1239
1289
|
};
|
|
1240
1290
|
constructor();
|
|
1241
|
-
initializePlugins(config: AppConfig$1, configPath: string): Promise<void>;
|
|
1242
|
-
static init(config: AppConfig$1, configPath: string): Promise<CliProgram>;
|
|
1291
|
+
initializePlugins(config: AppConfig$1, configPath: string, projectDirectory: string): Promise<void>;
|
|
1292
|
+
static init(config: AppConfig$1, configPath: string, projectDirectory: string): Promise<CliProgram>;
|
|
1243
1293
|
run(cliArguments: string[]): import("@staticbolt/args-parser").CliParseResult<{
|
|
1244
1294
|
cliName: "staticbolt";
|
|
1245
1295
|
meta: {
|
|
@@ -1247,6 +1297,20 @@ declare class CliProgram {
|
|
|
1247
1297
|
example: string;
|
|
1248
1298
|
};
|
|
1249
1299
|
options: {
|
|
1300
|
+
cwd: {
|
|
1301
|
+
schema: z.ZodOptional<z.ZodString>;
|
|
1302
|
+
meta: {
|
|
1303
|
+
placeholder: string;
|
|
1304
|
+
description: string;
|
|
1305
|
+
};
|
|
1306
|
+
};
|
|
1307
|
+
config: {
|
|
1308
|
+
schema: z.ZodOptional<z.ZodString>;
|
|
1309
|
+
meta: {
|
|
1310
|
+
placeholder: string;
|
|
1311
|
+
description: string;
|
|
1312
|
+
};
|
|
1313
|
+
};
|
|
1250
1314
|
help: {
|
|
1251
1315
|
aliases: string[];
|
|
1252
1316
|
schema: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -1370,9 +1434,10 @@ declare class App {
|
|
|
1370
1434
|
readonly pluginData: Record<string, unknown>;
|
|
1371
1435
|
/** Exclude paths from being emitted. */
|
|
1372
1436
|
readonly emitExclude: Set<MetadataBase$1>;
|
|
1373
|
-
/** Chokidar watcher. */
|
|
1374
|
-
|
|
1437
|
+
/** Chokidar watcher. Development only, and gone once the app is closed. */
|
|
1438
|
+
watcher: FSWatcher | undefined;
|
|
1375
1439
|
private isPluginInitialized;
|
|
1440
|
+
private isClosed;
|
|
1376
1441
|
private measureExecutionTime;
|
|
1377
1442
|
private executionTime;
|
|
1378
1443
|
/** How long the hooks called from inside the hook currently being measured took. Held in an object so plugin contexts share it. */
|
|
@@ -1380,10 +1445,16 @@ declare class App {
|
|
|
1380
1445
|
readonly pluginIndex: number;
|
|
1381
1446
|
readonly pluginName: string;
|
|
1382
1447
|
constructor(options: AppConfig$1 | undefined, configPath: string);
|
|
1448
|
+
/** Binds a copy of the plugin's hooks to this app, leaving the user's object untouched. */
|
|
1383
1449
|
private bindPlugin;
|
|
1384
1450
|
private callPluginMethod;
|
|
1385
1451
|
private emitFileChange;
|
|
1386
1452
|
run(): Promise<void>;
|
|
1453
|
+
/**
|
|
1454
|
+
* Stops watching and lets every plugin release what its `setup` took, in reverse order. A teardown that throws is reported and
|
|
1455
|
+
* the rest still run. Closing again does nothing.
|
|
1456
|
+
*/
|
|
1457
|
+
close(): Promise<void>;
|
|
1387
1458
|
process(id: string): Promise<boolean>;
|
|
1388
1459
|
resolve(metadata: MetadataBase$1): Promise<Set<string>>;
|
|
1389
1460
|
/**
|
|
@@ -1615,6 +1686,11 @@ interface StringifyOptions {
|
|
|
1615
1686
|
interface Plugin {
|
|
1616
1687
|
name: string;
|
|
1617
1688
|
setup?: (this: App$1) => void | Promise<void>;
|
|
1689
|
+
/**
|
|
1690
|
+
* Runs when the app is closed, in reverse plugin order. Release whatever `setup` took hold of (servers, watchers, workers). May
|
|
1691
|
+
* run after a `setup` that never finished, so expect to find nothing to release.
|
|
1692
|
+
*/
|
|
1693
|
+
teardown?: (this: App$1) => void | Promise<void>;
|
|
1618
1694
|
read?: (this: App$1, absolutePath: string) => string | void | Promise<string | void>;
|
|
1619
1695
|
load?: (this: App$1, content: string, relativePath: string, options: {
|
|
1620
1696
|
type?: string;
|
|
@@ -1636,7 +1712,11 @@ interface Plugin {
|
|
|
1636
1712
|
resolveRequestPath?: (this: App$1, requestPath: string) => string | void | Promise<string | void>;
|
|
1637
1713
|
onFileEvent?: (this: App$1, event: "change" | "add" | "unlink", filePath: string) => void | Promise<void>;
|
|
1638
1714
|
resolveCompileList?: (this: App$1, compileSet: Set<string>, event: "change" | "add" | "unlink", filePath: string) => void | Promise<void>;
|
|
1639
|
-
|
|
1715
|
+
/**
|
|
1716
|
+
* Registers commands on the CLI. `config` has already been loaded from `configPath`, with its root made absolute against
|
|
1717
|
+
* `projectDirectory` — the directory the CLI was pointed at.
|
|
1718
|
+
*/
|
|
1719
|
+
cli?: (this: CliProgram$1, config: AppConfig$1, configPath: string, projectDirectory: string) => void | Promise<void>;
|
|
1640
1720
|
lspHtmlData?: () => HTMLDataV1 | undefined | Promise<HTMLDataV1 | undefined>;
|
|
1641
1721
|
}
|
|
1642
1722
|
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]; }>;
|
|
@@ -1867,6 +1947,12 @@ declare function hashContent(content: string): string;
|
|
|
1867
1947
|
declare function escapeHtml(input: string): string;
|
|
1868
1948
|
//#endregion
|
|
1869
1949
|
//#region src/index.d.ts
|
|
1950
|
+
/**
|
|
1951
|
+
* Types the config file's default export.
|
|
1952
|
+
*
|
|
1953
|
+
* The config file runs as CommonJS, so it cannot use top-level `await`. Create plugins inside it rather than importing shared
|
|
1954
|
+
* instances: only the config file itself is evaluated again when the dev server reloads it.
|
|
1955
|
+
*/
|
|
1870
1956
|
declare function defineConfig(config: AppConfig): AppConfig;
|
|
1871
1957
|
//#endregion
|
|
1872
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 };
|
package/lib/index.d.mts.map
CHANGED
|
@@ -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;;;;;;;;;;;;;;;;;;;;UAqB9B;EACb,YAAY;EACZ,OA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,OAAO;;;;;UAMM,iBAAiB;;;;UAKjB,sBAAsB;;;;EAInC;;;;EAIA,OAAO;;;;;UAMM,0BAA0B;;;;UAK1B,aAAa;;;;EAI1B;;;;EAIA,OAAO;;;;;UAMM,iBAAiB;;;KCnlCtB,WAAW;KACX,aAAa,QAAQ;UAGhB;EACf,MAAM;EACN,aAAa;EACb,UAAU;;cAGC,mBAAiB;;EAAA;;cAKjB;UAEI;;;;;;EAMf;;EAGA,WAAW,aAAW;;;;;;EAOtB;;;;;;EAOA;;;;;;;;EASA;;;;;;EAOA;;;;;;;;;;EAWA,UAAU;;;;
|
|
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;;;;;;;;;;;;;;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KV,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
|
@@ -2,6 +2,12 @@ import { A as isTextAssetMetadata, B as isHtmlLink, C as isBinaryAssetMetadata,
|
|
|
2
2
|
import { h as path_exports } from "./common-DUFKS3lW.mjs";
|
|
3
3
|
|
|
4
4
|
//#region src/index.ts
|
|
5
|
+
/**
|
|
6
|
+
* Types the config file's default export.
|
|
7
|
+
*
|
|
8
|
+
* The config file runs as CommonJS, so it cannot use top-level `await`. Create plugins inside it rather than importing shared
|
|
9
|
+
* instances: only the config file itself is evaluated again when the dev server reloads it.
|
|
10
|
+
*/
|
|
5
11
|
function defineConfig(config) {
|
|
6
12
|
return config;
|
|
7
13
|
}
|
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\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":"
|
|
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"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { o as dirname, v as resolve } from "./common-DUFKS3lW.mjs";
|
|
2
|
+
import { Module, createRequire } from "node:module";
|
|
3
|
+
import { readFileSync } from "node:fs";
|
|
4
|
+
import { transform } from "esbuild";
|
|
5
|
+
import { pathToFileURL } from "node:url";
|
|
6
|
+
|
|
7
|
+
//#region src/helpers/load-config.ts
|
|
8
|
+
/**
|
|
9
|
+
* Evaluates the config file afresh every time it is called, so a changed file comes back changed. What the file imports is loaded
|
|
10
|
+
* once and shared. The project root is made absolute against `projectDirectory`, which it falls back to when the config sets
|
|
11
|
+
* none.
|
|
12
|
+
*/
|
|
13
|
+
async function loadConfigFile(configPath, projectDirectory) {
|
|
14
|
+
try {
|
|
15
|
+
const config = await evaluateConfigFile(configPath);
|
|
16
|
+
config.root = resolve(projectDirectory, config.root ?? ".");
|
|
17
|
+
return [config, null];
|
|
18
|
+
} catch (error) {
|
|
19
|
+
return [null, error];
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
/** 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. */
|
|
23
|
+
async function evaluateConfigFile(configPath) {
|
|
24
|
+
const code = await compileConfigFile(configPath);
|
|
25
|
+
const module = new Module(configPath);
|
|
26
|
+
module.filename = configPath;
|
|
27
|
+
module.paths = createRequire(configPath).resolve.paths("") ?? [];
|
|
28
|
+
module._compile(code, configPath);
|
|
29
|
+
if (!module.exports.default) throw new Error(`Failed to load config file at "${configPath}"`);
|
|
30
|
+
return module.exports.default;
|
|
31
|
+
}
|
|
32
|
+
/** `import.meta.resolve` is kept working through a hoisted helper; the other `import.meta` members become constants. */
|
|
33
|
+
async function compileConfigFile(configPath) {
|
|
34
|
+
try {
|
|
35
|
+
const { code } = await transform(readFileSync(configPath, "utf8"), {
|
|
36
|
+
loader: "ts",
|
|
37
|
+
format: "cjs",
|
|
38
|
+
platform: "node",
|
|
39
|
+
target: "esnext",
|
|
40
|
+
sourcefile: configPath,
|
|
41
|
+
define: {
|
|
42
|
+
"import.meta.url": JSON.stringify(pathToFileURL(configPath).href),
|
|
43
|
+
"import.meta.filename": JSON.stringify(configPath),
|
|
44
|
+
"import.meta.dirname": JSON.stringify(dirname(configPath)),
|
|
45
|
+
"import.meta.resolve": "__importMetaResolve"
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
return code + "\nfunction __importMetaResolve(specifier) { return require(\"node:url\").pathToFileURL(require.resolve(specifier)).href; }\n";
|
|
49
|
+
} catch (error) {
|
|
50
|
+
if ((error.errors ?? []).some((message) => message.text.includes("Top-level await"))) throw new Error(`"${configPath}" uses top-level await, which the config file does not support`, { cause: error });
|
|
51
|
+
throw error;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
//#endregion
|
|
56
|
+
export { loadConfigFile as t };
|
|
57
|
+
//# sourceMappingURL=load-config-D-FtbUws.mjs.map
|
|
@@ -0,0 +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"}
|
package/lib/plugins/index.d.mts
CHANGED
|
@@ -855,7 +855,6 @@ interface HtmlBuildTimeScriptOptions {
|
|
|
855
855
|
*
|
|
856
856
|
* Notes:
|
|
857
857
|
*
|
|
858
|
-
* - Requires Node started with "--experimental-vm-modules". Without it the tags are removed without running and an error is logged.
|
|
859
858
|
* - "full-dom" needs a fully constructed page (a head and a body), so place this plugin last when using it.
|
|
860
859
|
* - Failures are per tag: the error is logged and the rest of the page carries on.
|
|
861
860
|
* - In development the files each page executed are tracked, so editing one of them recompiles the pages that used it.
|
|
@@ -1583,6 +1582,8 @@ interface DevelopmentServerOptions {
|
|
|
1583
1582
|
* - On a change, the affected pages are recompiled in dependency order and metadata nothing references any more is dropped. If only
|
|
1584
1583
|
* CSS changed the stylesheets are swapped in place, otherwise the page reloads.
|
|
1585
1584
|
* - Compiled pages are trimmed to the number of connected clients, dropping the least recently served ones.
|
|
1585
|
+
* - Closing the app drops the connected clients and stops the server, which frees the port for the next one; the browser reloads
|
|
1586
|
+
* itself as soon as it reconnects.
|
|
1586
1587
|
*/
|
|
1587
1588
|
declare function developmentServerPlugin(options?: DevelopmentServerOptions): Plugin;
|
|
1588
1589
|
//#endregion
|
|
@@ -1779,6 +1780,10 @@ interface ServeCliPluginOptions {
|
|
|
1779
1780
|
*
|
|
1780
1781
|
* - The command owns the run. It forces development mode onto the config and creates its own App.
|
|
1781
1782
|
* - Serving itself belongs to developmentServerPlugin; this only starts the app in the right mode.
|
|
1783
|
+
* - The config file is watched. When it changes it is loaded again, the running app is closed and a new one starts from the new
|
|
1784
|
+
* config. A config that fails to load leaves the running app alone; a new app that fails to start is closed, so nothing is
|
|
1785
|
+
* served until the next save. Plugins have to be created inside the config file: only that file is evaluated again, so plugin
|
|
1786
|
+
* objects imported from elsewhere would be the same ones the closed app used, and those are refused.
|
|
1782
1787
|
*/
|
|
1783
1788
|
declare function serveCliPlugin(options?: ServeCliPluginOptions): Plugin;
|
|
1784
1789
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../../src/plugins/analyze-output/analyze-output-plugin.ts","../../src/plugins/bundle-packages/bundle-packages-plugin.ts","../../src/plugins/convert-images/convert-images-plugin.ts","../../src/plugins/copy-assets/copy-assets-plugin.ts","../../src/plugins/custom-ease/easing-functions/types.d.ts","../../src/plugins/custom-ease/custom-ease-plugin.ts","../../src/plugins/i18n/i18n-plugin.ts","../../src/plugins/import-as-string/types.ts","../../src/plugins/import-as-string/import-as-string-plugin.ts","../../src/plugins/load-sources/load-sources-plugin.ts","../../src/plugins/robots-text/robots-text-plugin.ts","../../src/plugins/service-worker/service-worker-plugin.ts","../../src/plugins/sitemap/sitemap-plugin.ts","../../src/plugins/svgo/svgo-plugin.ts","../../src/plugins/transform-css/transform-css-plugin.ts","../../src/plugins/transform-js/transform-js-plugin.ts","../../src/plugins/web-manifest/web-manifest-plugin.ts","../../src/plugins/write-files/write-files-plugin.ts","../../src/plugins/html-build-time-script/html-build-time-script.ts","../../src/plugins/html-bundle-script/html-bundle-script-plugin.ts","../../src/plugins/html-bundle-style/html-bundle-style-plugin.ts","../../src/plugins/html-env-only/html-env-only-plugin.ts","../../src/plugins/html-fragment/html-fragment-plugin.ts","../../src/plugins/html-iife-script/html-iife-script-plugin.ts","../../src/plugins/html-inline-script/html-inline-script-plugin.ts","../../src/plugins/html-inline-style/html-inline-style-plugin.ts","../../src/plugins/html-inline-svg/html-inline-svg-plugin.ts","../../src/plugins/html-inline-text/html-inline-text-plugin.ts","../../src/plugins/html-insert/html-insert-plugin.ts","../../src/plugins/html-layout/html-layout-plugin.ts","../../src/plugins/html-markdown/html-markdown-plugin.ts","../../src/plugins/html-merge-styles/html-merge-styles-plugin.ts","../../src/plugins/html-pages/html-pages-plugin.ts","../../src/plugins/html-preload/html-preload-plugin.ts","../../src/plugins/core-plugins/html-metadata/html-metadata-plugin.ts","../../src/plugins/core-plugins/markdown-metadata/markdown-metadata-plugin.ts","../../src/plugins/core-plugins/script-metadata/script-metadata-plugin.ts","../../src/plugins/core-plugins/style-metadata/style-metadata-plugin.ts","../../src/plugins/core-plugins/svg-metadata/svg-metadata-plugin.ts","../../src/plugins/core-plugins/web-manifest-metadata/web-manifest-metadata-plugin.ts","../../src/plugins/core-plugins/development-server/development-server-plugin.ts","../../src/plugins/cli-plugins/build/build-cli-plugin.ts","../../src/plugins/cli-plugins/convert-fonts/convert-fonts-cli-plugin.ts","../../src/plugins/cli-plugins/generate-font-face/generate-font-face-cli-plugin.ts","../../src/plugins/cli-plugins/material-you/material-you/types.d.ts","../../src/plugins/cli-plugins/material-you/material-you-cli-plugin.ts","../../src/plugins/cli-plugins/serve/serve-cli-plugin.ts"],"mappings":";;;;;;UAWiB;;;;;;EAMf;;;;;;EAOA;;;;;;EAOA;;;;;;EAOA,cAAc;;;;;;;;;;;;;;;;;iBAkBA,oBAAoB,UAAS,uBAA4B;;;UClCxD;;EAEf;;;;;;;;;;;;;;EAeA,SAAS;;;;;;;;;;;;;;;;;;EAmBT,iBAAiB,eAAe;IAA0B;IAAqB;;;;;;;;;;;;;;;;;;;;;iBAyBjE,qBAAqB,UAAS,wBAA6B;;;KCxE/D;KACA;UAEK;;;;;;EAMf,SAAS;;;;;;EAOT;;;;;;EAOA,SAAS;;;;;;EAOT;;;;;;EAOA;;;;;;;;;;;;;;;;;;iBAmBc,mBAAmB,UAAS,sBAA2B;;;UC5DtD;;;;;;EAMf;;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B;;;UCvHxD;;EAEf;;;;;;EAOA;;;;;;;;EASA;;;;;;;;EASA;;;;;;;;;;;;;;iBAec,cAAc,UAAS,iBAAsB;;;UCrC5C;;;;;;EAMf;;;;;;EAOA;;;;;;EAOA;;EAGA,aAAa;;;;;;;;;;;;;;;iBAgBC,WAAW,UAAS,cAAmB;;;UCtCtC;;EAEf,mBAAmB,QAAQ;;;;;;EAO3B;;;;;;;;;;;;iBAac,mBAAmB,UAAS,sBAA2B;;;UCxBtD;EACf,UAAU,MAAM;EAChB,UAAU,MAAM;;;;;;;;;;;;;;iBAeF,kBAAkB,UAAS,2BAAgC;;;UCtB1D;;;;;;EAMf;;;;;;EAOA;;;;;;;;;;;iBAYc,kBAAkB,UAAS,qBAA0B;;;UCtBpD;;EAEf;;;;;;EAOA;;;;;;EAOA;;;;;;EAOA;EAEA;;;;;;IAME;;;;;;IAOA;;;;;;IAOA;;EAGF;;;;;;IAME;;;;;;IAOA;;;;;;IAOA;;;;;;;;;;;;;;;;;;;iBAoBY,iBAAiB,SAAS,oBAAoB;;;
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../../src/plugins/analyze-output/analyze-output-plugin.ts","../../src/plugins/bundle-packages/bundle-packages-plugin.ts","../../src/plugins/convert-images/convert-images-plugin.ts","../../src/plugins/copy-assets/copy-assets-plugin.ts","../../src/plugins/custom-ease/easing-functions/types.d.ts","../../src/plugins/custom-ease/custom-ease-plugin.ts","../../src/plugins/i18n/i18n-plugin.ts","../../src/plugins/import-as-string/types.ts","../../src/plugins/import-as-string/import-as-string-plugin.ts","../../src/plugins/load-sources/load-sources-plugin.ts","../../src/plugins/robots-text/robots-text-plugin.ts","../../src/plugins/service-worker/service-worker-plugin.ts","../../src/plugins/sitemap/sitemap-plugin.ts","../../src/plugins/svgo/svgo-plugin.ts","../../src/plugins/transform-css/transform-css-plugin.ts","../../src/plugins/transform-js/transform-js-plugin.ts","../../src/plugins/web-manifest/web-manifest-plugin.ts","../../src/plugins/write-files/write-files-plugin.ts","../../src/plugins/html-build-time-script/html-build-time-script.ts","../../src/plugins/html-bundle-script/html-bundle-script-plugin.ts","../../src/plugins/html-bundle-style/html-bundle-style-plugin.ts","../../src/plugins/html-env-only/html-env-only-plugin.ts","../../src/plugins/html-fragment/html-fragment-plugin.ts","../../src/plugins/html-iife-script/html-iife-script-plugin.ts","../../src/plugins/html-inline-script/html-inline-script-plugin.ts","../../src/plugins/html-inline-style/html-inline-style-plugin.ts","../../src/plugins/html-inline-svg/html-inline-svg-plugin.ts","../../src/plugins/html-inline-text/html-inline-text-plugin.ts","../../src/plugins/html-insert/html-insert-plugin.ts","../../src/plugins/html-layout/html-layout-plugin.ts","../../src/plugins/html-markdown/html-markdown-plugin.ts","../../src/plugins/html-merge-styles/html-merge-styles-plugin.ts","../../src/plugins/html-pages/html-pages-plugin.ts","../../src/plugins/html-preload/html-preload-plugin.ts","../../src/plugins/core-plugins/html-metadata/html-metadata-plugin.ts","../../src/plugins/core-plugins/markdown-metadata/markdown-metadata-plugin.ts","../../src/plugins/core-plugins/script-metadata/script-metadata-plugin.ts","../../src/plugins/core-plugins/style-metadata/style-metadata-plugin.ts","../../src/plugins/core-plugins/svg-metadata/svg-metadata-plugin.ts","../../src/plugins/core-plugins/web-manifest-metadata/web-manifest-metadata-plugin.ts","../../src/plugins/core-plugins/development-server/development-server-plugin.ts","../../src/plugins/cli-plugins/build/build-cli-plugin.ts","../../src/plugins/cli-plugins/convert-fonts/convert-fonts-cli-plugin.ts","../../src/plugins/cli-plugins/generate-font-face/generate-font-face-cli-plugin.ts","../../src/plugins/cli-plugins/material-you/material-you/types.d.ts","../../src/plugins/cli-plugins/material-you/material-you-cli-plugin.ts","../../src/plugins/cli-plugins/serve/serve-cli-plugin.ts"],"mappings":";;;;;;UAWiB;;;;;;EAMf;;;;;;EAOA;;;;;;EAOA;;;;;;EAOA,cAAc;;;;;;;;;;;;;;;;;iBAkBA,oBAAoB,UAAS,uBAA4B;;;UClCxD;;EAEf;;;;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