@staticbolt/core 1.0.0-beta.13 → 1.0.0-beta.15

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.
@@ -1,16 +1,18 @@
1
- import { A as isStyleMetadata, C as filterScriptMetadata, D as isMarkdownMetadata, E as isHtmlMetadata, F as METADATA_TYPES, H as isValidRelativePath, I as Resolver, L as readJsonFile, M as isTextAssetMetadata, N as isWebManifestMetadata, O as isPackageMetadata, P as isScriptType, S as traverse, T as isBinaryAssetMetadata, U as splitHtmlLink, V as valueOrError, W as DependencyTracker, _ as mergeMaps, b as printFmtError, c as downloadContent, d as hashContent, f as humanReadableBytes, h as isURL, j as isSvgMetadata, k as isScriptMetadata, l as escapeHtml, n as bytesToKB, s as cloneObject, w as filterStyleMetadata, x as generator, y as PrintFormattedError, z as safeReadFileSync } from "../utilities-Bu5rdDC9.mjs";
2
- import { _ as resolve, a as basename, c as isAbsolute, d as matchPath, f as normalize, g as replaceExtension, h as relative, i as createLog, l as isSubpath, n as CUSTOM_ATTRIBUTES, o as dirname, p as parse$2, r as Log, s as extname, t as CONFIG_FILE_NAME, u as join } from "../common-Bkh8-tjA.mjs";
1
+ import { A as isTextAssetMetadata, C as isBinaryAssetMetadata, D as isScriptMetadata, E as isPackageMetadata, F as readJsonFile, H as splitHtmlLink, L as safeReadFileSync, M as isScriptType, N as METADATA_TYPES, O as isStyleMetadata, P as Resolver, S as filterStyleMetadata, T as isMarkdownMetadata, U as DependencyTracker, V as isValidRelativePath, _ as mergeMaps, b as printFmtError, c as downloadContent, d as hashContent, f as humanReadableBytes, h as isURL, j as isWebManifestMetadata, k as isSvgMetadata, l as escapeHtml, n as bytesToKB, s as cloneObject, w as isHtmlMetadata, x as filterScriptMetadata, y as PrintFormattedError, z as valueOrError } from "../utilities-ubLQ-AAc.mjs";
2
+ import { _ as resolve, a as basename, c as isAbsolute, d as join, f as normalize, g as replaceExtension, h as relative, i as createLog, l as isPathMatch, n as CUSTOM_ATTRIBUTES, o as dirname, p as parse$2, r as Log, s as extname, t as CONFIG_FILE_NAME, u as isSubpath } from "../common-CmCjfyAf.mjs";
3
3
  import { createRequire } from "node:module";
4
4
  import { copyFileSync, cpSync, existsSync, mkdirSync, readFileSync, readdirSync, rmSync, rmdirSync, unlinkSync, writeFileSync } from "node:fs";
5
5
  import nodePath from "node:path";
6
- import c from "chalk";
6
+ import chalk from "chalk";
7
7
  import json5 from "json5";
8
+ import _generator from "@babel/generator";
8
9
  import { HTMLElement, NodeType, parse } from "@staticbolt/node-html-parser";
9
10
  import postcss from "postcss";
10
11
  import { common, createEmphasize } from "emphasize";
11
12
  import { globSync } from "glob";
12
13
  import { minify_sync } from "terser";
13
14
  import * as esbuild from "esbuild";
15
+ import _traverse from "@babel/traverse";
14
16
  import * as t from "@babel/types";
15
17
  import sharp from "sharp";
16
18
  import { generateSW } from "workbox-build";
@@ -28,7 +30,6 @@ import rehypeExternalLinks from "rehype-external-links";
28
30
  import rehypeSlug from "rehype-slug";
29
31
  import rehypeStringify from "rehype-stringify";
30
32
  import { remark } from "remark";
31
- import remarkBreaks from "remark-breaks";
32
33
  import remarkFrontmatter from "remark-frontmatter";
33
34
  import remarkGfm from "remark-gfm";
34
35
  import remarkRehype from "remark-rehype";
@@ -38,9 +39,9 @@ import { visit } from "unist-util-visit";
38
39
  import { parse as parse$1 } from "yaml";
39
40
  import { minifySync } from "@swc/core";
40
41
  import * as babelParser from "@babel/parser";
42
+ import { browserslistToTargets, transform } from "lightningcss";
41
43
  import "cssnano";
42
44
  import "cssnano-preset-default";
43
- import { transform } from "lightningcss";
44
45
  import fastifyStatic from "@fastify/static";
45
46
  import fastifyUrlData from "@fastify/url-data";
46
47
  import Fastify from "fastify";
@@ -51,8 +52,8 @@ import ttf2woff2 from "ttf2woff2";
51
52
  import * as z from "zod";
52
53
  import * as fontKit from "fontkit";
53
54
 
54
- //#region src/helpers/find-deps.ts
55
- var DepsFinder = class {
55
+ //#region src/helpers/find-dependencies.ts
56
+ var DependenciesFinder = class {
56
57
  #depsMap = /* @__PURE__ */ new Map();
57
58
  #visiting = /* @__PURE__ */ new Set();
58
59
  #app;
@@ -69,18 +70,22 @@ var DepsFinder = class {
69
70
  this.#visiting.add(metadataItem.filePath);
70
71
  const usedFiles = /* @__PURE__ */ new Set();
71
72
  if (isPackageMetadata(metadataItem)) await this.#collectPackageMetadataDeps(metadataItem, usedFiles);
72
- else for (const { source } of await this.#app.requestSources(metadataItem)) await this.#collect(source, metadataItem.filePath, usedFiles);
73
+ else {
74
+ const sources = await this.#app.requestSources(metadataItem);
75
+ for (const { source } of sources) await this.#collect(source, metadataItem.filePath, usedFiles);
76
+ }
73
77
  this.#visiting.delete(metadataItem.filePath);
74
78
  this.#depsMap.set(metadataItem.filePath, usedFiles);
75
79
  return usedFiles;
76
80
  }
77
81
  async #collectPackageMetadataDeps(metadataItem, usedFiles) {
78
- for (const dep of metadataItem.directDependencies) {
79
- const absPath = join(this.#root, dep);
82
+ for (const dependency of metadataItem.directDependencies) {
83
+ const absPath = join(this.#root, dependency);
80
84
  usedFiles.add(absPath);
81
- const depMetadata = this.#app.findMetadata({ filePath: dep });
82
- if (!depMetadata) continue;
83
- for (const subDep of await this.findDeps(depMetadata)) usedFiles.add(subDep);
85
+ const dependencyMetadata = this.#app.findMetadata({ filePath: dependency });
86
+ if (!dependencyMetadata) continue;
87
+ const subDependencies = await this.findDeps(dependencyMetadata);
88
+ for (const subDependency of subDependencies) usedFiles.add(subDependency);
84
89
  }
85
90
  }
86
91
  async #collect(source, fromFile, usedFiles) {
@@ -89,9 +94,10 @@ var DepsFinder = class {
89
94
  if (extname(absPath) === ".html") return;
90
95
  usedFiles.add(absPath);
91
96
  const relativePath = relative(this.#root, absPath);
92
- const depMetadata = this.#app.findMetadata({ filePath: relativePath });
93
- if (!depMetadata) return;
94
- for (const dep of await this.findDeps(depMetadata)) usedFiles.add(dep);
97
+ const dependencyMetadata = this.#app.findMetadata({ filePath: relativePath });
98
+ if (!dependencyMetadata) return;
99
+ const dependencies = await this.findDeps(dependencyMetadata);
100
+ for (const dependency of dependencies) usedFiles.add(dependency);
95
101
  }
96
102
  /** Resolves a source path relative to its containing file and the output directory. */
97
103
  #resolveSource(source, filePath) {
@@ -110,7 +116,7 @@ var DepsFinder = class {
110
116
  //#endregion
111
117
  //#region src/plugins/analyze-output/analyze-output-plugin.ts
112
118
  function analyzeOutputPlugin(options = {}) {
113
- const removeUnused = options.deleteUnused ?? false;
119
+ const isRemoveUnused = options.deleteUnused ?? false;
114
120
  const exclude = options.exclude ?? [
115
121
  "robots.txt",
116
122
  "sitemap.xml",
@@ -118,12 +124,12 @@ function analyzeOutputPlugin(options = {}) {
118
124
  "workbox-*.js"
119
125
  ];
120
126
  const maxFileSize = options.maxFileSize ?? { ".js": 150 };
121
- const logUnusedFiles = options.logUnusedFiles ?? true;
127
+ const isLogUnusedFiles = options.logUnusedFiles ?? true;
122
128
  return {
123
129
  name: "analyze-output",
124
130
  async postBuild() {
125
131
  if (!this.production) return;
126
- const depsFinder = new DepsFinder(this, this.outdir);
132
+ const dependenciesFinder = new DependenciesFinder(this, this.outdir);
127
133
  const availableFiles = new Set(globSync(this.outdir + "/**/*", {
128
134
  ignore: "**/*.html",
129
135
  nodir: true
@@ -131,29 +137,29 @@ function analyzeOutputPlugin(options = {}) {
131
137
  const htmlEntryPoints = this.metadataList.filter((meta) => isHtmlMetadata(meta));
132
138
  const usedFiles = /* @__PURE__ */ new Set();
133
139
  for (const metadataItem of htmlEntryPoints) {
134
- const deps = await depsFinder.findDeps(metadataItem);
135
- for (const dep of deps) usedFiles.add(dep);
140
+ const dependencies = await dependenciesFinder.findDeps(metadataItem);
141
+ for (const dependency of dependencies) usedFiles.add(dependency);
136
142
  }
137
143
  const missingFiles = usedFiles.difference(availableFiles);
138
- let missingFilesLog = c.bold("The following files are missing:");
139
- for (const missing of missingFiles) missingFilesLog += "\n" + c.red("File not found: ") + c.yellow(relative(this.root, missing));
144
+ let missingFilesLog = chalk.bold("The following files are missing:");
145
+ for (const missing of missingFiles) missingFilesLog += "\n" + chalk.red("File not found: ") + chalk.yellow(relative(this.root, missing));
140
146
  if (missingFiles.size > 0) this.log.error(missingFilesLog);
141
147
  const unusedFiles = availableFiles.difference(usedFiles);
142
148
  const unusedFilesLog = [];
143
149
  for (const unused of unusedFiles) {
144
150
  if (extname(unused) === ".html") continue;
145
151
  const relativePath = relative(this.outdir, unused);
146
- if (matchPath(relativePath, {
152
+ if (isPathMatch(relativePath, {
147
153
  include: exclude,
148
154
  root: this.outdir
149
155
  })) continue;
150
- if (removeUnused) unlinkSync(unused);
151
- unusedFilesLog.push(c.yellow(join(basename(this.outdir), relativePath)));
156
+ if (isRemoveUnused) unlinkSync(unused);
157
+ unusedFilesLog.push(chalk.yellow(join(basename(this.outdir), relativePath)));
152
158
  }
153
- const logTitle = removeUnused ? c.bold(c.red("Removed"), "(" + c.yellow(unusedFilesLog.length) + ")", "unused files from the output directory") : c.bold("Found", "(" + c.yellow(unusedFilesLog.length) + ")", "unused files");
154
- if (unusedFilesLog.length > 0) this.log.warn(logTitle + (logUnusedFiles ? "\n" + unusedFilesLog.join("\n") : ""));
155
- const directories = globSync(this.outdir + "/**/*/");
156
- for (const directory of directories.toSorted()) {
159
+ const logTitle = isRemoveUnused ? chalk.bold(chalk.red("Removed"), "(" + chalk.yellow(unusedFilesLog.length) + ")", "unused files from the output directory") : chalk.bold("Found", "(" + chalk.yellow(unusedFilesLog.length) + ")", "unused files");
160
+ if (unusedFilesLog.length > 0) this.log.warn(logTitle + (isLogUnusedFiles ? "\n" + unusedFilesLog.join("\n") : ""));
161
+ const sortedDirectories = globSync(this.outdir + "/**/*/").toSorted((a, b) => a.localeCompare(b));
162
+ for (const directory of sortedDirectories) {
157
163
  let currentPath = directory;
158
164
  while (currentPath !== this.outdir) {
159
165
  if (!(readdirSync(currentPath).length === 0)) break;
@@ -171,14 +177,15 @@ function analyzeOutputPlugin(options = {}) {
171
177
  stat: true
172
178
  });
173
179
  const largeFilesLogs = [];
174
- for (const file of filesStat.toSorted((a, b) => (b.size ?? 0) - (a.size ?? 0))) {
180
+ const sortedFiles = filesStat.toSorted((a, b) => (b.size ?? 0) - (a.size ?? 0));
181
+ for (const file of sortedFiles) {
175
182
  const maxSize = maxFileSize[extname(file.name)];
176
183
  if (typeof maxSize !== "number") continue;
177
184
  if (file.size === 0) continue;
178
185
  if (bytesToKB(file.size ?? 0) <= maxSize) continue;
179
- largeFilesLogs.push(c.yellow(file.relative()) + ` (${c.red.bold(humanReadableBytes(file.size ?? 0))} ${c.blue(">")} ${c.green(humanReadableBytes(maxSize * 1024))})`);
186
+ largeFilesLogs.push(chalk.yellow(file.relative()) + ` (${chalk.red.bold(humanReadableBytes(file.size ?? 0))} ${chalk.blue(">")} ${chalk.green(humanReadableBytes(maxSize * 1024))})`);
180
187
  }
181
- if (largeFilesLogs.length > 0) this.log.warn(c.bold("The following files may be large:\n") + largeFilesLogs.join("\n"));
188
+ if (largeFilesLogs.length > 0) this.log.warn(chalk.bold("The following files may be large:\n") + largeFilesLogs.join("\n"));
182
189
  }
183
190
  }
184
191
  };
@@ -235,9 +242,10 @@ async function bundlePackage(options) {
235
242
 
236
243
  //#endregion
237
244
  //#region src/plugins/bundle-packages/collect-specifiers.ts
245
+ const traverse$1 = typeof _traverse === "function" ? _traverse : _traverse.default;
238
246
  function collectSpecifiersFromAst(ast) {
239
247
  const result = [];
240
- traverse(ast, {
248
+ traverse$1(ast, {
241
249
  ImportDeclaration(path) {
242
250
  if (!t.isStringLiteral(path.node.source)) return;
243
251
  if ((path.node.importKind ?? "value") === "type") return;
@@ -312,21 +320,21 @@ function collectSpecifiersFromAst(ast) {
312
320
  function collectImportDeclarationSpecifiers(path, specifiers) {
313
321
  const node = path.node;
314
322
  if (!t.isStringLiteral(node.source) || node.importKind && node.importKind !== "value") return;
315
- let foundSpecifier = false;
323
+ let hasFoundSpecifier = false;
316
324
  for (let index = 0; index < node.specifiers.length; index++) {
317
325
  const specifier = node.specifiers[index];
318
326
  if (t.isImportDefaultSpecifier(specifier)) {
319
327
  const setDefaultName = (newName) => {
320
328
  const index = node.specifiers.indexOf(specifier);
321
329
  if (index === -1) return;
322
- node.specifiers.splice(index, 1, t.importSpecifier(t.identifier(specifier.local.name), t.identifier(newName)));
330
+ node.specifiers[index] = t.importSpecifier(t.identifier(specifier.local.name), t.identifier(newName));
323
331
  };
324
332
  specifiers.push({
325
333
  type: "default",
326
334
  name: specifier.local.name,
327
335
  setDefaultName
328
336
  });
329
- foundSpecifier = true;
337
+ hasFoundSpecifier = true;
330
338
  continue;
331
339
  }
332
340
  if (t.isImportSpecifier(specifier)) {
@@ -338,7 +346,7 @@ function collectImportDeclarationSpecifiers(path, specifiers) {
338
346
  name: imported,
339
347
  publicName: specifier.local.name
340
348
  });
341
- foundSpecifier = true;
349
+ hasFoundSpecifier = true;
342
350
  continue;
343
351
  }
344
352
  if (t.isImportNamespaceSpecifier(specifier)) {
@@ -360,7 +368,7 @@ function collectImportDeclarationSpecifiers(path, specifiers) {
360
368
  name: capturedLocalName,
361
369
  setDefaultName
362
370
  });
363
- foundSpecifier = true;
371
+ hasFoundSpecifier = true;
364
372
  continue;
365
373
  }
366
374
  specifiers.push({
@@ -369,11 +377,11 @@ function collectImportDeclarationSpecifiers(path, specifiers) {
369
377
  name,
370
378
  publicName: name
371
379
  });
372
- foundSpecifier = true;
380
+ hasFoundSpecifier = true;
373
381
  }
374
382
  }
375
383
  }
376
- if (!foundSpecifier) specifiers.push({ type: "side-effect" });
384
+ if (!hasFoundSpecifier) specifiers.push({ type: "side-effect" });
377
385
  }
378
386
  function collectExportAllDeclarationSpecifiers(path, specifiers) {
379
387
  if (!path.node.source.value || path.node.exportKind !== "value") return;
@@ -410,13 +418,10 @@ function collectExportNamedDeclarationSpecifiers(path, specifiers) {
410
418
  });
411
419
  continue;
412
420
  }
413
- if (t.isExportNamespaceSpecifier(specifier)) {
414
- specifiers.push({
415
- type: "namespace",
416
- name: specifier.exported.name
417
- });
418
- continue;
419
- }
421
+ if (t.isExportNamespaceSpecifier(specifier)) specifiers.push({
422
+ type: "namespace",
423
+ name: t.isIdentifier(specifier.exported) ? specifier.exported.name : specifier.exported.value
424
+ });
420
425
  }
421
426
  }
422
427
  function collectDynamicImportSpecifiers(path, specifiers) {
@@ -606,7 +611,7 @@ function generateStdinString(specifiers, packageName) {
606
611
  named.add(specifier.publicName);
607
612
  }
608
613
  if (specifier.type === "namespace") isNamespace = true;
609
- if (specifier.type === "side-effect") hasSideEffect = true;
614
+ else if (specifier.type === "side-effect") hasSideEffect = true;
610
615
  }
611
616
  let contents = "";
612
617
  if (hasSideEffect) contents += `import '${packageName}';`;
@@ -651,8 +656,8 @@ function getNodeModuleDirectory(packageName, root) {
651
656
  return null;
652
657
  }
653
658
  }
654
- function getCustomPackagePath(root, importPath, production, resolvePackage) {
655
- const environment = production ? "production" : "development";
659
+ function getCustomPackagePath(root, importPath, isProduction, resolvePackage) {
660
+ const environment = isProduction ? "production" : "development";
656
661
  for (const [packageName, exports] of Object.entries(resolvePackage)) for (const [entry, stringOrObject] of Object.entries(exports)) {
657
662
  if (packageJoin(packageName, entry) !== importPath) continue;
658
663
  const relativePath = typeof stringOrObject === "string" ? stringOrObject : stringOrObject[environment];
@@ -666,7 +671,7 @@ function getCustomPackagePath(root, importPath, production, resolvePackage) {
666
671
  }
667
672
  }
668
673
  function isNodeModulesPath(path, root) {
669
- return matchPath(path, {
674
+ return isPathMatch(path, {
670
675
  include: ["**/node_modules/**"],
671
676
  ignore: [],
672
677
  root
@@ -708,14 +713,14 @@ function normalizePackageName(packageName) {
708
713
  */
709
714
  function bundlePackagesPlugin(options = {}) {
710
715
  const packagesOutputDirection = options.packagesDir ?? "./packages";
711
- const minifyUsingTerser = options.minifyUsingTerser ?? false;
716
+ const shouldMinifyUsingTerser = options.minifyUsingTerser ?? false;
712
717
  const resolvePackage = options.resolvePackage ?? {};
713
718
  const chunks = options.chunks ?? {};
714
719
  /** Maps package names to a list of collected import specifiers (named, default, side-effect, etc.) from various source files. */
715
720
  const specifiersByPackage = /* @__PURE__ */ new Map();
716
721
  /** Maps the absolute path of a package entry point to its original source name */
717
722
  const pathPackageMap = /* @__PURE__ */ new Map();
718
- const JS_EXTENSIONS = new Set([
723
+ const JS_EXTENSIONS = /* @__PURE__ */ new Set([
719
724
  ".js",
720
725
  ".mjs",
721
726
  ".cjs",
@@ -836,7 +841,7 @@ function bundlePackagesPlugin(options = {}) {
836
841
  resolveDir: this.root,
837
842
  outfile: packageOutputPath,
838
843
  packageName: chunkName,
839
- minify: this.production && !minifyUsingTerser,
844
+ minify: this.production && !shouldMinifyUsingTerser,
840
845
  production: this.production,
841
846
  treeShaking: this.production,
842
847
  onPackageResolve: (importedPackageName) => {
@@ -887,19 +892,19 @@ function bundlePackagesPlugin(options = {}) {
887
892
  id: packageName,
888
893
  directDependencies: /* @__PURE__ */ new Set()
889
894
  };
890
- let loadAsIs = !this.production;
895
+ let isLoadAsIs = !this.production;
891
896
  for (const [index, specifier] of Array.from(specifiers).entries()) {
892
897
  if (specifier.type !== "unknown") continue;
893
- loadAsIs = true;
898
+ isLoadAsIs = true;
894
899
  specifiers.splice(index, 1);
895
900
  }
896
901
  const [bundledCode, bundleError] = await bundlePackage({
897
- contents: loadAsIs ? void 0 : generateStdinString(specifiers, packageName),
898
- entryPoint: loadAsIs ? packageName : void 0,
902
+ contents: isLoadAsIs ? void 0 : generateStdinString(specifiers, packageName),
903
+ entryPoint: isLoadAsIs ? packageName : void 0,
899
904
  resolveDir: this.root,
900
905
  outfile: packageOutputPath,
901
906
  packageName,
902
- minify: !minifyUsingTerser && this.production,
907
+ minify: !shouldMinifyUsingTerser && this.production,
903
908
  production: this.production,
904
909
  treeShaking: this.production,
905
910
  onPackageResolve: (importedPackageName) => {
@@ -974,7 +979,7 @@ function bundlePackagesPlugin(options = {}) {
974
979
  outfile: dependencyOutputPath,
975
980
  packageName: dependencyName,
976
981
  production: this.production,
977
- minify: !minifyUsingTerser,
982
+ minify: !shouldMinifyUsingTerser,
978
983
  treeShaking: true,
979
984
  onPackageResolve: (importedPackageName) => {
980
985
  const dependencyOutputPath = calcPackageOutPath(getChunkName(importedPackageName, chunks) ?? importedPackageName, packagesOutputDirection);
@@ -991,7 +996,7 @@ function bundlePackagesPlugin(options = {}) {
991
996
  }
992
997
  packageToBundle.code = reBundledCode;
993
998
  }
994
- if (!minifyUsingTerser) return;
999
+ if (!shouldMinifyUsingTerser) return;
995
1000
  const packages = this.filterMetadata({ type: METADATA_TYPES.Package });
996
1001
  for (const packageMetadata of packages) {
997
1002
  const result = minify_sync(packageMetadata.code);
@@ -1018,7 +1023,7 @@ function convertImagePlugin(options = {}) {
1018
1023
  if (!isValidRelativePath(source)) return;
1019
1024
  const [link, suffix] = splitHtmlLink(source);
1020
1025
  const relativeToRoot = join(dirname(filePath), link);
1021
- if (!matchPath(relativeToRoot, {
1026
+ if (!isPathMatch(relativeToRoot, {
1022
1027
  include,
1023
1028
  ignore,
1024
1029
  root: this.root
@@ -1028,7 +1033,7 @@ function convertImagePlugin(options = {}) {
1028
1033
  imgPath: join(this.root, relativeToRoot)
1029
1034
  };
1030
1035
  }
1031
- const supported = new Set([
1036
+ const supported = /* @__PURE__ */ new Set([
1032
1037
  "png",
1033
1038
  "jpg",
1034
1039
  "jpeg",
@@ -1044,7 +1049,7 @@ function convertImagePlugin(options = {}) {
1044
1049
  async transform(inputMetadata) {
1045
1050
  for (const { metadata } of filterScriptMetadata(inputMetadata)) {
1046
1051
  const log = this.log;
1047
- const production = this.production;
1052
+ const isProduction = this.production;
1048
1053
  t.traverse(metadata.ast, { enter(node, ancestors) {
1049
1054
  if (!t.isMemberExpression(node) || !t.isIdentifier(node.property)) return;
1050
1055
  if (!t.isIdentifier(node.object, { name: "_img" })) return;
@@ -1056,7 +1061,7 @@ function convertImagePlugin(options = {}) {
1056
1061
  return;
1057
1062
  }
1058
1063
  const parentNode = capturedAncestor.node;
1059
- const newNode = t.stringLiteral(production ? format : property);
1064
+ const newNode = t.stringLiteral(isProduction ? format : property);
1060
1065
  if (capturedAncestor.index === void 0) {
1061
1066
  parentNode[capturedAncestor.key] = newNode;
1062
1067
  return;
@@ -1160,7 +1165,7 @@ function getPointsFromPathString(path, viewBox) {
1160
1165
  const width = viewBox.width;
1161
1166
  const match = path.match(/-?[0-9.]+/g);
1162
1167
  if (!match) throw new Error("invalid path");
1163
- const pathData = match.map((v, index) => index % 2 === 0 ? Number.parseFloat(v) * width + x : Number.parseFloat(v) * height + y);
1168
+ const pathData = match.map((v, index) => index % 2 === 0 ? Number(v) * width + x : Number(v) * height + y);
1164
1169
  const points = [];
1165
1170
  if (pathData.length === 0) return points;
1166
1171
  points.push([pathData[0], pathData[1]]);
@@ -1278,7 +1283,7 @@ function convertEasingFunctionToLinearFN(easingFunction, samples) {
1278
1283
  const t = index / (samples - 1);
1279
1284
  values[count++] = easingFunction(t);
1280
1285
  }
1281
- return `linear(${Array.from(values).map((string) => +string.toFixed(2)).join(",")})`;
1286
+ return `linear(${Array.from(values, (string) => +string.toFixed(2)).join(",")})`;
1282
1287
  }
1283
1288
 
1284
1289
  //#endregion
@@ -1387,16 +1392,16 @@ function customEasePlugin(options = {}) {
1387
1392
  ...predefinedEasing,
1388
1393
  ...options.customEase
1389
1394
  };
1390
- const replaceInHtml = options.replaceInHtmlStyleAttribute ?? false;
1391
- const replaceInJS = options.replaceInJS ?? false;
1395
+ const shouldReplaceInHtml = options.replaceInHtmlStyleAttribute ?? false;
1396
+ const shouldReplaceInJS = options.replaceInJS ?? false;
1392
1397
  const jsFunctionName = options.jsFunctionName ?? "cssLinear";
1393
- const replaceInCSS = options.replaceInCSS ?? true;
1398
+ const shouldReplaceInCSS = options.replaceInCSS ?? true;
1394
1399
  const cssFunctionPrefix = options.cssFunctionPrefix ?? "--ease-";
1395
1400
  const samples = options.samples ?? 50;
1396
1401
  return {
1397
1402
  name: "custom-ease",
1398
1403
  transform(inputMetadata) {
1399
- if (replaceInHtml && isHtmlMetadata(inputMetadata)) {
1404
+ if (shouldReplaceInHtml && isHtmlMetadata(inputMetadata)) {
1400
1405
  const elements = inputMetadata.ast.querySelectorAll("[style]");
1401
1406
  for (const node of elements) {
1402
1407
  const style = node.getAttribute("style");
@@ -1404,7 +1409,7 @@ function customEasePlugin(options = {}) {
1404
1409
  const { name, matchStartIndex, matchEndIndex, args } = parseFunctionCall(style, `${cssFunctionPrefix}.+`);
1405
1410
  if (matchStartIndex < 0) return;
1406
1411
  const easeFunctionName = name.replace(cssFunctionPrefix, "");
1407
- if (!(easeFunctionName in customEasing)) return;
1412
+ if (!Object.hasOwn(customEasing, easeFunctionName)) return;
1408
1413
  const easeFunctionOrString = customEasing[easeFunctionName];
1409
1414
  if (typeof easeFunctionOrString === "string") {
1410
1415
  node.setAttribute("style", style.slice(0, Math.max(0, matchStartIndex)) + easeFunctionOrString + style.slice(Math.max(0, matchEndIndex)));
@@ -1421,13 +1426,13 @@ function customEasePlugin(options = {}) {
1421
1426
  }
1422
1427
  }
1423
1428
  }
1424
- if (replaceInJS) for (const { metadata } of filterScriptMetadata(inputMetadata)) t.traverse(metadata.ast, { enter(node, ancestors) {
1429
+ if (shouldReplaceInJS) for (const { metadata } of filterScriptMetadata(inputMetadata)) t.traverse(metadata.ast, { enter(node, ancestors) {
1425
1430
  if (!t.isCallExpression(node)) return;
1426
1431
  const callee = node.callee;
1427
1432
  if (!t.isMemberExpression(callee) || !t.isIdentifier(callee.object) || !t.isIdentifier(callee.property)) return;
1428
1433
  if (callee.object.name !== jsFunctionName) return;
1429
1434
  const functionName = callee.property.name.replace(/[A-Z]/g, (match) => "-" + match.toLowerCase());
1430
- if (!(functionName in customEasing)) return;
1435
+ if (!Object.hasOwn(customEasing, functionName)) return;
1431
1436
  const easeFunctionOrString = customEasing[functionName];
1432
1437
  const capturedAncestor = ancestors.at(-1);
1433
1438
  if (!capturedAncestor) {
@@ -1454,20 +1459,20 @@ function customEasePlugin(options = {}) {
1454
1459
  }
1455
1460
  replaceWith(convertEasingFunctionToLinearFN(easeFunctionOrString(...arguments_), samples));
1456
1461
  } });
1457
- if (replaceInCSS) for (const { metadata } of filterStyleMetadata(inputMetadata)) metadata.ast.walkDecls((decl) => {
1458
- const value = decl.value;
1462
+ if (shouldReplaceInCSS) for (const { metadata } of filterStyleMetadata(inputMetadata)) metadata.ast.walkDecls((declaration) => {
1463
+ const value = declaration.value;
1459
1464
  const { name, matchStartIndex, matchEndIndex, args } = parseFunctionCall(value, `${cssFunctionPrefix}.+`);
1460
1465
  if (matchStartIndex < 0) return;
1461
1466
  const easeFunctionName = name.replace(cssFunctionPrefix, "");
1462
- if (!(easeFunctionName in customEasing)) return;
1467
+ if (!Object.hasOwn(customEasing, easeFunctionName)) return;
1463
1468
  const easeFunctionOrString = customEasing[easeFunctionName];
1464
1469
  if (typeof easeFunctionOrString === "string") {
1465
- decl.value = value.slice(0, Math.max(0, matchStartIndex)) + easeFunctionOrString + value.slice(Math.max(0, matchEndIndex));
1470
+ declaration.value = value.slice(0, Math.max(0, matchStartIndex)) + easeFunctionOrString + value.slice(Math.max(0, matchEndIndex));
1466
1471
  return;
1467
1472
  }
1468
1473
  try {
1469
1474
  const linearFunction = convertEasingFunctionToLinearFN(easeFunctionOrString(...args), samples);
1470
- decl.value = value.slice(0, Math.max(0, matchStartIndex)) + linearFunction + value.slice(Math.max(0, matchEndIndex));
1475
+ declaration.value = value.slice(0, Math.max(0, matchStartIndex)) + linearFunction + value.slice(Math.max(0, matchEndIndex));
1471
1476
  } catch {
1472
1477
  printFmtError("Error generating easing function", {
1473
1478
  function: customEasePlugin,
@@ -1578,7 +1583,7 @@ getLocals.cache = null;
1578
1583
  function getAllPathsMap(object, prefix = "", result = /* @__PURE__ */ new Map()) {
1579
1584
  for (const key in object) {
1580
1585
  const path = prefix ? `${prefix}.${key}` : key;
1581
- if (object[key] && typeof object[key] === "object" && !Array.isArray(object[key])) {
1586
+ if (Object.hasOwn(object, key) && typeof object[key] === "object" && !Array.isArray(object[key])) {
1582
1587
  getAllPathsMap(object[key], path, result);
1583
1588
  continue;
1584
1589
  }
@@ -1654,7 +1659,7 @@ function processI18nInHTML(options) {
1654
1659
  const attributeValue = Object.entries(node.attrs);
1655
1660
  const i18nNameValuePair = Object.fromEntries(attributeValue.filter(([attribute]) => attribute.startsWith(placeholderPrefix)).map(([attribute, value]) => [attribute.replace(placeholderPrefix, ""), value]));
1656
1661
  const replacer = (_match, attribute, defaultValue) => {
1657
- if (attribute in i18nNameValuePair) {
1662
+ if (Object.hasOwn(i18nNameValuePair, attribute)) {
1658
1663
  const value = i18nNameValuePair[attribute];
1659
1664
  if (typeof value === "string") {
1660
1665
  if (!value.startsWith("@") || value.startsWith("@@")) return value.replace(/^@@/, "@");
@@ -1665,7 +1670,7 @@ function processI18nInHTML(options) {
1665
1670
  if (defaultValue !== void 0) return defaultValue;
1666
1671
  return "";
1667
1672
  };
1668
- if (i18nAttribute in node.attrs) {
1673
+ if (Object.hasOwn(node.attributes, i18nAttribute)) {
1669
1674
  const keysPath = node.getAttribute(i18nAttribute);
1670
1675
  node.removeAttribute(i18nAttribute);
1671
1676
  for (const attribute of Object.keys(i18nNameValuePair)) node.removeAttribute(placeholderPrefix + attribute);
@@ -1704,7 +1709,10 @@ function i18nCliPlugin(options) {
1704
1709
  });
1705
1710
  const keys = Array.from(localesData.localesMap[defaultLocale].keys());
1706
1711
  const placeholders = /* @__PURE__ */ new Set();
1707
- for (const locale in localesData.localesObj) for (const placeholder of collectPlaceholders(localesData.localesObj[locale])) placeholders.add(placeholder);
1712
+ for (const locale in localesData.localesObj) {
1713
+ const placeholders = collectPlaceholders(localesData.localesObj[locale]);
1714
+ for (const placeholder of placeholders) placeholders.add(placeholder);
1715
+ }
1708
1716
  const htmlDataSavePath = join(localesPath, "i18n.html-data.json");
1709
1717
  const attributeValues = keys.map((key) => ({ name: key }));
1710
1718
  const placeholderValues = keys.map((key) => ({ name: `@${key}` }));
@@ -1718,7 +1726,7 @@ function i18nCliPlugin(options) {
1718
1726
  values: placeholderValues
1719
1727
  }],
1720
1728
  globalAttributes: [
1721
- ...Array.from(placeholders).map((placeholder) => ({
1729
+ ...Array.from(placeholders, (placeholder) => ({
1722
1730
  name: placeholderPrefix + placeholder,
1723
1731
  description: `Replace the placeholder \`${placeholder}\` with a value.\n\nExample: \`"Hi {{ ${placeholder}=DefaultValue }}"\` -> \`<div ${placeholderPrefix + placeholder}="someValue"></div>\` \n\nOr use an existing i18n value:\n\n\`<div ${placeholderPrefix + placeholder}="@header.title"></div>\``,
1724
1732
  valueSet: "i18n-placeholder-keys"
@@ -1766,7 +1774,7 @@ function generateTypes(keys, placeholders, langs) {
1766
1774
  current[part] = "string";
1767
1775
  continue;
1768
1776
  }
1769
- if (!current[part]) current[part] = {};
1777
+ if (!Object.hasOwn(current, part)) current[part] = {};
1770
1778
  current = current[part];
1771
1779
  }
1772
1780
  }
@@ -1821,6 +1829,7 @@ function collectPlaceholders(data) {
1821
1829
 
1822
1830
  //#endregion
1823
1831
  //#region src/ast-utilities/babel-utils/resolve-static-value.ts
1832
+ const generator$1 = typeof _generator === "function" ? _generator : _generator.default;
1824
1833
  /** Get the value of an expression node */
1825
1834
  function resolveStaticValue$1(path) {
1826
1835
  if (!path) return;
@@ -1887,7 +1896,7 @@ function resolveStaticValue$1(path) {
1887
1896
  if (t.isArrowFunctionExpression(node) || t.isFunctionExpression(node) || t.isClassMethod(node) || t.isClassPrivateMethod(node)) {
1888
1897
  const parameters = node.params.map((parameter) => t.isIdentifier(parameter) ? parameter.name : "").filter(Boolean);
1889
1898
  const isBlock = t.isBlockStatement(node.body);
1890
- let bodyString = generator(node.body).code;
1899
+ let bodyString = generator$1(node.body).code;
1891
1900
  bodyString = isBlock ? bodyString.slice(1, -1).trim() : "return " + bodyString;
1892
1901
  let function_;
1893
1902
  try {
@@ -2019,6 +2028,7 @@ function getClassPropertyValue(classPath, propertyName) {
2019
2028
 
2020
2029
  //#endregion
2021
2030
  //#region src/plugins/i18n/i18n-script-plugin.ts
2031
+ const traverse = typeof _traverse === "function" ? _traverse : _traverse.default;
2022
2032
  function i18nScriptPlugin(options) {
2023
2033
  const { defaultLocale, localesDirectory, supportedLocales } = options;
2024
2034
  const printFmtError = PrintFormattedError.create({ function: i18nScriptPlugin });
@@ -2053,7 +2063,7 @@ function i18nScriptPlugin(options) {
2053
2063
  }
2054
2064
  const fillValues = secondArgumentValue?.value ?? {};
2055
2065
  const replacer = (_match, variableName, defaultValue) => {
2056
- if (variableName in fillValues) {
2066
+ if (Object.hasOwn(fillValues, variableName)) {
2057
2067
  const value_ = fillValues[variableName];
2058
2068
  if (typeof value_ === "string") return value_;
2059
2069
  }
@@ -2141,7 +2151,7 @@ function i18nScriptPlugin(options) {
2141
2151
  }
2142
2152
  const fillValues = thirdArgumentValue?.value ?? {};
2143
2153
  const replacer = (_match, variableName, defaultValue) => {
2144
- if (variableName in fillValues) {
2154
+ if (Object.hasOwn(fillValues, variableName)) {
2145
2155
  const value_ = fillValues[variableName];
2146
2156
  if (typeof value_ === "string") return value_;
2147
2157
  }
@@ -2221,13 +2231,13 @@ function parseImportAsString({ ast, filePath }) {
2221
2231
  if (isPlainObject(secondeArgumentValue)) {
2222
2232
  const entries = Object.entries(secondeArgumentValue);
2223
2233
  for (const [key, value] of entries) {
2224
- if (!(key in optionsObject)) {
2234
+ if (!Object.hasOwn(optionsObject, key)) {
2225
2235
  printFmtError("Unknown option of `import_as_string`", { node });
2226
2236
  continue;
2227
2237
  }
2228
2238
  const expectedType = typeof optionsObject[key];
2229
2239
  if (typeof value !== expectedType) {
2230
- printFmtError(`The '${String(key)}' option should be an optional`, expectedType, { node });
2240
+ printFmtError(`The '${key}' option should be an optional`, expectedType, { node });
2231
2241
  continue;
2232
2242
  }
2233
2243
  optionsObject[key] = value;
@@ -2310,7 +2320,7 @@ function isPlainObject(value) {
2310
2320
  //#endregion
2311
2321
  //#region src/plugins/import-as-string/import-as-string-plugin.ts
2312
2322
  function importAsStringPlugin() {
2313
- const deps = new DependencyTracker();
2323
+ const dependencies = new DependencyTracker();
2314
2324
  return {
2315
2325
  name: "import-as-string",
2316
2326
  sourcesProvider(metadata) {
@@ -2321,12 +2331,12 @@ function importAsStringPlugin() {
2321
2331
  });
2322
2332
  },
2323
2333
  onFileEvent(event, id) {
2324
- if (event === "unlink") deps.delete(id);
2334
+ if (event === "unlink") dependencies.delete(id);
2325
2335
  },
2326
2336
  resolveCompileList(compileSet, event) {
2327
2337
  if (event !== "change") return;
2328
2338
  for (const id of Array.from(compileSet)) {
2329
- const importers = deps.getImporters(id);
2339
+ const importers = dependencies.getImporters(id);
2330
2340
  for (const importer of importers) compileSet.add(importer);
2331
2341
  }
2332
2342
  },
@@ -2374,7 +2384,7 @@ function importAsStringPlugin() {
2374
2384
  if (!this.entryPoints.has(sourceMetadata.id)) this.emitExclude.add(sourceMetadata);
2375
2385
  replaceWith(metadataString);
2376
2386
  }
2377
- deps.update(metadata.id, currentSources);
2387
+ dependencies.update(metadata.id, currentSources);
2378
2388
  }
2379
2389
  }
2380
2390
  };
@@ -2404,7 +2414,7 @@ function loadSourcesPlugin(options) {
2404
2414
  },
2405
2415
  onFileEvent(event, id) {
2406
2416
  if (event === "change") return;
2407
- if (!matchPath(id, {
2417
+ if (!isPathMatch(id, {
2408
2418
  include: options.include,
2409
2419
  ignore,
2410
2420
  root: this.root
@@ -2472,8 +2482,8 @@ function serviceWorkerPlugin(options = {}) {
2472
2482
  babelPresetEnvTargets: this.browserslist,
2473
2483
  ...options
2474
2484
  });
2475
- if (warnings.length > 0) this.log.warn("Warnings encountered while generating a service worker:\n >", warnings.join(c.yellow("\n > ")), "\n");
2476
- this.log.info("Generated a service worker, which will precache", c.yellow(count), "files, totaling", c.yellow(humanReadableBytes(size)));
2485
+ if (warnings.length > 0) this.log.warn("Warnings encountered while generating a service worker:\n >", warnings.join(chalk.yellow("\n > ")), "\n");
2486
+ this.log.info("Generated a service worker, which will precache", chalk.yellow(count), "files, totaling", chalk.yellow(humanReadableBytes(size)));
2477
2487
  }
2478
2488
  };
2479
2489
  }
@@ -2609,7 +2619,7 @@ const processCss = valueOrError(processCssUnsafe);
2609
2619
  const loadPostcssConfig = valueOrError(postcssrc);
2610
2620
  function transformCssPlugin(options = {}) {
2611
2621
  const plugins = options.plugins ?? [];
2612
- const loadConfig = options.loadConfig ?? false;
2622
+ const isLoadConfig = options.loadConfig ?? false;
2613
2623
  let postcssConfig = {
2614
2624
  file: "",
2615
2625
  options: {},
@@ -2619,7 +2629,7 @@ function transformCssPlugin(options = {}) {
2619
2629
  return {
2620
2630
  name: "transform-css",
2621
2631
  async setup() {
2622
- if (!loadConfig) return;
2632
+ if (!isLoadConfig) return;
2623
2633
  const environment = this.production ? "production" : "development";
2624
2634
  const virtualCssFile = join(this.root, "virtual.css");
2625
2635
  const [loadedPlugins, loadPluginsError] = await loadPostcssConfig({
@@ -2754,14 +2764,14 @@ function writeFilesPlugin(options) {
2754
2764
  options.format.exclude ??= [];
2755
2765
  const format = options.format;
2756
2766
  function shouldMinifyFile(filePath, root) {
2757
- return minify.enabled && matchPath(filePath, {
2767
+ return minify.enabled && isPathMatch(filePath, {
2758
2768
  include: minify.include,
2759
2769
  ignore: minify.exclude,
2760
2770
  root
2761
2771
  });
2762
2772
  }
2763
2773
  function shouldFormatFile(filePath, root) {
2764
- return format.enabled && matchPath(filePath, {
2774
+ return format.enabled && isPathMatch(filePath, {
2765
2775
  include: format.include,
2766
2776
  ignore: format.exclude,
2767
2777
  root
@@ -2779,7 +2789,7 @@ function writeFilesPlugin(options) {
2779
2789
  async write(metadata) {
2780
2790
  if (!this.production) return;
2781
2791
  if (this.emitExclude.has(metadata)) return;
2782
- if (!matchPath(metadata.id, {
2792
+ if (!isPathMatch(metadata.id, {
2783
2793
  include,
2784
2794
  ignore,
2785
2795
  root: this.root
@@ -2788,16 +2798,16 @@ function writeFilesPlugin(options) {
2788
2798
  this.log.error(`file path "${metadata.filePath}" is outside of the output directory "${this.outdir}". Skipping...`);
2789
2799
  return;
2790
2800
  }
2791
- const minify = shouldMinifyFile(metadata.id, this.root);
2792
- const format = shouldFormatFile(metadata.id, this.root);
2793
- if (minify && format) this.log.warn(`"minify" and "format" are enabled for "${metadata.id}" but only one can be used.`);
2801
+ const shouldMinify = shouldMinifyFile(metadata.id, this.root);
2802
+ const shouldFormat = shouldFormatFile(metadata.id, this.root);
2803
+ if (shouldMinify && shouldFormat) this.log.warn(`"minify" and "format" are enabled for "${metadata.id}" but only one can be used.`);
2794
2804
  if (isBinaryAssetMetadata(metadata)) {
2795
2805
  cpSync(join(this.root, metadata.id), join(this.outdir, metadata.filePath), { recursive: true });
2796
2806
  return;
2797
2807
  }
2798
2808
  const code = await this.stringify(metadata, {
2799
- format,
2800
- minify
2809
+ format: shouldFormat,
2810
+ minify: shouldMinify
2801
2811
  });
2802
2812
  if (typeof code !== "string") {
2803
2813
  this.log.error(`Failed to stringify "${metadata.id}"`);
@@ -2867,7 +2877,7 @@ async function executeJsInVmUnsafe(options) {
2867
2877
  async function importModuleDynamically(specifier, referrer) {
2868
2878
  const m = await linker(specifier, referrer);
2869
2879
  if (m.status === "unlinked") await m.link(linker);
2870
- if (m.status === "linked") await m.evaluate();
2880
+ else if (m.status === "linked") await m.evaluate();
2871
2881
  return m;
2872
2882
  }
2873
2883
  async function linker(specifier, referencingModule) {
@@ -2885,7 +2895,7 @@ async function executeJsInVmUnsafe(options) {
2885
2895
  modules[resolveName] = module;
2886
2896
  return module;
2887
2897
  }
2888
- if (Boolean(modules[resolveName])) return modules[resolveName];
2898
+ if (Object.hasOwn(modules, resolveName)) return modules[resolveName];
2889
2899
  if (isNativeModule) {
2890
2900
  const builtIn = await import(specifier);
2891
2901
  const exportNames = Object.keys(builtIn);
@@ -2935,10 +2945,9 @@ function htmlBuildTimeScript(options = {}) {
2935
2945
  return {
2936
2946
  name: "html-build-time-script",
2937
2947
  setup() {
2938
- if (!vm.SourceTextModule) {
2939
- isVmEnabled = false;
2940
- printFmtError("Script execution requires the `node:vm` module, which is currently unavailable.", "\nStart Node.js with the `--experimental-vm-modules` flag to enable it.");
2941
- }
2948
+ if (vm.SourceTextModule) return;
2949
+ isVmEnabled = false;
2950
+ printFmtError("Script execution requires the `node:vm` module, which is currently unavailable.", "\nStart Node.js with the `--experimental-vm-modules` flag to enable it.");
2942
2951
  },
2943
2952
  async postTransform() {
2944
2953
  for (const metadata of this.metadataList) {
@@ -2951,9 +2960,9 @@ function htmlBuildTimeScript(options = {}) {
2951
2960
  const scripts = metadata.ast.querySelectorAll(query);
2952
2961
  if (scripts.length === 0) continue;
2953
2962
  for (const node of scripts) {
2954
- const useFullDom = node.hasAttribute(fullDomAttribute);
2963
+ const shouldUseFullDom = node.hasAttribute(fullDomAttribute);
2955
2964
  if (!isScriptType(node.getAttribute("type"))) continue;
2956
- if (useFullDom && !isReady) {
2965
+ if (shouldUseFullDom && !isReady) {
2957
2966
  printFmtError("Script cannot be executed until the page is fully constructed.", { node });
2958
2967
  continue;
2959
2968
  }
@@ -2996,9 +3005,9 @@ function htmlBuildTimeScript(options = {}) {
2996
3005
  const [executeResult, error] = await executeJsInVM({
2997
3006
  root: this.root,
2998
3007
  entryFile: scriptMetadata.filePath,
2999
- html: useFullDom ? await this.stringify(metadata) : void 0,
3008
+ html: shouldUseFullDom ? await this.stringify(metadata) : void 0,
3000
3009
  context: {
3001
- document: useFullDom ? void 0 : metadata.ast,
3010
+ document: shouldUseFullDom ? void 0 : metadata.ast,
3002
3011
  window: globalThis,
3003
3012
  StaticBolt: this,
3004
3013
  __filepath: metadata.filePath,
@@ -3011,7 +3020,7 @@ function htmlBuildTimeScript(options = {}) {
3011
3020
  printFmtError("Failed to execute script tag", error, { node });
3012
3021
  continue;
3013
3022
  }
3014
- if (useFullDom && executeResult.dom) {
3023
+ if (shouldUseFullDom && executeResult.dom) {
3015
3024
  const output = executeResult.dom.serialize();
3016
3025
  metadata.ast.root.set_content(output);
3017
3026
  }
@@ -3046,7 +3055,7 @@ function htmlBuildTimeScript(options = {}) {
3046
3055
 
3047
3056
  //#endregion
3048
3057
  //#region src/plugins/html-bundle-script/esbuild-plugin.ts
3049
- function loaderPlugin(outFile, checkExternal) {
3058
+ function loaderPlugin(outFile, isExternalCheck) {
3050
3059
  const root = this.root;
3051
3060
  const outFileAbs = join(root, outFile);
3052
3061
  const app = this;
@@ -3057,11 +3066,11 @@ function loaderPlugin(outFile, checkExternal) {
3057
3066
  if (!arguments_.path.startsWith(".")) return;
3058
3067
  const absSource = join(arguments_.resolveDir, arguments_.path);
3059
3068
  const source = relative(root, absSource);
3060
- if (checkExternal(source)) return {
3069
+ if (isExternalCheck(source)) return {
3061
3070
  path: relative(dirname(outFile), source),
3062
3071
  external: true
3063
3072
  };
3064
- if (matchPath(source, {
3073
+ if (isPathMatch(source, {
3065
3074
  include: ["**/node_modules/**"],
3066
3075
  ignore: [],
3067
3076
  root
@@ -3102,7 +3111,7 @@ function loaderPlugin(outFile, checkExternal) {
3102
3111
  //#region src/plugins/html-bundle-script/esbuild-bundle.ts
3103
3112
  const bundleFunction = valueOrError(esbuild.build);
3104
3113
  async function bundleScriptWithEsbuild(options) {
3105
- const { contents, entryPoint, outfile, checkExternal } = options;
3114
+ const { contents, entryPoint, outfile, isExternalCheck } = options;
3106
3115
  const root = this.root;
3107
3116
  const [bundleResult, error] = await bundleFunction({
3108
3117
  stdin: {
@@ -3123,7 +3132,7 @@ async function bundleScriptWithEsbuild(options) {
3123
3132
  legalComments: "none",
3124
3133
  logLevel: "silent",
3125
3134
  charset: "utf8",
3126
- plugins: [loaderPlugin.call(this, outfile, checkExternal)]
3135
+ plugins: [loaderPlugin.call(this, outfile, isExternalCheck)]
3127
3136
  });
3128
3137
  if (error) return [null, error];
3129
3138
  const outCode = bundleResult?.outputFiles?.[0].text;
@@ -3207,7 +3216,7 @@ function htmlBundleScriptPlugin(options = {}) {
3207
3216
  });
3208
3217
  continue;
3209
3218
  }
3210
- const inline = !bundleOut && hasContent;
3219
+ const isInlined = !bundleOut && hasContent;
3211
3220
  const externals = parsePatterns(externalsAttributeValue) ?? defaultExternal;
3212
3221
  const externalsIgnore = parsePatterns(externalsExcludeAttributeValue) ?? defaultExternalExclude;
3213
3222
  let entryPoint = "";
@@ -3215,7 +3224,7 @@ function htmlBundleScriptPlugin(options = {}) {
3215
3224
  let contents = "";
3216
3225
  if (hasContent) {
3217
3226
  outfile = bundleOut ?? filePath;
3218
- if (inline) {
3227
+ if (isInlined) {
3219
3228
  entryPoint = metadata.filePath;
3220
3229
  contents = await this.stringify(scriptMetadata);
3221
3230
  } else {
@@ -3250,8 +3259,8 @@ function htmlBundleScriptPlugin(options = {}) {
3250
3259
  await this.rebase(clone, join(this.root, outfile));
3251
3260
  contents = await this.stringify(clone);
3252
3261
  }
3253
- const checkExternal = (string) => {
3254
- return matchPath(string, {
3262
+ const isExternalCheck = (string) => {
3263
+ return isPathMatch(string, {
3255
3264
  include: externals,
3256
3265
  ignore: externalsIgnore,
3257
3266
  root: this.root
@@ -3261,7 +3270,7 @@ function htmlBundleScriptPlugin(options = {}) {
3261
3270
  contents,
3262
3271
  entryPoint,
3263
3272
  outfile,
3264
- checkExternal
3273
+ isExternalCheck
3265
3274
  });
3266
3275
  if (bundleError) {
3267
3276
  printFmtError(`Failed to bundle the entry point "${entryPoint}"`, bundleError, {
@@ -3270,7 +3279,7 @@ function htmlBundleScriptPlugin(options = {}) {
3270
3279
  });
3271
3280
  continue;
3272
3281
  }
3273
- const newMetadataPath = normalize(inline ? filePath : outfile);
3282
+ const newMetadataPath = normalize(isInlined ? filePath : outfile);
3274
3283
  const newScriptMetadata = await this.load(newMetadataPath, {
3275
3284
  code: bundleString,
3276
3285
  type: "js"
@@ -3282,7 +3291,7 @@ function htmlBundleScriptPlugin(options = {}) {
3282
3291
  });
3283
3292
  continue;
3284
3293
  }
3285
- if (inline) {
3294
+ if (isInlined) {
3286
3295
  if (!scriptMetadataID) {
3287
3296
  printFmtError("Missing script metadata ID", {
3288
3297
  node,
@@ -3385,14 +3394,11 @@ function htmlBundleStylePlugin(options = {}) {
3385
3394
  if (!metadata) return readFileSync(absoluteFilePath, "utf8");
3386
3395
  return await this.stringify(metadata);
3387
3396
  } })], { from: resolve(this.root, metadata.filePath) });
3388
- if (processError !== null) {
3389
- printFmtError(processError, {
3390
- function: htmlBundleStylePlugin,
3391
- node,
3392
- filePath: metadata.id
3393
- });
3394
- continue;
3395
- }
3397
+ if (processError !== null) printFmtError(processError, {
3398
+ function: htmlBundleStylePlugin,
3399
+ node,
3400
+ filePath: metadata.id
3401
+ });
3396
3402
  }
3397
3403
  },
3398
3404
  lspHtmlData() {
@@ -3445,11 +3451,11 @@ function htmlFragmentPlugin(options = {}) {
3445
3451
  function isTopLevelIIFE(ast) {
3446
3452
  const body = ast.program.body;
3447
3453
  if (body.length !== 1) return false;
3448
- const stmt = body[0];
3449
- if (stmt.type !== "ExpressionStatement") return false;
3450
- const expr = stmt.expression;
3451
- if (expr.type !== "CallExpression") return false;
3452
- const callee = expr.callee;
3454
+ const statement = body[0];
3455
+ if (statement.type !== "ExpressionStatement") return false;
3456
+ const expression = statement.expression;
3457
+ if (expression.type !== "CallExpression") return false;
3458
+ const callee = expression.callee;
3453
3459
  return callee.type === "ArrowFunctionExpression" || callee.type === "FunctionExpression";
3454
3460
  }
3455
3461
  /**
@@ -3526,10 +3532,7 @@ function htmlIifeScriptPlugin(options = {}) {
3526
3532
  continue;
3527
3533
  }
3528
3534
  const [, wrapError] = wrapWithIIFE(scriptMetadata.ast);
3529
- if (wrapError) {
3530
- printFmtError("Error wrapping script in IIFE", wrapError);
3531
- continue;
3532
- }
3535
+ if (wrapError) printFmtError("Error wrapping script in IIFE", wrapError);
3533
3536
  }
3534
3537
  },
3535
3538
  lspHtmlData() {
@@ -3607,7 +3610,7 @@ function htmlInlineScriptPlugin(options = {}) {
3607
3610
  async function loadScriptMetadata(source, filePath) {
3608
3611
  if (isURL(source)) {
3609
3612
  const urlHash = await crypto.subtle.digest("SHA-1", new TextEncoder().encode(source));
3610
- const hashHex = Array.from(new Uint8Array(urlHash)).map((b) => b.toString(16).padStart(2, "0")).join("");
3613
+ const hashHex = Array.from(new Uint8Array(urlHash), (b) => b.toString(16).padStart(2, "0")).join("");
3611
3614
  const downloadedFilePath = join(dirname(filePath), `downloaded/${hashHex}.css`);
3612
3615
  for (const metadata of this.metadataList) if (isScriptMetadata(metadata) && metadata.filePath === downloadedFilePath) return [metadata, null];
3613
3616
  const [downloaded, downloadError] = await downloadContent(source);
@@ -3684,7 +3687,7 @@ function htmlInlineStylePlugin(options = {}) {
3684
3687
  async function loadStyleMetadata(source, filePath) {
3685
3688
  if (isURL(source)) {
3686
3689
  const urlHash = await crypto.subtle.digest("SHA-1", new TextEncoder().encode(source));
3687
- const hashHex = Array.from(new Uint8Array(urlHash)).map((b) => b.toString(16).padStart(2, "0")).join("");
3690
+ const hashHex = Array.from(new Uint8Array(urlHash), (b) => b.toString(16).padStart(2, "0")).join("");
3688
3691
  const downloadedFilePath = join(dirname(filePath), `downloaded/${hashHex}.css`);
3689
3692
  for (const metadata of this.metadataList) if (isStyleMetadata(metadata) && metadata.filePath === downloadedFilePath) return [metadata, null];
3690
3693
  const [downloaded, downloadError] = await downloadContent(source);
@@ -3770,7 +3773,7 @@ function HtmlInlineSvgPlugin(options = {}) {
3770
3773
  async function loadSvgMetadata(source, filePath) {
3771
3774
  if (isURL(source)) {
3772
3775
  const urlHash = await crypto.subtle.digest("SHA-1", new TextEncoder().encode(source));
3773
- const hashHex = Array.from(new Uint8Array(urlHash)).map((b) => b.toString(16).padStart(2, "0")).join("");
3776
+ const hashHex = Array.from(new Uint8Array(urlHash), (b) => b.toString(16).padStart(2, "0")).join("");
3774
3777
  const downloadedFilePath = join(dirname(filePath), `downloaded/${hashHex}.css`);
3775
3778
  for (const metadata of this.metadataList) if (isSvgMetadata(metadata) && metadata.filePath === downloadedFilePath) return [metadata, null];
3776
3779
  const [downloaded, downloadError] = await downloadContent(source);
@@ -3798,7 +3801,7 @@ function htmlInlineTextPlugin(options = {}) {
3798
3801
  const sourceAttribute = options.sourceAttribute ?? "src";
3799
3802
  const noEscapeAttribute = options.noEscapeAttribute ?? "no-escape";
3800
3803
  const cache = /* @__PURE__ */ new Map();
3801
- const deps = new DependencyTracker();
3804
+ const dependencies = new DependencyTracker();
3802
3805
  return {
3803
3806
  name: "html-inline-text",
3804
3807
  sourcesProvider(metadata) {
@@ -3850,16 +3853,16 @@ function htmlInlineTextPlugin(options = {}) {
3850
3853
  currentSources.add(sourceRelative);
3851
3854
  inlineTag.replaceWith(contents);
3852
3855
  }
3853
- deps.update(metadata.id, currentSources);
3856
+ dependencies.update(metadata.id, currentSources);
3854
3857
  },
3855
3858
  onFileEvent(event, id) {
3856
3859
  if (event === "unlink" || event === "change") cache.delete(id);
3857
- if (event === "unlink") deps.delete(id);
3860
+ if (event === "unlink") dependencies.delete(id);
3858
3861
  },
3859
3862
  resolveCompileList(compileSet, event) {
3860
3863
  if (event !== "change") return;
3861
3864
  for (const id of Array.from(compileSet)) {
3862
- const importers = deps.getImporters(id);
3865
+ const importers = dependencies.getImporters(id);
3863
3866
  for (const importer of importers) compileSet.add(importer);
3864
3867
  }
3865
3868
  },
@@ -4100,7 +4103,8 @@ function htmlLayoutPlugin(options = {}) {
4100
4103
  const queue = [id];
4101
4104
  while (queue.length > 0) {
4102
4105
  const current = queue.shift();
4103
- for (const metadata of this.metadataList) if (metadata.directDependencies.has(current) && !compileSet.has(metadata.id)) {
4106
+ for (const metadata of this.metadataList) {
4107
+ if (!(metadata.directDependencies.has(current) && !compileSet.has(metadata.id))) continue;
4104
4108
  compileSet.add(metadata.id);
4105
4109
  if (isLayoutPath(metadata.id)) queue.push(metadata.id);
4106
4110
  }
@@ -4172,7 +4176,7 @@ function htmlLayoutPlugin(options = {}) {
4172
4176
  skip();
4173
4177
  continue;
4174
4178
  }
4175
- Object.assign(fillData, { ...node.attributes });
4179
+ Object.assign(fillData, node.attributes);
4176
4180
  const [layoutCode, fillError] = fillLayoutPlaceholders(layoutAssetMetadata.code, fillData);
4177
4181
  if (fillError) {
4178
4182
  printFmtError(fillError, {
@@ -4267,7 +4271,7 @@ function htmlLayoutPlugin(options = {}) {
4267
4271
  }
4268
4272
  for (const dependency of layoutHtmlMetadata.directDependencies) metadata.directDependencies.add(dependency);
4269
4273
  await this.rebase(layoutHtmlMetadata, join(this.root, metadata.filePath));
4270
- const children = node.querySelectorAll("> *");
4274
+ const children = node.querySelectorAll(":scope > *");
4271
4275
  for (const element of children) {
4272
4276
  if (element.nodeType !== NodeType.ELEMENT_NODE) continue;
4273
4277
  if (!element.hasAttribute("slot")) {
@@ -4381,7 +4385,7 @@ function htmlMarkdownPlugin(options = {}) {
4381
4385
  const mdAttribute = options.markdownAttribute ?? "markdown";
4382
4386
  const markdownTag = options.tag ?? "markdown";
4383
4387
  const sourceAttribute = options.sourceAttribute ?? "src";
4384
- const deps = new DependencyTracker();
4388
+ const dependencies = new DependencyTracker();
4385
4389
  const printFmtError = PrintFormattedError.create({ function: htmlMarkdownPlugin });
4386
4390
  return {
4387
4391
  name: "html-markdown",
@@ -4484,15 +4488,15 @@ function htmlMarkdownPlugin(options = {}) {
4484
4488
  await this.rebase(htmlMetadata, join(this.root, metadata.filePath));
4485
4489
  node.replaceWith(...htmlMetadata.ast.children);
4486
4490
  }
4487
- deps.update(metadata.id, currentSources);
4491
+ dependencies.update(metadata.id, currentSources);
4488
4492
  },
4489
4493
  onFileEvent(event, id) {
4490
- if (event === "unlink") deps.delete(id);
4494
+ if (event === "unlink") dependencies.delete(id);
4491
4495
  },
4492
4496
  resolveCompileList(compileSet, event) {
4493
4497
  if (event !== "change") return;
4494
4498
  for (const id of Array.from(compileSet)) {
4495
- const importers = deps.getImporters(id);
4499
+ const importers = dependencies.getImporters(id);
4496
4500
  for (const importer of importers) compileSet.add(importer);
4497
4501
  }
4498
4502
  },
@@ -4576,7 +4580,7 @@ function htmlMergeStylesPlugin() {
4576
4580
  //#endregion
4577
4581
  //#region src/plugins/core-plugins/base-plugin/base-plugin.ts
4578
4582
  function coreBasePlugin() {
4579
- const JS_EXTENSIONS = new Set([
4583
+ const JS_EXTENSIONS = /* @__PURE__ */ new Set([
4580
4584
  ".js",
4581
4585
  ".mjs",
4582
4586
  ".cjs",
@@ -4679,8 +4683,7 @@ function isSelfReference(sourceAbsolute, filePathAbsolute) {
4679
4683
  if (replaceExtension(sourceAbsolute, ".html") === filePathAbsolute) return true;
4680
4684
  if (replaceExtension(sourceAbsolute, ".md") === filePathAbsolute) return true;
4681
4685
  if (join(sourceAbsolute, "index.html") === filePathAbsolute) return true;
4682
- if (join(sourceAbsolute, "index.md") === filePathAbsolute) return true;
4683
- return false;
4686
+ return join(sourceAbsolute, "index.md") === filePathAbsolute;
4684
4687
  }
4685
4688
 
4686
4689
  //#endregion
@@ -4861,7 +4864,7 @@ function fillDynamicPath(path, parameters) {
4861
4864
  const key = dynamicMatch[1];
4862
4865
  const value = parameters[key] ?? dynamicMatch[0];
4863
4866
  if (value.includes("/")) throw new Error(`Dynamic param "${key}" contains slashes. Use "[...${key}]" for catch-all routes.`);
4864
- result.push(segment.replace(/\[([^\]]+)\]/, value));
4867
+ result.push(segment.replace(/\[([^\]]+)\]/, () => value));
4865
4868
  continue;
4866
4869
  }
4867
4870
  result.push(segment);
@@ -4960,10 +4963,10 @@ function htmlPagesPlugin(options = {}) {
4960
4963
  rebaseSource(source, filePath, newAbsolutePath) {
4961
4964
  if (!isValidRelativePath(source)) return;
4962
4965
  const relativeNewPath = relative(this.root, newAbsolutePath);
4963
- const rebasingFromPages = isPageDirectorySubpath(filePath, pagesDirectory);
4964
- const rebasingToPages = isPageDirectorySubpath(relativeNewPath, pagesDirectory);
4965
- if (rebasingFromPages && rebasingToPages) return;
4966
- if (!rebasingFromPages && !rebasingToPages) return;
4966
+ const isRebasingFromPages = isPageDirectorySubpath(filePath, pagesDirectory);
4967
+ const isRebasingToPages = isPageDirectorySubpath(relativeNewPath, pagesDirectory);
4968
+ if (isRebasingFromPages && isRebasingToPages) return;
4969
+ if (!isRebasingFromPages && !isRebasingToPages) return;
4967
4970
  const [link, suffix] = splitHtmlLink(source);
4968
4971
  if (["index.html", "index.md"].includes(basename(filePath)) && [
4969
4972
  "./",
@@ -5143,7 +5146,7 @@ function htmlPreloadPlugin(options = {}) {
5143
5146
  },
5144
5147
  async postTransform() {
5145
5148
  if (!this.production) return;
5146
- const depsFinder = new DepsFinder(this, this.root);
5149
+ const dependenciesFinder = new DependenciesFinder(this, this.root);
5147
5150
  for (const htmlMetadata of this.metadataList) {
5148
5151
  if (!isHtmlMetadata(htmlMetadata)) continue;
5149
5152
  const head = htmlMetadata.ast.querySelector("head");
@@ -5172,19 +5175,19 @@ function htmlPreloadPlugin(options = {}) {
5172
5175
  });
5173
5176
  continue;
5174
5177
  }
5175
- const deps = await depsFinder.findDeps(metadata);
5178
+ const dependencies = await dependenciesFinder.findDeps(metadata);
5176
5179
  const source = node.getAttribute("src") ?? node.getAttribute("href");
5177
5180
  if (isScript && source || isStyleSheetLink && source) {
5178
5181
  const [link] = splitHtmlLink(source);
5179
- deps.add(join(this.root, dirname(htmlMetadata.filePath), link));
5182
+ dependencies.add(join(this.root, dirname(htmlMetadata.filePath), link));
5180
5183
  }
5181
- for (const dep of deps) {
5182
- if (!matchPath(relative(this.root, dep), {
5184
+ for (const dependency of dependencies) {
5185
+ if (!isPathMatch(relative(this.root, dependency), {
5183
5186
  include,
5184
5187
  ignore,
5185
5188
  root: this.root
5186
5189
  })) continue;
5187
- preloadPaths.add(relative(dirname(htmlMetadata.filePath), dep));
5190
+ preloadPaths.add(relative(dirname(htmlMetadata.filePath), dependency));
5188
5191
  }
5189
5192
  }
5190
5193
  const linkTags = [];
@@ -5254,7 +5257,7 @@ function createLinkTag(info, href) {
5254
5257
  //#endregion
5255
5258
  //#region src/ast-utilities/html-utils/parse-html-sources.ts
5256
5259
  const attributeTagsMap = {
5257
- src: new Set([
5260
+ src: /* @__PURE__ */ new Set([
5258
5261
  "img",
5259
5262
  "video",
5260
5263
  "audio",
@@ -5265,24 +5268,24 @@ const attributeTagsMap = {
5265
5268
  "embed",
5266
5269
  "input"
5267
5270
  ]),
5268
- srcset: new Set(["img", "source"]),
5269
- href: new Set([
5271
+ srcset: /* @__PURE__ */ new Set(["img", "source"]),
5272
+ href: /* @__PURE__ */ new Set([
5270
5273
  "a",
5271
5274
  "area",
5272
5275
  "link",
5273
5276
  "base"
5274
5277
  ]),
5275
- data: new Set(["object"]),
5276
- action: new Set(["form"]),
5277
- formaction: new Set(["button", "input"]),
5278
- poster: new Set(["video"]),
5279
- cite: new Set([
5278
+ data: /* @__PURE__ */ new Set(["object"]),
5279
+ action: /* @__PURE__ */ new Set(["form"]),
5280
+ formaction: /* @__PURE__ */ new Set(["button", "input"]),
5281
+ poster: /* @__PURE__ */ new Set(["video"]),
5282
+ cite: /* @__PURE__ */ new Set([
5280
5283
  "blockquote",
5281
5284
  "del",
5282
5285
  "ins",
5283
5286
  "q"
5284
5287
  ]),
5285
- ping: new Set(["a", "area"])
5288
+ ping: /* @__PURE__ */ new Set(["a", "area"])
5286
5289
  };
5287
5290
  const tagAttributeMap = /* @__PURE__ */ new Map();
5288
5291
  const selectorParts = [];
@@ -5316,8 +5319,8 @@ function stringifySrcset(entries) {
5316
5319
  for (const entry of entries) srcset += entry.descriptor ? `, ${entry.url} ${entry.descriptor}` : `, ${entry.url}`;
5317
5320
  return srcset;
5318
5321
  }
5319
- /** Match placeholders [[ has $ ]] or {{ has $ }} */
5320
- const placeholderRe = /(?:\[\[([^\]]*\$[^\]]*?)\]\]|\{\{([^}]*\$[^}]*?)\}\})/;
5322
+ /** Match placeholders [[ ]] or {{ }} */
5323
+ const placeholderRe = /(?:\[\[([^\]]*[^\]]*?)\]\]|\{\{([^}]*[^}]*?)\}\})/;
5321
5324
  function parseHtmlSources(ast) {
5322
5325
  const links = [];
5323
5326
  for (const node of ast.querySelectorAll(combinedSelector)) {
@@ -5544,12 +5547,12 @@ function coreHtmlPlugin(options = {}) {
5544
5547
  //#endregion
5545
5548
  //#region src/plugins/core-plugins/markdown-metadata/markdown-metadata-plugin.ts
5546
5549
  function coreMarkdownPlugin(options = {}) {
5547
- const allowDangerousHtml = options.allowDangerousHtml ?? false;
5548
- const processor = remark().use(remarkFrontmatter, ["yaml"]).use(remarkGfm).use(remarkBreaks).use(remarkSmartypants).use(options.remarkPlugins ?? []);
5549
- const htmlProcessor = unified().use(remarkRehype, { allowDangerousHtml }).use(rehypeSlug).use(rehypeExternalLinks, {
5550
+ const shouldAllowDangerousHtml = options.allowDangerousHtml ?? false;
5551
+ const processor = remark().use(remarkFrontmatter, ["yaml"]).use(remarkGfm).use(remarkSmartypants).use(options.remarkPlugins ?? []);
5552
+ const htmlProcessor = unified().use(remarkRehype, { allowDangerousHtml: shouldAllowDangerousHtml }).use(rehypeSlug).use(rehypeExternalLinks, {
5550
5553
  target: "_blank",
5551
5554
  rel: ["noopener", "noreferrer"]
5552
- }).use(options.rehypePlugins ?? []).use(rehypeStringify, { allowDangerousHtml });
5555
+ }).use(options.rehypePlugins ?? []).use(rehypeStringify, { allowDangerousHtml: shouldAllowDangerousHtml });
5553
5556
  async function parseMarkdown(code) {
5554
5557
  try {
5555
5558
  const root = processor.parse(code);
@@ -5749,9 +5752,9 @@ function parseScriptSources({ ast }) {
5749
5752
 
5750
5753
  //#endregion
5751
5754
  //#region src/plugins/core-plugins/script-metadata/minify-script.ts
5752
- function minifyScriptSWC(code, module) {
5755
+ function minifyScriptSWC(code, isModule) {
5753
5756
  try {
5754
- const minified = minifySync(code, { module });
5757
+ const minified = minifySync(code, { module: isModule });
5755
5758
  if (!minified.code) return [null, /* @__PURE__ */ new Error("Failed to minify script: empty output")];
5756
5759
  return [minified.code, null];
5757
5760
  } catch (error) {
@@ -5799,8 +5802,9 @@ function scriptLoader(relativePath, code) {
5799
5802
 
5800
5803
  //#endregion
5801
5804
  //#region src/plugins/core-plugins/script-metadata/script-metadata-plugin.ts
5805
+ const generator = typeof _generator === "function" ? _generator : _generator.default;
5802
5806
  function coreScriptPlugin() {
5803
- const jsExtensions = new Set([
5807
+ const jsExtensions = /* @__PURE__ */ new Set([
5804
5808
  ".js",
5805
5809
  ".mjs",
5806
5810
  ".cjs",
@@ -5865,17 +5869,17 @@ function coreScriptPlugin() {
5865
5869
  const cssUrlRe = /url\((['"]?)(.+?)\1\)/gm;
5866
5870
  function parseStyleSources(ast) {
5867
5871
  const handles = [];
5868
- ast.walkDecls((decl) => {
5869
- for (const match of decl.value.matchAll(cssUrlRe)) {
5872
+ ast.walkDecls((declaration) => {
5873
+ for (const match of declaration.value.matchAll(cssUrlRe)) {
5870
5874
  const source = match[2];
5871
5875
  if (!source) continue;
5872
5876
  handles.push({
5873
- node: decl,
5877
+ node: declaration,
5874
5878
  get source() {
5875
5879
  return source;
5876
5880
  },
5877
5881
  set source(newSource) {
5878
- decl.value = decl.value.replace(source, newSource);
5882
+ declaration.value = declaration.value.replace(source, () => newSource);
5879
5883
  }
5880
5884
  });
5881
5885
  }
@@ -5891,7 +5895,7 @@ function parseStyleSources(ast) {
5891
5895
  return source;
5892
5896
  },
5893
5897
  set source(newSource) {
5894
- atRule.params = atRule.params.replace(source, newSource);
5898
+ atRule.params = atRule.params.replace(source, () => newSource);
5895
5899
  }
5896
5900
  });
5897
5901
  }
@@ -5901,13 +5905,14 @@ function parseStyleSources(ast) {
5901
5905
 
5902
5906
  //#endregion
5903
5907
  //#region src/plugins/core-plugins/style-metadata/minify-style.ts
5904
- function minifyLightingCss(code, filename) {
5908
+ function minifyLightingCss(code, filename, targets) {
5905
5909
  try {
5906
5910
  return [transform({
5907
5911
  filename,
5908
5912
  code: Buffer.from(code),
5909
5913
  minify: true,
5910
- analyzeDependencies: false
5914
+ analyzeDependencies: false,
5915
+ targets
5911
5916
  }).code.toString(), null];
5912
5917
  } catch (error) {
5913
5918
  return [null, error];
@@ -5939,8 +5944,12 @@ function styleLoader(relativePath, code) {
5939
5944
  //#endregion
5940
5945
  //#region src/plugins/core-plugins/style-metadata/style-metadata-plugin.ts
5941
5946
  function coreStylePlugin() {
5947
+ let targets;
5942
5948
  return {
5943
5949
  name: "core-style-metadata",
5950
+ setup() {
5951
+ targets = browserslistToTargets(this.browserslist);
5952
+ },
5944
5953
  load(content, relativePath, { type }) {
5945
5954
  type ??= extname(relativePath).slice(1);
5946
5955
  if (type !== "css") return;
@@ -5969,7 +5978,7 @@ function coreStylePlugin() {
5969
5978
  return formatted;
5970
5979
  }
5971
5980
  if (minify) {
5972
- const [minified, minifyError] = minifyLightingCss(code, metadata.filePath);
5981
+ const [minified, minifyError] = minifyLightingCss(code, metadata.filePath, targets);
5973
5982
  if (minifyError) {
5974
5983
  this.log.error("Failed to minify style", metadata.filePath);
5975
5984
  return;
@@ -6282,8 +6291,8 @@ function orderByDependencyDepth(allMetadata, entryPoints, filePaths) {
6282
6291
  const metadata = metadataById.get(id);
6283
6292
  if (!metadata) continue;
6284
6293
  if (depth >= allMetadata.length) continue;
6285
- for (const depId of metadata.directDependencies) queue.push({
6286
- id: depId,
6294
+ for (const dependencyId of metadata.directDependencies) queue.push({
6295
+ id: dependencyId,
6287
6296
  depth: depth + 1
6288
6297
  });
6289
6298
  }
@@ -6348,7 +6357,7 @@ function developmentServerPlugin(options = {}) {
6348
6357
  this.log.error(error.message);
6349
6358
  throw new Error(error.message);
6350
6359
  }
6351
- this.log.info(c.bold("Server listening on"), c.green(address + entry));
6360
+ this.log.info(chalk.bold("Server listening on"), chalk.green(address + entry));
6352
6361
  });
6353
6362
  websocket.on("connection", () => {
6354
6363
  const sortedByAge = Array.from(entryPointAgeMap).toSorted((a, b) => a[1] - b[1]).map(([id]) => id);
@@ -6373,18 +6382,18 @@ function developmentServerPlugin(options = {}) {
6373
6382
  for (const id of ordered) {
6374
6383
  const oldMetadataList = this.filterMetadata({ id });
6375
6384
  if (oldMetadataList.length === 0) continue;
6376
- const oldDeps = new Set(oldMetadataList.flatMap((m) => Array.from(m.directDependencies)));
6385
+ const oldDependencies = new Set(oldMetadataList.flatMap((m) => Array.from(m.directDependencies)));
6377
6386
  this.removeMetadata(oldMetadataList);
6378
6387
  if (!await this.process(id)) {
6379
6388
  this.addMetadata(oldMetadataList);
6380
6389
  continue;
6381
6390
  }
6382
6391
  const newMetadataList = this.filterMetadata({ id });
6383
- const newDeps = new Set(newMetadataList.flatMap((m) => Array.from(m.directDependencies)));
6384
- const removedDeps = Array.from(oldDeps).filter((dep) => !newDeps.has(dep));
6385
- for (const dep of removedDeps) {
6386
- if (this.metadataList.some((m) => m.directDependencies && m.directDependencies.has(dep))) continue;
6387
- const orphans = this.filterMetadata({ id: dep });
6392
+ const newDependencies = new Set(newMetadataList.flatMap((m) => Array.from(m.directDependencies)));
6393
+ const removedDependencies = Array.from(oldDependencies).filter((dependency) => !newDependencies.has(dependency));
6394
+ for (const dependency of removedDependencies) {
6395
+ if (this.metadataList.some((m) => m.directDependencies && m.directDependencies.has(dependency))) continue;
6396
+ const orphans = this.filterMetadata({ id: dependency });
6388
6397
  if (orphans && orphans.length > 0) this.removeMetadata(orphans);
6389
6398
  }
6390
6399
  if (extname(id) !== ".css") isStyleOnly = false;
@@ -6392,7 +6401,10 @@ function developmentServerPlugin(options = {}) {
6392
6401
  }
6393
6402
  if (isStyleOnly) {
6394
6403
  const rootCssFiles = /* @__PURE__ */ new Set();
6395
- for (const htmlId of affected) for (const meta of this.filterMetadata({ id: htmlId })) for (const dep of meta.directDependencies) if (extname(dep) === ".css") rootCssFiles.add(dep);
6404
+ for (const htmlId of affected) {
6405
+ const metadataListWithId = this.filterMetadata({ id: htmlId });
6406
+ for (const meta of metadataListWithId) for (const dependency of meta.directDependencies) if (extname(dependency) === ".css") rootCssFiles.add(dependency);
6407
+ }
6396
6408
  sendMessageToClients(rootCssFiles.size > 0 ? Array.from(rootCssFiles) : [changedSource]);
6397
6409
  return;
6398
6410
  }
@@ -6432,9 +6444,9 @@ function isDependency(allMetadata, metadata, filePath) {
6432
6444
  visited.add(current);
6433
6445
  const currentMetadata = metadataByPath.get(current);
6434
6446
  if (!currentMetadata) continue;
6435
- for (const dep of currentMetadata.directDependencies) {
6436
- if (dep === filePath) return true;
6437
- if (!visited.has(dep)) queue.push(dep);
6447
+ for (const dependency of currentMetadata.directDependencies) {
6448
+ if (dependency === filePath) return true;
6449
+ if (!visited.has(dependency)) queue.push(dependency);
6438
6450
  }
6439
6451
  }
6440
6452
  return false;
@@ -6458,19 +6470,18 @@ function removeAndPruneOrphans(metadataList, targetId) {
6458
6470
  removed.add(currentId);
6459
6471
  const entries = metadataList.filter((m) => m.id === currentId);
6460
6472
  if (entries.length === 0) continue;
6461
- const deps = new Set(entries.flatMap((m) => [...m.directDependencies]));
6473
+ const dependencies = new Set(entries.flatMap((m) => [...m.directDependencies]));
6462
6474
  for (let index = metadataList.length - 1; index >= 0; index--) if (metadataList[index].id === currentId) metadataList.splice(index, 1);
6463
- for (const depId of deps) if (!metadataList.some((m) => m.directDependencies.has(depId))) queue.push(depId);
6475
+ for (const dependencyId of dependencies) if (!metadataList.some((m) => m.directDependencies.has(dependencyId))) queue.push(dependencyId);
6464
6476
  }
6465
6477
  }
6466
6478
 
6467
6479
  //#endregion
6468
6480
  //#region src/helpers/pirnt-debug.ts
6469
6481
  function formatDuration(ms) {
6470
- if (ms < 1) return c.gray(`${(ms * 1e3).toFixed(2)}μs`);
6471
- else if (ms < 1e3) return (ms < 100 ? c.green : ms < 500 ? c.yellow : c.red)(`${ms.toFixed(2)}ms`);
6472
- else if (ms < 6e4) return c.redBright(`${(ms / 1e3).toFixed(2)}s`);
6473
- else return c.magenta(`${(ms / 6e4).toFixed(2)}m`);
6482
+ if (ms < 1) return chalk.gray(`${(ms * 1e3).toFixed(2)}μs`);
6483
+ if (ms < 1e3) return (ms < 100 ? chalk.green : ms < 500 ? chalk.yellow : chalk.red)(`${ms.toFixed(2)}ms`);
6484
+ return ms < 6e4 ? chalk.redBright(`${(ms / 1e3).toFixed(2)}s`) : chalk.magenta(`${(ms / 6e4).toFixed(2)}m`);
6474
6485
  }
6475
6486
  function buildBar(value, total) {
6476
6487
  const BAR_WIDTH = 16;
@@ -6478,7 +6489,7 @@ function buildBar(value, total) {
6478
6489
  const filled = Math.round(ratio * BAR_WIDTH);
6479
6490
  const empty = BAR_WIDTH - filled;
6480
6491
  const pct = (ratio * 100).toFixed(0).padStart(3);
6481
- return (ratio < .2 ? c.green("█".repeat(filled)) : ratio < .5 ? c.yellow("█".repeat(filled)) : c.red("█".repeat(filled))) + c.dim("░".repeat(empty)) + c.dim(` ${pct}%`);
6492
+ return (ratio < .2 ? chalk.green("█".repeat(filled)) : ratio < .5 ? chalk.yellow("█".repeat(filled)) : chalk.red("█".repeat(filled))) + chalk.dim("░".repeat(empty)) + chalk.dim(` ${pct}%`);
6482
6493
  }
6483
6494
  function printExecutionTime(executionTime) {
6484
6495
  const sortedGroups = Object.entries(executionTime).toSorted(([, a], [, b]) => {
@@ -6490,13 +6501,13 @@ function printExecutionTime(executionTime) {
6490
6501
  const entries = Object.entries(metrics).filter(([, v]) => v >= 1).toSorted(([, a], [, b]) => b - a);
6491
6502
  console.log();
6492
6503
  if (entries.length === 0) {
6493
- console.log(c.bold.cyan("─ ") + c.bold.white(groupName) + c.dim(` total: ${formatDuration(total)}`));
6504
+ console.log(chalk.bold.cyan("─ ") + chalk.bold.white(groupName) + chalk.dim(` total: ${formatDuration(total)}`));
6494
6505
  continue;
6495
6506
  }
6496
6507
  const maxLabelLength = Math.max(...entries.map(([k]) => k.length));
6497
- console.log(c.bold.cyan("─ ") + c.bold.white(groupName) + c.dim(` total: ${formatDuration(total)}`));
6508
+ console.log(chalk.bold.cyan("─ ") + chalk.bold.white(groupName) + chalk.dim(` total: ${formatDuration(total)}`));
6498
6509
  for (const [key, value] of entries) {
6499
- const label = c.dim(key.padEnd(maxLabelLength));
6510
+ const label = chalk.dim(key.padEnd(maxLabelLength));
6500
6511
  const bar = buildBar(value, total);
6501
6512
  const time = formatDuration(value);
6502
6513
  console.log(` ${label} ${bar} ${time}`);
@@ -6542,7 +6553,8 @@ var App = class {
6542
6553
  this.outdir = isAbsolute(options.outdir) ? options.outdir : join(this.root, options.outdir);
6543
6554
  this.browserslist = browserslistFn(options.browserslist, { path: this.root });
6544
6555
  this.resolver = new Resolver(this.root);
6545
- for (const [index, pluginOrPlugins] of (options.plugins ?? []).entries()) {
6556
+ const pluginsEntries = (options.plugins ?? []).entries();
6557
+ for (const [index, pluginOrPlugins] of pluginsEntries) {
6546
6558
  const items = Array.isArray(pluginOrPlugins) ? pluginOrPlugins : [pluginOrPlugins];
6547
6559
  for (const [itemIndex, plugin] of items.entries()) this.plugins.push(this.bindPlugin(plugin, index + itemIndex));
6548
6560
  }
@@ -6719,7 +6731,7 @@ var App = class {
6719
6731
  this.log.error(`[transformAndSync] Plugin index is not set.`);
6720
6732
  return;
6721
6733
  }
6722
- if (!this.plugins[this.pluginIndex]) {
6734
+ if (!Object.hasOwn(this.plugins, this.pluginIndex)) {
6723
6735
  this.log.error(`[transformAndSync] Plugin with index "${this.pluginIndex}" does not exist.`);
6724
6736
  return;
6725
6737
  }
@@ -6788,7 +6800,7 @@ var App = class {
6788
6800
  }
6789
6801
  async getCompileList(event, filePath) {
6790
6802
  filePath = normalize(filePath);
6791
- const compileSet = new Set([filePath]);
6803
+ const compileSet = /* @__PURE__ */ new Set([filePath]);
6792
6804
  for (const plugin of this.plugins) await this.callPluginMethod(plugin, "resolveCompileList", compileSet, event, filePath);
6793
6805
  return compileSet;
6794
6806
  }
@@ -6833,12 +6845,12 @@ var App = class {
6833
6845
  findMetadata(metadataFilter) {
6834
6846
  for (const metadata of this.metadataList) {
6835
6847
  if (metadata === metadataFilter) return metadata;
6836
- let match = true;
6848
+ let isMatch = true;
6837
6849
  for (const [key, value] of Object.entries(metadataFilter)) if (metadata[key] !== value) {
6838
- match = false;
6850
+ isMatch = false;
6839
6851
  break;
6840
6852
  }
6841
- if (match) return metadata;
6853
+ if (isMatch) return metadata;
6842
6854
  }
6843
6855
  }
6844
6856
  filterMetadata(metadataFilter) {
@@ -6867,7 +6879,7 @@ function buildCliPlugin(options = {}) {
6867
6879
  const startTime = performance.now();
6868
6880
  config.production = true;
6869
6881
  await new App(config, configPath).run();
6870
- Log.info(`Built in ${c.bold.green(Math.round(performance.now() - startTime) / 1e3)} seconds.`);
6882
+ Log.info(`Built in ${chalk.bold.green(Math.round(performance.now() - startTime) / 1e3)} seconds.`);
6871
6883
  });
6872
6884
  this.addCommand(buildCommand);
6873
6885
  }
@@ -7138,7 +7150,7 @@ const MathUtilities = {
7138
7150
 
7139
7151
  //#endregion
7140
7152
  //#region src/plugins/cli-plugins/material-you/material-you/cam/hct-solver.ts
7141
- var HctSolver = class HctSolver {
7153
+ var HctSolver = class {
7142
7154
  /** Weights for transforming a set of linear RGB coordinates to Y in XYZ. */
7143
7155
  static Y_FROM_LINRGB = [
7144
7156
  .2126,
@@ -7448,8 +7460,8 @@ var HctSolver = class HctSolver {
7448
7460
  * @returns A degree measure between 0.0 (inclusive) and 360.0 (exclusive).
7449
7461
  */
7450
7462
  static sanitizeDegreesDouble(degrees) {
7451
- degrees = degrees % 360;
7452
- if (degrees < 0) degrees = degrees + 360;
7463
+ degrees %= 360;
7464
+ if (degrees < 0) degrees += 360;
7453
7465
  return degrees;
7454
7466
  }
7455
7467
  /** Equation used in CAM16 conversion that removes the effect of chromatic adaptation. */
@@ -7470,15 +7482,15 @@ var HctSolver = class HctSolver {
7470
7482
  let index = Math.sqrt(y) * 11;
7471
7483
  const viewingConditions = Frame.DEFAULT, tInnerCoeff = 1 / Math.pow(1.64 - Math.pow(.29, viewingConditions.getN()), .73), p1 = .25 * (Math.cos(hueRadians + 2) + 3.8) * (5e4 / 13) * viewingConditions.getNc() * viewingConditions.getNcb(), hSin = Math.sin(hueRadians), hCos = Math.cos(hueRadians);
7472
7484
  for (let iterationRound = 0; iterationRound < 5; iterationRound++) {
7473
- const indexNormalized = index / 100, alpha = chroma === 0 || index === 0 ? 0 : chroma / Math.sqrt(indexNormalized), t = Math.pow(alpha * tInnerCoeff, 1 / .9), acExponent = 1 / viewingConditions.getC() / viewingConditions.getZ(), p2 = viewingConditions.getAw() * Math.pow(indexNormalized, acExponent) / viewingConditions.getNbb(), gamma = 23 * (p2 + .305) * t / (23 * p1 + 11 * t * hCos + 108 * t * hSin), a = gamma * hCos, b = gamma * hSin, rA = (460 * p2 + 451 * a + 288 * b) / 1403, gA = (460 * p2 - 891 * a - 261 * b) / 1403, bA = (460 * p2 - 220 * a - 6300 * b) / 1403, rCScaled = HctSolver.inverseChromaticAdaptation(rA), gCScaled = HctSolver.inverseChromaticAdaptation(gA), bCScaled = HctSolver.inverseChromaticAdaptation(bA), matrix = HctSolver.LINRGB_FROM_SCALED_DISCOUNT, linrgbR = rCScaled * matrix[0][0] + gCScaled * matrix[0][1] + bCScaled * matrix[0][2], linrgbG = rCScaled * matrix[1][0] + gCScaled * matrix[1][1] + bCScaled * matrix[1][2], linrgbB = rCScaled * matrix[2][0] + gCScaled * matrix[2][1] + bCScaled * matrix[2][2];
7485
+ const indexNormalized = index / 100, alpha = chroma === 0 || index === 0 ? 0 : chroma / Math.sqrt(indexNormalized), t = Math.pow(alpha * tInnerCoeff, 1 / .9), acExponent = 1 / viewingConditions.getC() / viewingConditions.getZ(), p2 = viewingConditions.getAw() * Math.pow(indexNormalized, acExponent) / viewingConditions.getNbb(), gamma = 23 * (p2 + .305) * t / (23 * p1 + 11 * t * hCos + 108 * t * hSin), a = gamma * hCos, b = gamma * hSin, rA = (460 * p2 + 451 * a + 288 * b) / 1403, gA = (460 * p2 - 891 * a - 261 * b) / 1403, bA = (460 * p2 - 220 * a - 6300 * b) / 1403, rCScaled = this.inverseChromaticAdaptation(rA), gCScaled = this.inverseChromaticAdaptation(gA), bCScaled = this.inverseChromaticAdaptation(bA), matrix = this.LINRGB_FROM_SCALED_DISCOUNT, linrgbR = rCScaled * matrix[0][0] + gCScaled * matrix[0][1] + bCScaled * matrix[0][2], linrgbG = rCScaled * matrix[1][0] + gCScaled * matrix[1][1] + bCScaled * matrix[1][2], linrgbB = rCScaled * matrix[2][0] + gCScaled * matrix[2][1] + bCScaled * matrix[2][2];
7474
7486
  if (linrgbR < 0 || linrgbG < 0 || linrgbB < 0) return 0;
7475
- const kR = HctSolver.Y_FROM_LINRGB[0], kG = HctSolver.Y_FROM_LINRGB[1], kB = HctSolver.Y_FROM_LINRGB[2], fnj = kR * linrgbR + kG * linrgbG + kB * linrgbB;
7487
+ const kR = this.Y_FROM_LINRGB[0], kG = this.Y_FROM_LINRGB[1], kB = this.Y_FROM_LINRGB[2], fnj = kR * linrgbR + kG * linrgbG + kB * linrgbB;
7476
7488
  if (fnj <= 0) return 0;
7477
7489
  if (iterationRound === 4 || Math.abs(fnj - y) < .002) {
7478
7490
  if (linrgbR > 100.01 || linrgbG > 100.01 || linrgbB > 100.01) return 0;
7479
7491
  return CamUtilities.argbFromLinrgbComponents(linrgbR, linrgbG, linrgbB);
7480
7492
  }
7481
- index = index - (fnj - y) * index / (2 * fnj);
7493
+ index -= (fnj - y) * index / (2 * fnj);
7482
7494
  }
7483
7495
  return 0;
7484
7496
  }
@@ -7493,12 +7505,12 @@ var HctSolver = class HctSolver {
7493
7505
  */
7494
7506
  static solveToInt(hueDegrees, chroma, lstar) {
7495
7507
  if (chroma < 1e-4 || lstar < 1e-4 || lstar > 99.9999) return CamUtilities.argbFromLstar(lstar);
7496
- hueDegrees = HctSolver.sanitizeDegreesDouble(hueDegrees);
7508
+ hueDegrees = this.sanitizeDegreesDouble(hueDegrees);
7497
7509
  const hueRadians = MathUtilities.toRadians(hueDegrees);
7498
7510
  const y = CamUtilities.yFromLstar(lstar);
7499
- const exactAnswer = HctSolver.findResultByJ(hueRadians, chroma, y);
7511
+ const exactAnswer = this.findResultByJ(hueRadians, chroma, y);
7500
7512
  if (exactAnswer !== 0) return exactAnswer;
7501
- return HctSolver.bisectToLimit(y, hueRadians);
7513
+ return this.bisectToLimit(y, hueRadians);
7502
7514
  }
7503
7515
  /** Ensure X is between 0 and 100. */
7504
7516
  static isBounded(x) {
@@ -7513,12 +7525,12 @@ var HctSolver = class HctSolver {
7513
7525
  * it exists. If the possible vertex lies outside of the cube, [-1.0, -1.0, -1.0] is returned.
7514
7526
  */
7515
7527
  static nthVertex(y, n) {
7516
- const kR = HctSolver.Y_FROM_LINRGB[0], kG = HctSolver.Y_FROM_LINRGB[1], kB = HctSolver.Y_FROM_LINRGB[2], coordA = n % 4 <= 1 ? 0 : 100, coordB = n % 2 === 0 ? 0 : 100;
7528
+ const kR = this.Y_FROM_LINRGB[0], kG = this.Y_FROM_LINRGB[1], kB = this.Y_FROM_LINRGB[2], coordA = n % 4 <= 1 ? 0 : 100, coordB = n % 2 === 0 ? 0 : 100;
7517
7529
  if (n < 4) {
7518
7530
  const g = coordA;
7519
7531
  const b = coordB;
7520
7532
  const r = (y - g * kG - b * kB) / kR;
7521
- return HctSolver.isBounded(r) ? [
7533
+ return this.isBounded(r) ? [
7522
7534
  r,
7523
7535
  g,
7524
7536
  b
@@ -7527,24 +7539,12 @@ var HctSolver = class HctSolver {
7527
7539
  -1,
7528
7540
  -1
7529
7541
  ];
7530
- } else if (n < 8) {
7542
+ }
7543
+ if (n < 8) {
7531
7544
  const b = coordA;
7532
7545
  const r = coordB;
7533
7546
  const g = (y - r * kR - b * kB) / kG;
7534
- return HctSolver.isBounded(g) ? [
7535
- r,
7536
- g,
7537
- b
7538
- ] : [
7539
- -1,
7540
- -1,
7541
- -1
7542
- ];
7543
- } else {
7544
- const r = coordA;
7545
- const g = coordB;
7546
- const b = (y - r * kR - g * kG) / kB;
7547
- return HctSolver.isBounded(b) ? [
7547
+ return this.isBounded(g) ? [
7548
7548
  r,
7549
7549
  g,
7550
7550
  b
@@ -7554,6 +7554,18 @@ var HctSolver = class HctSolver {
7554
7554
  -1
7555
7555
  ];
7556
7556
  }
7557
+ const r = coordA;
7558
+ const g = coordB;
7559
+ const b = (y - r * kR - g * kG) / kB;
7560
+ return this.isBounded(b) ? [
7561
+ r,
7562
+ g,
7563
+ b
7564
+ ] : [
7565
+ -1,
7566
+ -1,
7567
+ -1
7568
+ ];
7557
7569
  }
7558
7570
  static chromaticAdaptation(component) {
7559
7571
  const af = Math.pow(Math.abs(component), .42);
@@ -7566,8 +7578,8 @@ var HctSolver = class HctSolver {
7566
7578
  * @returns The hue of the color in CAM16, in radians.
7567
7579
  */
7568
7580
  static hueOf(linrgb) {
7569
- const matrix = HctSolver.SCALED_DISCOUNT_FROM_LINRGB, row = linrgb, rD = linrgb[0] * matrix[0][0] + row[1] * matrix[0][1] + row[2] * matrix[0][2], gD = linrgb[0] * matrix[1][0] + row[1] * matrix[1][1] + row[2] * matrix[1][2], bD = linrgb[0] * matrix[2][0] + row[1] * matrix[2][1] + row[2] * matrix[2][2];
7570
- const rA = HctSolver.chromaticAdaptation(rD), gA = HctSolver.chromaticAdaptation(gD), bA = HctSolver.chromaticAdaptation(bD);
7581
+ const matrix = this.SCALED_DISCOUNT_FROM_LINRGB, row = linrgb, rD = linrgb[0] * matrix[0][0] + row[1] * matrix[0][1] + row[2] * matrix[0][2], gD = linrgb[0] * matrix[1][0] + row[1] * matrix[1][1] + row[2] * matrix[1][2], bD = linrgb[0] * matrix[2][0] + row[1] * matrix[2][1] + row[2] * matrix[2][2];
7582
+ const rA = this.chromaticAdaptation(rD), gA = this.chromaticAdaptation(gD), bA = this.chromaticAdaptation(bD);
7571
7583
  const a = (11 * rA + -12 * gA + bA) / 11;
7572
7584
  const b = (rA + gA - 2 * bA) / 9;
7573
7585
  return Math.atan2(b, a);
@@ -7592,7 +7604,7 @@ var HctSolver = class HctSolver {
7592
7604
  * @returns True if B is between A and C
7593
7605
  */
7594
7606
  static areInCyclicOrder(a, b, c) {
7595
- return HctSolver.sanitizeRadians(b - a) < HctSolver.sanitizeRadians(c - a);
7607
+ return this.sanitizeRadians(b - a) < this.sanitizeRadians(c - a);
7596
7608
  }
7597
7609
  /**
7598
7610
  * Finds the segment containing the desired color.
@@ -7607,22 +7619,22 @@ var HctSolver = class HctSolver {
7607
7619
  -1,
7608
7620
  -1,
7609
7621
  -1
7610
- ], right = left, leftHue = 0, rightHue = 0, initialized = false, uncut = true;
7622
+ ], right = left, leftHue = 0, rightHue = 0, isInitialized = false, isUncut = true;
7611
7623
  for (let n = 0; n < 12; n++) {
7612
- const mid = HctSolver.nthVertex(y, n);
7624
+ const mid = this.nthVertex(y, n);
7613
7625
  if (mid[0] < 0) continue;
7614
- const midHue = HctSolver.hueOf(mid);
7615
- if (!initialized) {
7626
+ const midHue = this.hueOf(mid);
7627
+ if (!isInitialized) {
7616
7628
  left = mid;
7617
7629
  right = mid;
7618
7630
  leftHue = midHue;
7619
7631
  rightHue = midHue;
7620
- initialized = true;
7632
+ isInitialized = true;
7621
7633
  continue;
7622
7634
  }
7623
- if (uncut || HctSolver.areInCyclicOrder(leftHue, midHue, rightHue)) {
7624
- uncut = false;
7625
- if (HctSolver.areInCyclicOrder(leftHue, targetHue, midHue)) {
7635
+ if (isUncut || this.areInCyclicOrder(leftHue, midHue, rightHue)) {
7636
+ isUncut = false;
7637
+ if (this.areInCyclicOrder(leftHue, targetHue, midHue)) {
7626
7638
  right = mid;
7627
7639
  rightHue = midHue;
7628
7640
  } else {
@@ -7686,8 +7698,8 @@ var HctSolver = class HctSolver {
7686
7698
  * @returns The intersection point of the segment AB with the plane R=coordinate, G=coordinate, or B=coordinate
7687
7699
  */
7688
7700
  static setCoordinate(source, coordinate, target, axis) {
7689
- const t = HctSolver.intercept(source[axis], coordinate, target[axis]);
7690
- return HctSolver.lerpPoint(source, t, target);
7701
+ const t = this.intercept(source[axis], coordinate, target[axis]);
7702
+ return this.lerpPoint(source, t, target);
7691
7703
  }
7692
7704
  /**
7693
7705
  * Finds a color with the given Y and hue on the boundary of the cube.
@@ -7697,25 +7709,26 @@ var HctSolver = class HctSolver {
7697
7709
  * @returns The desired color, in linear RGB coordinates.
7698
7710
  */
7699
7711
  static bisectToLimit(y, targetHue) {
7700
- const segment = HctSolver.bisectToSegment(y, targetHue);
7701
- let left = segment[0], leftHue = HctSolver.hueOf(left), right = segment[1];
7702
- for (let axis = 0; axis < 3; axis++) if (left[axis] !== right[axis]) {
7712
+ const segment = this.bisectToSegment(y, targetHue);
7713
+ let left = segment[0], leftHue = this.hueOf(left), right = segment[1];
7714
+ for (let axis = 0; axis < 3; axis++) {
7715
+ if (left[axis] === right[axis]) continue;
7703
7716
  let lPlane;
7704
7717
  let rPlane;
7705
7718
  if (left[axis] < right[axis]) {
7706
- lPlane = HctSolver.criticalPlaneBelow(HctSolver.trueDelinearized(left[axis]));
7707
- rPlane = HctSolver.criticalPlaneAbove(HctSolver.trueDelinearized(right[axis]));
7719
+ lPlane = this.criticalPlaneBelow(this.trueDelinearized(left[axis]));
7720
+ rPlane = this.criticalPlaneAbove(this.trueDelinearized(right[axis]));
7708
7721
  } else {
7709
- lPlane = HctSolver.criticalPlaneAbove(HctSolver.trueDelinearized(left[axis]));
7710
- rPlane = HctSolver.criticalPlaneBelow(HctSolver.trueDelinearized(right[axis]));
7722
+ lPlane = this.criticalPlaneAbove(this.trueDelinearized(left[axis]));
7723
+ rPlane = this.criticalPlaneBelow(this.trueDelinearized(right[axis]));
7711
7724
  }
7712
- for (let index = 0; index < 8; index++) if (Math.abs(rPlane - lPlane) <= 1) break;
7713
- else {
7725
+ for (let index = 0; index < 8; index++) {
7726
+ if (Math.abs(rPlane - lPlane) <= 1) break;
7714
7727
  const mPlane = Math.floor((lPlane + rPlane) / 2);
7715
- const midPlaneCoordinate = HctSolver.CRITICAL_PLANES[mPlane] ?? 0;
7716
- const mid = HctSolver.setCoordinate(left, midPlaneCoordinate, right, axis);
7717
- const midHue = HctSolver.hueOf(mid);
7718
- if (HctSolver.areInCyclicOrder(leftHue, targetHue, midHue)) {
7728
+ const midPlaneCoordinate = this.CRITICAL_PLANES[mPlane] ?? 0;
7729
+ const mid = this.setCoordinate(left, midPlaneCoordinate, right, axis);
7730
+ const midHue = this.hueOf(mid);
7731
+ if (this.areInCyclicOrder(leftHue, targetHue, midHue)) {
7719
7732
  right = mid;
7720
7733
  rPlane = mPlane;
7721
7734
  } else {
@@ -7807,7 +7820,7 @@ var Cam = class Cam {
7807
7820
  * frame.
7808
7821
  */
7809
7822
  static fromJch(index, c, h) {
7810
- return Cam.fromJchInFrame(index, c, h);
7823
+ return this.fromJchInFrame(index, c, h);
7811
7824
  }
7812
7825
  /** Create a CAM from lightness, chroma, and hue coordinates, and also specify the frame in which the color is being viewed. */
7813
7826
  static fromJchInFrame(index, c, h) {
@@ -7852,15 +7865,15 @@ var Cam = class Cam {
7852
7865
  static findCamByJ(hue, chroma, lstar) {
7853
7866
  let low = 0, high = 100, mid, bestdL = 1e3, bestdE = 1e3;
7854
7867
  let bestCam = null;
7855
- while (Math.abs(low - high) > Cam.LIGHTNESS_SEARCH_ENDPOINT) {
7868
+ while (Math.abs(low - high) > this.LIGHTNESS_SEARCH_ENDPOINT) {
7856
7869
  mid = low + (high - low) / 2;
7857
- const clipped = Cam.fromJch(mid, chroma, hue).viewedInSrgb();
7870
+ const clipped = this.fromJch(mid, chroma, hue).viewedInSrgb();
7858
7871
  const clippedLstar = CamUtilities.lstarFromInt(clipped);
7859
7872
  const dL = Math.abs(lstar - clippedLstar);
7860
- if (dL < Cam.DL_MAX) {
7861
- const camClipped = Cam.fromInt(clipped);
7862
- const dE = camClipped.distance(Cam.fromJch(camClipped.getJ(), camClipped.getChroma(), hue));
7863
- if (dE <= Cam.DE_MAX) {
7873
+ if (dL < this.DL_MAX) {
7874
+ const camClipped = this.fromInt(clipped);
7875
+ const dE = camClipped.distance(this.fromJch(camClipped.getJ(), camClipped.getChroma(), hue));
7876
+ if (dE <= this.DE_MAX) {
7864
7877
  bestdL = dL;
7865
7878
  bestdE = dE;
7866
7879
  bestCam = camClipped;
@@ -7877,7 +7890,7 @@ var Cam = class Cam {
7877
7890
  * will, be lower than requested. Assumes the color is viewed in the frame defined by the sRGB standard.
7878
7891
  */
7879
7892
  static getInt(hue, chroma, lstar) {
7880
- return Cam.getInt_(hue, chroma, lstar, Frame.DEFAULT);
7893
+ return this.getInt_(hue, chroma, lstar, Frame.DEFAULT);
7881
7894
  }
7882
7895
  /**
7883
7896
  * Given a hue & chroma in CAM16, L* in L_a_b*, and the frame in which the color will be viewed, return an ARGB integer.
@@ -7895,13 +7908,16 @@ var Cam = class Cam {
7895
7908
  let low = 0;
7896
7909
  let isFirstLoop = true;
7897
7910
  let answer = null;
7898
- while (Math.abs(low - high) >= Cam.CHROMA_SEARCH_ENDPOINT) {
7899
- const possibleAnswer = Cam.findCamByJ(hue, mid, lstar);
7900
- if (isFirstLoop) if (possibleAnswer == void 0) {
7901
- isFirstLoop = false;
7902
- mid = low + (high - low) / 2;
7903
- continue;
7904
- } else return possibleAnswer.viewed(frame);
7911
+ while (Math.abs(low - high) >= this.CHROMA_SEARCH_ENDPOINT) {
7912
+ const possibleAnswer = this.findCamByJ(hue, mid, lstar);
7913
+ if (isFirstLoop) {
7914
+ if (possibleAnswer == void 0) {
7915
+ isFirstLoop = false;
7916
+ mid = low + (high - low) / 2;
7917
+ continue;
7918
+ }
7919
+ return possibleAnswer.viewed(frame);
7920
+ }
7905
7921
  if (possibleAnswer == void 0) high = mid;
7906
7922
  else {
7907
7923
  answer = possibleAnswer;
@@ -7914,10 +7930,10 @@ var Cam = class Cam {
7914
7930
  }
7915
7931
  static intFromLstar(lstar) {
7916
7932
  if (lstar < 1) return 4278190080;
7917
- else if (lstar > 99) return 4294967295;
7933
+ if (lstar > 99) return 4294967295;
7918
7934
  const fy = (lstar + 16) / 116;
7919
7935
  const fz = fy, fx = fy;
7920
- const kappa = 24389 / 27, epsilon = 216 / 24389, yT = lstar > 8 ? fy * fy * fy : lstar / kappa, cubeExceedEpsilon = fy * fy * fy > epsilon, xT = cubeExceedEpsilon ? fx * fx * fx : (116 * fx - 16) / kappa, zT = cubeExceedEpsilon ? fz * fz * fz : (116 * fx - 16) / kappa;
7936
+ const kappa = 24389 / 27, epsilon = 216 / 24389, yT = lstar > 8 ? fy * fy * fy : lstar / kappa, isCubeExceedEpsilon = fy * fy * fy > epsilon, xT = isCubeExceedEpsilon ? fx * fx * fx : (116 * fx - 16) / kappa, zT = isCubeExceedEpsilon ? fz * fz * fz : (116 * fx - 16) / kappa;
7921
7937
  return ColorUtilities.XYZToColor(xT * CamUtilities.WHITE_POINT_D65[0], yT * CamUtilities.WHITE_POINT_D65[1], zT * CamUtilities.WHITE_POINT_D65[2]);
7922
7938
  }
7923
7939
  static fromIntInFrame(argb, frame) {
@@ -7942,7 +7958,7 @@ var Cam = class Cam {
7942
7958
  * defined in the sRGB standard.
7943
7959
  */
7944
7960
  static fromInt(argb) {
7945
- return Cam.fromIntInFrame(argb, Frame.DEFAULT);
7961
+ return this.fromIntInFrame(argb, Frame.DEFAULT);
7946
7962
  }
7947
7963
  };
7948
7964
  /**
@@ -7965,7 +7981,7 @@ var Cam = class Cam {
7965
7981
  * results would be consistent, and reasonably good. It worked." - Fairchild, Color Models and Systems: Handbook of Color
7966
7982
  * Psychology, 2015
7967
7983
  */
7968
- var CamUtilities = class CamUtilities {
7984
+ var CamUtilities = class {
7969
7985
  /**
7970
7986
  * This is a more precise sRGB to XYZ transformation matrix than traditionally used. It was derived using Schlomer's technique
7971
7987
  * of transforming the xyY primaries to XYZ, then applying a correction to ensure mapping from sRGB 1, 1, 1 to the reference
@@ -8052,23 +8068,20 @@ var CamUtilities = class CamUtilities {
8052
8068
  ];
8053
8069
  /** Returns L* from L_a_b*, perceptual luminance, from an ARGB integer (ColorInt). */
8054
8070
  static lstarFromInt(argb) {
8055
- return CamUtilities.lstarFromY(CamUtilities.yFromInt(argb));
8071
+ return this.lstarFromY(this.yFromInt(argb));
8056
8072
  }
8057
8073
  static lstarFromY(y) {
8058
- y = y / 100;
8059
- const element = 216 / 24389;
8060
- let yIntermediate;
8061
- if (y <= element) return 24389 / 27 * y;
8062
- else yIntermediate = Math.cbrt(y);
8063
- return 116 * yIntermediate - 16;
8074
+ y /= 100;
8075
+ if (y <= 216 / 24389) return 24389 / 27 * y;
8076
+ return 116 * Math.cbrt(y) - 16;
8064
8077
  }
8065
8078
  static yFromInt(argb) {
8066
- const r = CamUtilities.linearized(Color.red(argb)), g = CamUtilities.linearized(Color.green(argb)), b = CamUtilities.linearized(Color.blue(argb)), matrix = CamUtilities.SRGB_TO_XYZ;
8079
+ const r = this.linearized(Color.red(argb)), g = this.linearized(Color.green(argb)), b = this.linearized(Color.blue(argb)), matrix = this.SRGB_TO_XYZ;
8067
8080
  return r * matrix[1][0] + g * matrix[1][1] + b * matrix[1][2];
8068
8081
  }
8069
8082
  static xyzFromInt(argb) {
8070
- const r = CamUtilities.linearized(Color.red(argb)), g = CamUtilities.linearized(Color.green(argb)), b = CamUtilities.linearized(Color.blue(argb));
8071
- const matrix = CamUtilities.SRGB_TO_XYZ;
8083
+ const r = this.linearized(Color.red(argb)), g = this.linearized(Color.green(argb)), b = this.linearized(Color.blue(argb));
8084
+ const matrix = this.SRGB_TO_XYZ;
8072
8085
  return [
8073
8086
  r * matrix[0][0] + g * matrix[0][1] + b * matrix[0][2],
8074
8087
  r * matrix[1][0] + g * matrix[1][1] + b * matrix[1][2],
@@ -8099,7 +8112,7 @@ var CamUtilities = class CamUtilities {
8099
8112
  */
8100
8113
  static clampInt(min, max, input) {
8101
8114
  if (input < min) return min;
8102
- else if (input > max) return max;
8115
+ if (input > max) return max;
8103
8116
  return input;
8104
8117
  }
8105
8118
  /**
@@ -8111,7 +8124,7 @@ var CamUtilities = class CamUtilities {
8111
8124
  static delinearized(rgbComponent) {
8112
8125
  const normalized = rgbComponent / 100;
8113
8126
  const delinearized = normalized <= .0031308 ? normalized * 12.92 : 1.055 * Math.pow(normalized, 1 / 2.4) - .055;
8114
- return CamUtilities.clampInt(0, 255, Math.round(delinearized * 255));
8127
+ return this.clampInt(0, 255, Math.round(delinearized * 255));
8115
8128
  }
8116
8129
  /** Converts a color from RGB components to ARGB format. */
8117
8130
  static argbFromRgb(red, green, blue) {
@@ -8119,8 +8132,8 @@ var CamUtilities = class CamUtilities {
8119
8132
  }
8120
8133
  /** Converts a color from ARGB to XYZ. */
8121
8134
  static argbFromXyz(x, y, z) {
8122
- const matrix = CamUtilities.XYZ_TO_SRGB, linearR = matrix[0][0] * x + matrix[0][1] * y + matrix[0][2] * z, linearG = matrix[1][0] * x + matrix[1][1] * y + matrix[1][2] * z, linearB = matrix[2][0] * x + matrix[2][1] * y + matrix[2][2] * z, r = CamUtilities.delinearized(linearR), g = CamUtilities.delinearized(linearG), b = CamUtilities.delinearized(linearB);
8123
- return CamUtilities.argbFromRgb(r, g, b);
8135
+ const matrix = this.XYZ_TO_SRGB, linearR = matrix[0][0] * x + matrix[0][1] * y + matrix[0][2] * z, linearG = matrix[1][0] * x + matrix[1][1] * y + matrix[1][2] * z, linearB = matrix[2][0] * x + matrix[2][1] * y + matrix[2][2] * z, r = this.delinearized(linearR), g = this.delinearized(linearG), b = this.delinearized(linearB);
8136
+ return this.argbFromRgb(r, g, b);
8124
8137
  }
8125
8138
  /**
8126
8139
  * Convert a color appearance model representation to an ARGB color.
@@ -8143,12 +8156,12 @@ var CamUtilities = class CamUtilities {
8143
8156
  * @returns ARGB representation of grayscale color with lightness matching L*
8144
8157
  */
8145
8158
  static argbFromLstar(lstar) {
8146
- const fy = (lstar + 16) / 116, fz = fy, fx = fy, kappa = 24389 / 27, epsilon = 216 / 24389, y = lstar > 8 ? fy * fy * fy : lstar / kappa, cubeExceedEpsilon = fy * fy * fy > epsilon, x = cubeExceedEpsilon ? fx * fx * fx : lstar / kappa, z = cubeExceedEpsilon ? fz * fz * fz : lstar / kappa, whitePoint = CamUtilities.WHITE_POINT_D65;
8147
- return CamUtilities.argbFromXyz(x * whitePoint[0], y * whitePoint[1], z * whitePoint[2]);
8159
+ const fy = (lstar + 16) / 116, fz = fy, fx = fy, kappa = 24389 / 27, epsilon = 216 / 24389, y = lstar > 8 ? fy * fy * fy : lstar / kappa, isCubeExceedEpsilon = fy * fy * fy > epsilon, x = isCubeExceedEpsilon ? fx * fx * fx : lstar / kappa, z = isCubeExceedEpsilon ? fz * fz * fz : lstar / kappa, whitePoint = this.WHITE_POINT_D65;
8160
+ return this.argbFromXyz(x * whitePoint[0], y * whitePoint[1], z * whitePoint[2]);
8148
8161
  }
8149
8162
  /** Converts a color from linear RGB components to ARGB format. */
8150
8163
  static argbFromLinrgbComponents(r, g, b) {
8151
- return CamUtilities.argbFromRgb(CamUtilities.delinearized(r), CamUtilities.delinearized(g), CamUtilities.delinearized(b));
8164
+ return this.argbFromRgb(this.delinearized(r), this.delinearized(g), this.delinearized(b));
8152
8165
  }
8153
8166
  /**
8154
8167
  * The signum function.
@@ -8157,22 +8170,21 @@ var CamUtilities = class CamUtilities {
8157
8170
  */
8158
8171
  static signum(number_) {
8159
8172
  if (number_ < 0) return -1;
8160
- else if (number_ === 0) return 0;
8161
- else return 1;
8173
+ return number_ === 0 ? 0 : 1;
8162
8174
  }
8163
8175
  static intFromLstar(lstar) {
8164
8176
  if (lstar < 1) return 4278190080;
8165
- else if (lstar > 99) return 4294967295;
8177
+ if (lstar > 99) return 4294967295;
8166
8178
  const fy = (lstar + 16) / 116;
8167
8179
  const fz = fy;
8168
8180
  const fx = fy;
8169
8181
  const kappa = 24389 / 27;
8170
8182
  const epsilon = 216 / 24389;
8171
8183
  const yT = lstar > 8 ? fy * fy * fy : lstar / kappa;
8172
- const cubeExceedEpsilon = fy * fy * fy > epsilon;
8173
- const xT = cubeExceedEpsilon ? fx * fx * fx : (116 * fx - 16) / kappa;
8174
- const zT = cubeExceedEpsilon ? fz * fz * fz : (116 * fx - 16) / kappa;
8175
- return ColorUtilities.XYZToColor(xT * CamUtilities.WHITE_POINT_D65[0], yT * CamUtilities.WHITE_POINT_D65[1], zT * CamUtilities.WHITE_POINT_D65[2]);
8184
+ const isCubeExceedEpsilon = fy * fy * fy > epsilon;
8185
+ const xT = isCubeExceedEpsilon ? fx * fx * fx : (116 * fx - 16) / kappa;
8186
+ const zT = isCubeExceedEpsilon ? fz * fz * fz : (116 * fx - 16) / kappa;
8187
+ return ColorUtilities.XYZToColor(xT * this.WHITE_POINT_D65[0], yT * this.WHITE_POINT_D65[1], zT * this.WHITE_POINT_D65[2]);
8176
8188
  }
8177
8189
  };
8178
8190
  /**
@@ -8239,11 +8251,11 @@ var Frame = class Frame {
8239
8251
  getN() {
8240
8252
  return this.mN;
8241
8253
  }
8242
- static make(whitepoint, adaptingLuminance, backgroundLstar, surround, discountingIlluminant) {
8254
+ static make(whitepoint, adaptingLuminance, backgroundLstar, surround, shouldDiscountingIlluminant) {
8243
8255
  const matrix = CamUtilities.XYZ_TO_CAM16RGB, xyz = whitepoint, rW = xyz[0] * matrix[0][0] + xyz[1] * matrix[0][1] + xyz[2] * matrix[0][2], gW = xyz[0] * matrix[1][0] + xyz[1] * matrix[1][1] + xyz[2] * matrix[1][2], bW = xyz[0] * matrix[2][0] + xyz[1] * matrix[2][1] + xyz[2] * matrix[2][2];
8244
8256
  const f = .8 + surround / 10;
8245
8257
  const c = f >= .9 ? MathUtilities.lerp(.59, .69, (f - .9) * 10) : MathUtilities.lerp(.525, .59, (f - .8) * 10);
8246
- let d = discountingIlluminant ? 1 : f * (1 - 1 / 3.6 * Math.exp((-adaptingLuminance - 42) / 92));
8258
+ let d = shouldDiscountingIlluminant ? 1 : f * (1 - 1 / 3.6 * Math.exp((-adaptingLuminance - 42) / 92));
8247
8259
  d = d > 1 ? 1 : Math.max(d, 0);
8248
8260
  const nc = f;
8249
8261
  const rgbD = [
@@ -8474,8 +8486,7 @@ const Palette = {
8474
8486
  },
8475
8487
  wrapDegreesDouble(degrees) {
8476
8488
  if (degrees < 0) return degrees % 360 + 360;
8477
- else if (degrees >= 360) return degrees % 360;
8478
- else return degrees;
8489
+ return degrees >= 360 ? degrees % 360 : degrees;
8479
8490
  },
8480
8491
  generate(seed, style = "TONAL_SPOT") {
8481
8492
  seed = seed.toUpperCase().slice(1, 7);
@@ -8554,8 +8565,7 @@ function materialYouCliPlugin(options = {}) {
8554
8565
  materialYouPaletteCommand.onExecute(async (result) => {
8555
8566
  const { color, style, format, raw } = result.options;
8556
8567
  if (!isHexColor(color)) {
8557
- console.error(`Invalid color: ${color}
8558
- Only HEX colors \`#RRGGBB\` are supported.`);
8568
+ console.error(`Invalid color: ${color}\nOnly HEX colors \`#RRGGBB\` are supported.`);
8559
8569
  return;
8560
8570
  }
8561
8571
  const palette = generateMaterialYouPalette(color, style);