@stencil/core 5.0.0-next.0 → 5.0.0-rc.0

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.
Files changed (58) hide show
  1. package/README.md +94 -0
  2. package/bin/stencil.mjs +1 -1
  3. package/dist/app-data/index.d.ts +2 -0
  4. package/dist/{runtime/app-data → app-data}/index.js +23 -15
  5. package/dist/{runtime/app-globals → app-globals}/index.js +1 -2
  6. package/dist/client-ClM4H9-P.mjs +2496 -0
  7. package/dist/compiler/browser.d.ts +1573 -0
  8. package/dist/compiler/browser.js +16998 -0
  9. package/dist/compiler/index.d.mts +284 -7
  10. package/dist/compiler/index.mjs +3 -9
  11. package/dist/compiler/utils/index.d.mts +272 -3
  12. package/dist/compiler/utils/index.mjs +4 -5
  13. package/dist/{transpile-CJQcQEVa.mjs → compiler-DFanjq9z.mjs} +20984 -15554
  14. package/dist/declarations/stencil-ext-modules.d.ts +8 -8
  15. package/dist/declarations/stencil-public-compiler.d.ts +1016 -840
  16. package/dist/declarations/stencil-public-compiler.js +3 -5
  17. package/dist/declarations/stencil-public-docs.d.ts +441 -376
  18. package/dist/declarations/stencil-public-docs.js +0 -0
  19. package/dist/declarations/stencil-public-runtime.d.ts +361 -113
  20. package/dist/fragment-Di1hWOC8.mjs +4 -0
  21. package/dist/helpers-Cpp3qc3u.mjs +524 -0
  22. package/dist/{index-szczUd2l.d.mts → index-DvfFOkiJ.d.mts} +1466 -2044
  23. package/dist/{stencil-private-Cgcr414u.d.ts → index-XQHZl0MW.d.ts} +308 -114
  24. package/dist/index-aBMJC5F9.d.mts +104 -0
  25. package/dist/index.d.mts +14 -2
  26. package/dist/index.mjs +171 -4
  27. package/dist/jsx-runtime.d.mts +24 -0
  28. package/dist/jsx-runtime.mjs +3 -0
  29. package/dist/mock-doc.mjs +2 -3
  30. package/dist/{node-sys-BGURUNOZ.mjs → node-DJP8JuAS.mjs} +176 -197
  31. package/dist/rolldown-runtime-BhDjJH2R.mjs +15 -0
  32. package/dist/{client-DR9zhmKG.mjs → runtime/client/lazy.js} +3780 -2652
  33. package/dist/runtime/client/{index.d.ts → runtime.d.ts} +516 -227
  34. package/dist/runtime/client/{index.js → runtime.js} +3588 -2856
  35. package/dist/runtime/index.d.ts +90 -72
  36. package/dist/runtime/index.js +3461 -2837
  37. package/dist/runtime/server/index.d.mts +243 -219
  38. package/dist/runtime/server/index.mjs +3763 -3352
  39. package/dist/runtime/server/runner.d.mts +114 -47
  40. package/dist/runtime/server/runner.mjs +12710 -763
  41. package/dist/signals/index.d.ts +58 -0
  42. package/dist/signals/index.js +182 -0
  43. package/dist/sys/node/index.d.mts +1 -3
  44. package/dist/sys/node/index.mjs +2 -7
  45. package/dist/sys/node/worker.d.mts +1 -1
  46. package/dist/sys/node/worker.mjs +3 -12
  47. package/dist/testing/index.d.mts +4763 -12
  48. package/dist/testing/index.mjs +7939 -619
  49. package/dist/util-C-H1H84W.mjs +731 -0
  50. package/dist/validation-ByYYKvnS.mjs +825 -0
  51. package/package.json +91 -59
  52. package/dist/chunk-ClPoSABd.mjs +0 -21
  53. package/dist/index-Bxo2jCf6.d.mts +0 -77
  54. package/dist/runtime/app-data/index.d.ts +0 -30
  55. package/dist/serialize-BJvhE9aQ.mjs +0 -775
  56. package/dist/validation-BdcPruW_.mjs +0 -1451
  57. /package/{LICENSE.md → LICENSE} +0 -0
  58. /package/dist/{runtime/app-globals → app-globals}/index.d.ts +0 -0
@@ -1,16 +1,19 @@
1
- import { n as __require } from "./chunk-ClPoSABd.mjs";
2
- import { _ as isString, c as flatOne, p as isFunction, y as noop } from "./serialize-BJvhE9aQ.mjs";
3
- import { bt as isGlob, dt as TASK_CANCELED_MSG, ft as buildError, ht as catchError, rt as normalizePath, vt as shouldIgnoreError } from "./validation-BdcPruW_.mjs";
4
- import path from "node:path";
5
- import path$1 from "path";
6
- import fs from "graceful-fs";
1
+ import { n as __require } from "./rolldown-runtime-BhDjJH2R.mjs";
2
+ import "./client-ClM4H9-P.mjs";
3
+ import { c as isFunction, f as isString, m as noop, r as flatOne } from "./helpers-Cpp3qc3u.mjs";
4
+ import { X as TASK_CANCELED_MSG, Z as buildError, et as catchError, it as isGlob, q as normalizePath, rt as shouldIgnoreError } from "./util-C-H1H84W.mjs";
5
+ import fs from "node:fs";
6
+ import nodePath from "node:path";
7
+ import { pathToFileURL } from "node:url";
8
+ import picomatch from "picomatch";
9
+ import path from "path";
7
10
  import chalk from "chalk";
8
11
  import { createHash } from "node:crypto";
9
12
  import * as os from "node:os";
10
13
  import { cpus, freemem, platform, release, tmpdir, totalmem } from "node:os";
11
14
  import * as parcelWatcher from "@parcel/watcher";
12
- import { glob } from "glob";
13
- import { promisify } from "util";
15
+ import { glob } from "tinyglobby";
16
+ import { copyFile, mkdir, readdir, stat } from "node:fs/promises";
14
17
  import semverLte from "semver/functions/lte.js";
15
18
  import major from "semver/functions/major.js";
16
19
  import satisfies from "semver/functions/satisfies.js";
@@ -18,7 +21,6 @@ import { cpus as cpus$1, tmpdir as tmpdir$1 } from "os";
18
21
  import semverLt from "semver/functions/lt.js";
19
22
  import { EventEmitter } from "events";
20
23
  import * as cp from "child_process";
21
-
22
24
  //#region src/compiler/events.ts
23
25
  const buildEvents = () => {
24
26
  const evCallbacks = [];
@@ -73,7 +75,6 @@ const buildEvents = () => {
73
75
  unsubscribeAll
74
76
  };
75
77
  };
76
-
77
78
  //#endregion
78
79
  //#region src/declarations/stencil-public-compiler.ts
79
80
  /**
@@ -106,7 +107,7 @@ const LOG_LEVELS = [
106
107
  /**
107
108
  * The collection of valid export behaviors.
108
109
  * Used to generate a type for typed configs as well as output target validation
109
- * for the `dist-custom-elements` output target.
110
+ * for the `standalone` output target.
110
111
  *
111
112
  * Adding a value to this const array will automatically add it as a valid option on the
112
113
  * output target configuration for `customElementsExportBehavior`.
@@ -115,8 +116,7 @@ const LOG_LEVELS = [
115
116
  * - `auto-define-custom-elements`: Enables the auto-definition of a component and its children (recursively) in the custom elements registry. This
116
117
  * functionality allows consumers to bypass the explicit call to define a component, its children, its children's
117
118
  * children, etc. Users of this flag should be aware that enabling this functionality may increase bundle size.
118
- * - `bundle`: A `defineCustomElements` function will be exported from the distribution directory. This behavior was added to allow easy migration
119
- * from `dist-custom-elements-bundle` to `dist-custom-elements`.
119
+ * - `bundle`: A `defineCustomElements` function will be exported from the distribution directory.
120
120
  * - `single-export-module`: All components will be re-exported from the specified directory's root `index.js` file.
121
121
  */
122
122
  const CustomElementsExportBehaviorOptions = [
@@ -125,7 +125,6 @@ const CustomElementsExportBehaviorOptions = [
125
125
  "bundle",
126
126
  "single-export-module"
127
127
  ];
128
-
129
128
  //#endregion
130
129
  //#region src/sys/node/logger/terminal-logger.ts
131
130
  const { bgRed, blue, bold, cyan, dim, gray, green, magenta, red, yellow } = chalk;
@@ -211,9 +210,9 @@ const createTerminalLogger = (loggerSys) => {
211
210
  lines[0] = cyan(prefix) + lines[0].slice(prefix.length);
212
211
  }
213
212
  };
214
- const timespanStart = (startMsg, debug, appendTo) => {
213
+ const timespanStart = (startMsg, isDebug, appendTo) => {
215
214
  const msg = [`${startMsg} ${dim("...")}`];
216
- if (debug) {
215
+ if (isDebug) {
217
216
  if (shouldLog(currentLogLevel, "debug")) {
218
217
  formatMemoryUsage(msg);
219
218
  const lines = wordWrap(msg, loggerSys.getColumns());
@@ -238,12 +237,12 @@ const createTerminalLogger = (loggerSys) => {
238
237
  const mem = loggerSys.memoryUsage();
239
238
  if (mem > 0) message.push(dim(` MEM: ${(mem / 1e6).toFixed(1)}MB`));
240
239
  };
241
- const timespanFinish = (finishMsg, timeSuffix, colorName, textBold, newLineSuffix, debug, appendTo) => {
240
+ const timespanFinish = (finishMsg, timeSuffix, colorName, textBold, newLineSuffix, isDebug, appendTo) => {
242
241
  let msg = finishMsg;
243
242
  if (colorName && chalkColors[colorName]) msg = chalkColors[colorName](finishMsg);
244
243
  if (textBold) msg = bold(msg);
245
244
  msg += " " + dim(timeSuffix);
246
- if (debug) {
245
+ if (isDebug) {
247
246
  if (shouldLog(currentLogLevel, "debug")) {
248
247
  const m = [msg];
249
248
  formatMemoryUsage(m);
@@ -261,7 +260,7 @@ const createTerminalLogger = (loggerSys) => {
261
260
  }
262
261
  if (newLineSuffix) console.log("");
263
262
  };
264
- const createTimeSpan = (startMsg, debug = false, appendTo) => {
263
+ const createTimeSpan = (startMsg, isDebug = false, appendTo) => {
265
264
  const start = Date.now();
266
265
  const duration = () => Date.now() - start;
267
266
  const timeSpan = {
@@ -272,11 +271,11 @@ const createTerminalLogger = (loggerSys) => {
272
271
  if (dur > 1e3) time = "in " + (dur / 1e3).toFixed(2) + " s";
273
272
  else if (parseFloat(dur.toFixed(3)) > 0) time = "in " + dur + " ms";
274
273
  else time = "in less than 1 ms";
275
- timespanFinish(finishMsg, time, colorName, !!textBold, !!newLineSuffix, debug, appendTo);
274
+ timespanFinish(finishMsg, time, colorName, !!textBold, !!newLineSuffix, isDebug, appendTo);
276
275
  return dur;
277
276
  }
278
277
  };
279
- timespanStart(startMsg, debug, appendTo);
278
+ timespanStart(startMsg, isDebug, appendTo);
280
279
  return timeSpan;
281
280
  };
282
281
  const queueWriteLog = (prefix, msg) => {
@@ -290,7 +289,7 @@ const createTerminalLogger = (loggerSys) => {
290
289
  if (logFilePath) try {
291
290
  queueWriteLog("F", ["--------------------------------------"]);
292
291
  loggerSys.writeLogs(logFilePath, writeLogQueue.join("\n"), append);
293
- } catch (e) {}
292
+ } catch {}
294
293
  writeLogQueue.length = 0;
295
294
  };
296
295
  /**
@@ -528,8 +527,8 @@ const wordWrap = (msg, columns) => {
528
527
  } else line += word + " ";
529
528
  });
530
529
  if (line.trim().length) lines.push(line);
531
- return lines.map((line) => {
532
- return line.trimRight();
530
+ return lines.map((l) => {
531
+ return l.trimRight();
533
532
  });
534
533
  };
535
534
  /**
@@ -542,10 +541,10 @@ const removeLeadingWhitespace = (orgLines) => {
542
541
  const lines = JSON.parse(JSON.stringify(orgLines));
543
542
  for (let i = 0; i < numberOfTries; i++) {
544
543
  if (!eachLineHasLeadingWhitespace(lines)) return lines;
545
- for (let i = 0; i < lines.length; i++) {
546
- lines[i].text = lines[i].text.slice(1);
547
- lines[i].errorCharStart--;
548
- if (!lines[i].text.length) return lines;
544
+ for (let j = 0; j < lines.length; j++) {
545
+ lines[j].text = lines[j].text.slice(1);
546
+ lines[j].errorCharStart--;
547
+ if (!lines[j].text.length) return lines;
549
548
  }
550
549
  }
551
550
  return lines;
@@ -644,7 +643,6 @@ const JS_KEYWORDS = [
644
643
  * replaced by various prefixes like [ WARN ] and so on
645
644
  */
646
645
  const INDENT$1 = " ";
647
-
648
646
  //#endregion
649
647
  //#region src/sys/node/logger/index.ts
650
648
  /**
@@ -653,7 +651,8 @@ const INDENT$1 = " ";
653
651
  * @returns the created logger
654
652
  */
655
653
  const createNodeLogger = () => {
656
- return createTerminalLogger(createNodeLoggerSys());
654
+ const loggerSys = createNodeLoggerSys();
655
+ return createTerminalLogger(loggerSys);
657
656
  };
658
657
  /**
659
658
  * Create a logger sys object for use in a Node.js environment
@@ -666,7 +665,7 @@ const createNodeLogger = () => {
666
665
  */
667
666
  function createNodeLoggerSys() {
668
667
  const cwd = () => process.cwd();
669
- const emoji = (emoji) => process.platform !== "win32" ? emoji : "";
668
+ const emoji = (e) => process.platform !== "win32" ? e : "";
670
669
  /**
671
670
  * Get the number of columns for the terminal to use when printing
672
671
  * @returns the number of columns to use
@@ -678,11 +677,11 @@ function createNodeLoggerSys() {
678
677
  return Math.max(Math.min(terminalWidth, max_columns), min_columns);
679
678
  };
680
679
  const memoryUsage = () => process.memoryUsage().rss;
681
- const relativePath = (from, to) => path$1.relative(from, to);
680
+ const relativePath = (from, to) => path.relative(from, to);
682
681
  const writeLogs = (logFilePath, log, append) => {
683
682
  if (append) try {
684
683
  fs.accessSync(logFilePath);
685
- } catch (e) {
684
+ } catch {
686
685
  append = false;
687
686
  }
688
687
  if (append) fs.appendFileSync(logFilePath, log);
@@ -720,7 +719,6 @@ function createNodeLoggerSys() {
720
719
  createLineUpdater
721
720
  };
722
721
  }
723
-
724
722
  //#endregion
725
723
  //#region src/sys/node/node-setup-process.ts
726
724
  function setupNodeProcess(c) {
@@ -736,17 +734,32 @@ function setupNodeProcess(c) {
736
734
  }
737
735
  });
738
736
  }
739
-
740
- //#endregion
741
- //#region src/sys/node/node-fs-promisify.ts
742
- const copyFile = promisify(fs.copyFile);
743
- const mkdir = promisify(fs.mkdir);
744
- const readdir = promisify(fs.readdir);
745
- const readFile = promisify(fs.readFile);
746
- const stat = promisify(fs.stat);
747
-
748
737
  //#endregion
749
738
  //#region src/sys/node/node-copy-tasks.ts
739
+ /**
740
+ * Copy a file with retry logic for transient Windows errors (EBUSY, EPERM, EACCES).
741
+ * These errors commonly occur on Windows CI when antivirus or indexing services
742
+ * temporarily lock files.
743
+ *
744
+ * @param src - The source file path to copy from
745
+ * @param dest - The destination file path to copy to
746
+ * @param maxRetries - Maximum number of retry attempts (default: 3)
747
+ * @returns A promise that resolves when the file is successfully copied
748
+ * @throws The original error if all retry attempts fail or the error is not retryable
749
+ */
750
+ async function copyFileWithRetry(src, dest, maxRetries = 3) {
751
+ for (let attempt = 0; attempt <= maxRetries; attempt++) try {
752
+ await copyFile(src, dest);
753
+ return;
754
+ } catch (err) {
755
+ if (![
756
+ "EBUSY",
757
+ "EPERM",
758
+ "EACCES"
759
+ ].includes(err.code) || attempt === maxRetries) throw err;
760
+ await new Promise((resolve) => setTimeout(resolve, 100 * Math.pow(2, attempt)));
761
+ }
762
+ }
750
763
  async function nodeCopyTasks(copyTasks, srcDir) {
751
764
  const results = {
752
765
  diagnostics: [],
@@ -754,7 +767,13 @@ async function nodeCopyTasks(copyTasks, srcDir) {
754
767
  filePaths: []
755
768
  };
756
769
  try {
757
- copyTasks = flatOne(await Promise.all(copyTasks.map((task) => processGlobs(task, srcDir))));
770
+ copyTasks = flatOne(await Promise.all(copyTasks.map(async (task) => {
771
+ const fileTasks = await processGlobs(task, srcDir);
772
+ if (!fileTasks.some(escapesDest)) return fileTasks;
773
+ const err = buildError(results.diagnostics);
774
+ err.messageText = `Copy task "${task.src}" would write outside its destination "${task.dest}". Set "dest" (without "keepDirStructure") when copying from outside the src directory.`;
775
+ return [];
776
+ })));
758
777
  const allCopyTasks = [];
759
778
  while (copyTasks.length > 0) {
760
779
  const tasks = copyTasks.splice(0, 100);
@@ -763,10 +782,10 @@ async function nodeCopyTasks(copyTasks, srcDir) {
763
782
  const mkDirs = ensureDirs(allCopyTasks);
764
783
  try {
765
784
  await Promise.all(mkDirs.map((dir) => mkdir(dir, { recursive: true })));
766
- } catch (mkDirErr) {}
785
+ } catch {}
767
786
  while (allCopyTasks.length > 0) {
768
787
  const tasks = allCopyTasks.splice(0, 100);
769
- await Promise.all(tasks.map((copyTask) => copyFile(copyTask.src, copyTask.dest)));
788
+ await Promise.all(tasks.map((copyTask) => copyFileWithRetry(copyTask.src, copyTask.dest)));
770
789
  }
771
790
  } catch (e) {
772
791
  catchError(results.diagnostics, e);
@@ -776,15 +795,27 @@ async function nodeCopyTasks(copyTasks, srcDir) {
776
795
  async function processGlobs(copyTask, srcDir) {
777
796
  return isGlob(copyTask.src) ? await processGlobTask(copyTask, srcDir) : [{
778
797
  src: getSrcAbsPath(srcDir, copyTask.src),
779
- dest: copyTask.keepDirStructure ? path$1.join(copyTask.dest, copyTask.src) : copyTask.dest,
798
+ dest: copyTask.keepDirStructure ? path.join(copyTask.dest, copyTask.src) : copyTask.dest,
780
799
  warn: copyTask.warn,
781
800
  ignore: copyTask.ignore,
782
- keepDirStructure: copyTask.keepDirStructure
801
+ keepDirStructure: copyTask.keepDirStructure,
802
+ destRoot: copyTask.dest
783
803
  }];
784
804
  }
805
+ /**
806
+ * Keeping the directory structure of a `src` outside `srcDir` (`../x`) would carry the `../`
807
+ * into the destination path.
808
+ *
809
+ * @param task a per-file copy task
810
+ * @returns `true` if the task would write outside its destination directory
811
+ */
812
+ function escapesDest({ dest, destRoot }) {
813
+ const rel = path.relative(destRoot, dest);
814
+ return rel.startsWith("..") || path.isAbsolute(rel);
815
+ }
785
816
  function getSrcAbsPath(srcDir, src) {
786
- if (path$1.isAbsolute(src)) return src;
787
- return path$1.join(srcDir, src);
817
+ if (path.isAbsolute(src)) return src;
818
+ return path.join(srcDir, src);
788
819
  }
789
820
  async function processGlobTask(copyTask, srcDir) {
790
821
  return (await asyncGlob(copyTask.src, {
@@ -794,23 +825,31 @@ async function processGlobTask(copyTask, srcDir) {
794
825
  })).map((globRelPath) => createGlobCopyTask(copyTask, srcDir, globRelPath));
795
826
  }
796
827
  function createGlobCopyTask(copyTask, srcDir, globRelPath) {
797
- const dest = path$1.join(copyTask.dest, copyTask.keepDirStructure ? globRelPath : path$1.basename(globRelPath));
828
+ const dest = path.join(copyTask.dest, copyTask.keepDirStructure ? globRelPath : path.basename(globRelPath));
798
829
  return {
799
- src: path$1.join(srcDir, globRelPath),
830
+ src: path.join(srcDir, globRelPath),
800
831
  dest,
801
832
  ignore: copyTask.ignore,
802
833
  warn: copyTask.warn,
803
- keepDirStructure: copyTask.keepDirStructure
834
+ keepDirStructure: copyTask.keepDirStructure,
835
+ destRoot: copyTask.dest
804
836
  };
805
837
  }
806
- async function processCopyTask(results, allCopyTasks, copyTask) {
838
+ const createDirectoryWalk = ({ src, ignore = [] }) => ({
839
+ root: src,
840
+ isIgnored: picomatch(ignore, {
841
+ dot: true,
842
+ nocase: true
843
+ })
844
+ });
845
+ async function processCopyTask(results, allCopyTasks, copyTask, walk) {
807
846
  try {
808
847
  copyTask.src = normalizePath(copyTask.src);
809
848
  copyTask.dest = normalizePath(copyTask.dest);
810
849
  if ((await stat(copyTask.src)).isDirectory()) {
811
850
  if (!results.dirPaths.includes(copyTask.dest)) results.dirPaths.push(copyTask.dest);
812
- await processCopyTaskDirectory(results, allCopyTasks, copyTask);
813
- } else if (!shouldIgnore(copyTask)) {
851
+ await processCopyTaskDirectory(results, allCopyTasks, copyTask, walk ?? createDirectoryWalk(copyTask));
852
+ } else if (!walk || !walk.isIgnored(path.posix.relative(walk.root, copyTask.src))) {
814
853
  if (!results.filePaths.includes(copyTask.dest)) results.filePaths.push(copyTask.dest);
815
854
  allCopyTasks.push(copyTask);
816
855
  }
@@ -821,15 +860,15 @@ async function processCopyTask(results, allCopyTasks, copyTask) {
821
860
  }
822
861
  }
823
862
  }
824
- async function processCopyTaskDirectory(results, allCopyTasks, copyTask) {
863
+ async function processCopyTaskDirectory(results, allCopyTasks, copyTask, walk) {
825
864
  try {
826
865
  const dirItems = await readdir(copyTask.src);
827
866
  await Promise.all(dirItems.map(async (dirItem) => {
828
867
  await processCopyTask(results, allCopyTasks, {
829
- src: path$1.join(copyTask.src, dirItem),
830
- dest: path$1.join(copyTask.dest, dirItem),
868
+ src: path.join(copyTask.src, dirItem),
869
+ dest: path.join(copyTask.dest, dirItem),
831
870
  warn: copyTask.warn
832
- });
871
+ }, walk);
833
872
  }));
834
873
  } catch (e) {
835
874
  catchError(results.diagnostics, e);
@@ -838,7 +877,7 @@ async function processCopyTaskDirectory(results, allCopyTasks, copyTask) {
838
877
  function ensureDirs(copyTasks) {
839
878
  const mkDirs = [];
840
879
  copyTasks.forEach((copyTask) => {
841
- addMkDir(mkDirs, path$1.dirname(copyTask.dest));
880
+ addMkDir(mkDirs, path.dirname(copyTask.dest));
842
881
  });
843
882
  mkDirs.sort((a, b) => {
844
883
  const partsA = a.split("/").length;
@@ -856,15 +895,14 @@ function addMkDir(mkDirs, destDir) {
856
895
  if (destDir === ROOT_DIR || destDir + "/" === ROOT_DIR || destDir === "") return;
857
896
  if (!mkDirs.includes(destDir)) mkDirs.push(destDir);
858
897
  }
859
- const ROOT_DIR = normalizePath(path$1.resolve("/"));
860
- function shouldIgnore({ src, ignore = [] }) {
861
- const filePath = src.trim().toLowerCase();
862
- return ignore.some((ignoreFile) => filePath.endsWith(ignoreFile));
863
- }
864
- function asyncGlob(pattern, opts) {
865
- return glob(pattern, opts);
898
+ const ROOT_DIR = normalizePath(path.resolve("/"));
899
+ function asyncGlob(pattern, opts = {}) {
900
+ const { nodir, ...rest } = opts;
901
+ return glob(pattern, {
902
+ ...rest,
903
+ onlyFiles: nodir ?? true
904
+ });
866
905
  }
867
-
868
906
  //#endregion
869
907
  //#region src/sys/node/node-lazy-require.ts
870
908
  /**
@@ -872,6 +910,8 @@ function asyncGlob(pattern, opts) {
872
910
  * returning diagnostic errors if requirements aren't met.
873
911
  */
874
912
  var NodeLazyRequire = class {
913
+ nodeResolveModule;
914
+ lazyDependencies;
875
915
  ensured = /* @__PURE__ */ new Set();
876
916
  /**
877
917
  * Create a NodeLazyRequire instance
@@ -909,7 +949,7 @@ var NodeLazyRequire = class {
909
949
  this.ensured.add(ensureModuleId);
910
950
  return;
911
951
  }
912
- } catch (e) {}
952
+ } catch {}
913
953
  problemDeps.push(`${ensureModuleId}@${recommendedVersion}`);
914
954
  }
915
955
  });
@@ -926,10 +966,9 @@ var NodeLazyRequire = class {
926
966
  }
927
967
  getModulePath(fromDir, moduleId) {
928
968
  const modulePath = this.nodeResolveModule.resolveModule(fromDir, moduleId);
929
- return path$1.dirname(modulePath);
969
+ return path.dirname(modulePath);
930
970
  }
931
971
  };
932
-
933
972
  //#endregion
934
973
  //#region src/sys/node/node-resolve-module.ts
935
974
  var NodeResolveModule = class {
@@ -941,18 +980,18 @@ var NodeResolveModule = class {
941
980
  if (opts && opts.manuallyResolve) return this.resolveModuleManually(fromDir, moduleId, cacheKey);
942
981
  if (moduleId.startsWith("@types/")) return this.resolveTypesModule(fromDir, moduleId, cacheKey);
943
982
  const Module = __require("module");
944
- fromDir = path$1.resolve(fromDir);
945
- const fromFile = path$1.join(fromDir, "noop.js");
983
+ fromDir = path.resolve(fromDir);
984
+ const fromFile = path.join(fromDir, "noop.js");
946
985
  let dir = normalizePath(Module._resolveFilename(moduleId, {
947
986
  id: fromFile,
948
987
  filename: fromFile,
949
988
  paths: Module._nodeModulePaths(fromDir)
950
989
  }));
951
- const root = normalizePath(path$1.parse(fromDir).root);
990
+ const root = normalizePath(path.parse(fromDir).root);
952
991
  let packageJsonFilePath;
953
992
  while (dir !== root) {
954
- dir = normalizePath(path$1.dirname(dir));
955
- packageJsonFilePath = path$1.join(dir, "package.json");
993
+ dir = normalizePath(path.dirname(dir));
994
+ packageJsonFilePath = path.join(dir, "package.json");
956
995
  if (!fs.existsSync(packageJsonFilePath)) continue;
957
996
  this.resolveModuleCache.set(cacheKey, packageJsonFilePath);
958
997
  return packageJsonFilePath;
@@ -961,12 +1000,12 @@ var NodeResolveModule = class {
961
1000
  }
962
1001
  resolveTypesModule(fromDir, moduleId, cacheKey) {
963
1002
  const moduleSplt = moduleId.split("/");
964
- const root = normalizePath(path$1.parse(fromDir).root);
965
- let dir = normalizePath(path$1.join(fromDir, "noop.js"));
1003
+ const root = normalizePath(path.parse(fromDir).root);
1004
+ let dir = normalizePath(path.join(fromDir, "noop.js"));
966
1005
  let typesPackageJsonFilePath;
967
1006
  while (dir !== root) {
968
- dir = normalizePath(path$1.dirname(dir));
969
- typesPackageJsonFilePath = path$1.join(dir, "node_modules", moduleSplt[0], moduleSplt[1], "package.json");
1007
+ dir = normalizePath(path.dirname(dir));
1008
+ typesPackageJsonFilePath = path.join(dir, "node_modules", moduleSplt[0], moduleSplt[1], "package.json");
970
1009
  if (!fs.existsSync(typesPackageJsonFilePath)) continue;
971
1010
  this.resolveModuleCache.set(cacheKey, typesPackageJsonFilePath);
972
1011
  return typesPackageJsonFilePath;
@@ -974,12 +1013,12 @@ var NodeResolveModule = class {
974
1013
  throw new Error(`error loading "${moduleId}" from "${fromDir}"`);
975
1014
  }
976
1015
  resolveModuleManually(fromDir, moduleId, cacheKey) {
977
- const root = normalizePath(path$1.parse(fromDir).root);
978
- let dir = normalizePath(path$1.join(fromDir, "noop.js"));
1016
+ const root = normalizePath(path.parse(fromDir).root);
1017
+ let dir = normalizePath(path.join(fromDir, "noop.js"));
979
1018
  let packageJsonFilePath;
980
1019
  while (dir !== root) {
981
- dir = normalizePath(path$1.dirname(dir));
982
- packageJsonFilePath = path$1.join(dir, "node_modules", moduleId, "package.json");
1020
+ dir = normalizePath(path.dirname(dir));
1021
+ packageJsonFilePath = path.join(dir, "node_modules", moduleId, "package.json");
983
1022
  if (!fs.existsSync(packageJsonFilePath)) continue;
984
1023
  this.resolveModuleCache.set(cacheKey, packageJsonFilePath);
985
1024
  return packageJsonFilePath;
@@ -987,11 +1026,10 @@ var NodeResolveModule = class {
987
1026
  throw new Error(`error loading "${moduleId}" from "${fromDir}"`);
988
1027
  }
989
1028
  };
990
-
991
1029
  //#endregion
992
1030
  //#region src/sys/node/node-stencil-version-checker.ts
993
1031
  const REGISTRY_URL = `https://registry.npmjs.org/@stencil/core`;
994
- const CHECK_INTERVAL = 1e3 * 60 * 60 * 24 * 7;
1032
+ const CHECK_INTERVAL = 6048e5;
995
1033
  const CHANGELOG = `https://github.com/stenciljs/core/blob/main/CHANGELOG.md`;
996
1034
  async function checkVersion(logger, currentVersion) {
997
1035
  try {
@@ -1052,7 +1090,7 @@ function getLastCheck() {
1052
1090
  fs.readFile(getLastCheckStoragePath(), "utf8", (err, data) => {
1053
1091
  if (!err && isString(data)) try {
1054
1092
  resolve(JSON.parse(data));
1055
- } catch (e) {}
1093
+ } catch {}
1056
1094
  resolve(null);
1057
1095
  });
1058
1096
  });
@@ -1066,7 +1104,7 @@ function setLastCheck() {
1066
1104
  });
1067
1105
  }
1068
1106
  function getLastCheckStoragePath() {
1069
- return path$1.join(tmpdir$1(), "stencil_last_version_node.json");
1107
+ return path.join(tmpdir$1(), "stencil_last_version_node.json");
1070
1108
  }
1071
1109
  function printUpdateMessage(logger, currentVersion, latestVersion) {
1072
1110
  const installMessage = `npm install @stencil/core`;
@@ -1110,7 +1148,6 @@ const BOX_VERTICAL = `│`;
1110
1148
  const BOX_HORIZONTAL = `─`;
1111
1149
  const PADDING = 2;
1112
1150
  const INDENT = ` `;
1113
-
1114
1151
  //#endregion
1115
1152
  //#region src/sys/node/node-worker-main.ts
1116
1153
  /**
@@ -1118,6 +1155,7 @@ const INDENT = ` `;
1118
1155
  * thread so that messages may be passed to it.
1119
1156
  */
1120
1157
  var NodeWorkerMain = class extends EventEmitter {
1158
+ id;
1121
1159
  /**
1122
1160
  * A handle for the OS process that is running our worker code
1123
1161
  */
@@ -1156,7 +1194,7 @@ var NodeWorkerMain = class extends EventEmitter {
1156
1194
  });
1157
1195
  this.childProcess.stderr.setEncoding("utf8");
1158
1196
  this.childProcess.stderr.on("data", (data) => {
1159
- console.log(data);
1197
+ console.error(data);
1160
1198
  });
1161
1199
  this.childProcess.on("message", this.receiveFromWorker.bind(this));
1162
1200
  this.childProcess.on("error", (err) => {
@@ -1190,7 +1228,7 @@ var NodeWorkerMain = class extends EventEmitter {
1190
1228
  this.sendQueue = [];
1191
1229
  queueCopy.forEach((d) => this.sendToWorker(d));
1192
1230
  }
1193
- }) || /^win/.test(process.platform)) this.processQueue = false;
1231
+ }) || process.platform.startsWith("win")) this.processQueue = false;
1194
1232
  }
1195
1233
  receiveFromWorker(msgFromWorker) {
1196
1234
  this.successfulMessage = true;
@@ -1217,7 +1255,6 @@ var NodeWorkerMain = class extends EventEmitter {
1217
1255
  } else this.childProcess.kill("SIGKILL");
1218
1256
  }
1219
1257
  };
1220
-
1221
1258
  //#endregion
1222
1259
  //#region src/sys/node/node-worker-controller.ts
1223
1260
  /**
@@ -1225,6 +1262,7 @@ var NodeWorkerMain = class extends EventEmitter {
1225
1262
  * node.js workers ({@link NodeWorkerMain} instances)
1226
1263
  */
1227
1264
  var NodeWorkerController = class extends EventEmitter {
1265
+ forkModulePath;
1228
1266
  workerIds = 0;
1229
1267
  stencilId = 0;
1230
1268
  isEnding = false;
@@ -1356,7 +1394,6 @@ function getNextWorker(workers) {
1356
1394
  return 0;
1357
1395
  })[0];
1358
1396
  }
1359
-
1360
1397
  //#endregion
1361
1398
  //#region src/sys/node/node-sys.ts
1362
1399
  const __dirname = import.meta.dirname;
@@ -1377,14 +1414,14 @@ function createNodeSys(c = {}) {
1377
1414
  const sysCpus = cpus();
1378
1415
  const hardwareConcurrency = sysCpus.length;
1379
1416
  const osPlatform = platform();
1380
- const compilerExecutingPath = path.join(__dirname, "compiler", "index.mjs");
1417
+ const compilerExecutingPath = nodePath.join(__dirname, "compiler", "index.mjs");
1381
1418
  const runInterruptsCallbacks = () => {
1382
1419
  const returnValues = [];
1383
1420
  let cb;
1384
1421
  while (isFunction(cb = onInterruptsCallbacks.pop())) try {
1385
1422
  const rtn = cb();
1386
1423
  returnValues.push(rtn);
1387
- } catch (e) {}
1424
+ } catch {}
1388
1425
  return Promise.all(returnValues).then(() => {});
1389
1426
  };
1390
1427
  const sys = {
@@ -1400,7 +1437,7 @@ function createNodeSys(c = {}) {
1400
1437
  try {
1401
1438
  fs.accessSync(p);
1402
1439
  hasAccess = true;
1403
- } catch (e) {}
1440
+ } catch {}
1404
1441
  return hasAccess;
1405
1442
  },
1406
1443
  addDestroy(cb) {
@@ -1410,37 +1447,10 @@ function createNodeSys(c = {}) {
1410
1447
  destroys.delete(cb);
1411
1448
  },
1412
1449
  applyPrerenderGlobalPatch(opts) {
1413
- if (typeof global.fetch !== "function") {
1414
- const nodeFetch = __require(path.join(__dirname, "node-fetch.js"));
1415
- global.fetch = (input, init) => {
1416
- if (typeof input === "string") {
1417
- const urlStr = new URL(input, opts.devServerHostUrl).href;
1418
- return nodeFetch.fetch(urlStr, init);
1419
- } else {
1420
- input.url = new URL(input.url, opts.devServerHostUrl).href;
1421
- return nodeFetch.fetch(input, init);
1422
- }
1423
- };
1424
- global.Headers = nodeFetch.Headers;
1425
- global.Request = nodeFetch.Request;
1426
- global.Response = nodeFetch.Response;
1427
- global.FetchError = nodeFetch.FetchError;
1428
- }
1429
1450
  opts.window.fetch = global.fetch;
1430
1451
  opts.window.Headers = global.Headers;
1431
1452
  opts.window.Request = global.Request;
1432
1453
  opts.window.Response = global.Response;
1433
- opts.window.FetchError = global.FetchError;
1434
- },
1435
- fetch: (input, init) => {
1436
- const nodeFetch = __require(path.join(__dirname, "node-fetch.js"));
1437
- if (typeof input === "string") {
1438
- const urlStr = new URL(input).href;
1439
- return nodeFetch.fetch(urlStr, init);
1440
- } else {
1441
- input.url = new URL(input.url).href;
1442
- return nodeFetch.fetch(input, init);
1443
- }
1444
1454
  },
1445
1455
  checkVersion,
1446
1456
  copyFile(src, dst) {
@@ -1454,8 +1464,8 @@ function createNodeSys(c = {}) {
1454
1464
  return new Promise((resolve) => {
1455
1465
  if (opts) fs.mkdir(p, opts, (err) => {
1456
1466
  resolve({
1457
- basename: path.basename(p),
1458
- dirname: path.dirname(p),
1467
+ basename: nodePath.basename(p),
1468
+ dirname: nodePath.dirname(p),
1459
1469
  path: p,
1460
1470
  newDirs: [],
1461
1471
  error: err
@@ -1463,8 +1473,8 @@ function createNodeSys(c = {}) {
1463
1473
  });
1464
1474
  else fs.mkdir(p, (err) => {
1465
1475
  resolve({
1466
- basename: path.basename(p),
1467
- dirname: path.dirname(p),
1476
+ basename: nodePath.basename(p),
1477
+ dirname: nodePath.dirname(p),
1468
1478
  path: p,
1469
1479
  newDirs: [],
1470
1480
  error: err
@@ -1474,8 +1484,8 @@ function createNodeSys(c = {}) {
1474
1484
  },
1475
1485
  createDirSync(p, opts) {
1476
1486
  const results = {
1477
- basename: path.basename(p),
1478
- dirname: path.dirname(p),
1487
+ basename: nodePath.basename(p),
1488
+ dirname: nodePath.dirname(p),
1479
1489
  path: p,
1480
1490
  newDirs: [],
1481
1491
  error: null
@@ -1488,7 +1498,7 @@ function createNodeSys(c = {}) {
1488
1498
  return results;
1489
1499
  },
1490
1500
  createWorkerController(maxConcurrentWorkers) {
1491
- return new NodeWorkerController(path.join(__dirname, "sys", "node", "worker.mjs"), maxConcurrentWorkers);
1501
+ return new NodeWorkerController(nodePath.join(__dirname, "sys", "node", "worker.mjs"), maxConcurrentWorkers);
1492
1502
  },
1493
1503
  async destroy() {
1494
1504
  const waits = [];
@@ -1504,22 +1514,11 @@ function createNodeSys(c = {}) {
1504
1514
  destroys.clear();
1505
1515
  },
1506
1516
  dynamicImport(p) {
1507
- return Promise.resolve(__require(p));
1517
+ return import(pathToFileURL(p).href);
1508
1518
  },
1509
1519
  encodeToBase64(str) {
1510
1520
  return Buffer.from(str).toString("base64");
1511
1521
  },
1512
- async ensureDependencies() {
1513
- console.warn(`ensureDependencies will be removed in a future version of Stencil.`);
1514
- console.warn(`To get the stencilPath, please use getCompilerExecutingPath().`);
1515
- return {
1516
- stencilPath: sys.getCompilerExecutingPath(),
1517
- diagnostics: []
1518
- };
1519
- },
1520
- async ensureResources() {
1521
- console.warn(`ensureResources is a no-op, and will be removed in a future version of Stencil`);
1522
- },
1523
1522
  exit: async (exitCode) => {
1524
1523
  await runInterruptsCallbacks();
1525
1524
  process.exitCode = exitCode;
@@ -1530,9 +1529,6 @@ function createNodeSys(c = {}) {
1530
1529
  getCompilerExecutingPath() {
1531
1530
  return compilerExecutingPath;
1532
1531
  },
1533
- getEnvironmentVar(key) {
1534
- return process.env[key];
1535
- },
1536
1532
  getLocalModulePath() {
1537
1533
  return null;
1538
1534
  },
@@ -1548,7 +1544,7 @@ function createNodeSys(c = {}) {
1548
1544
  if (err) resolve(false);
1549
1545
  else resolve(stats.isSymbolicLink());
1550
1546
  });
1551
- } catch (e) {
1547
+ } catch {
1552
1548
  resolve(false);
1553
1549
  }
1554
1550
  });
@@ -1558,13 +1554,13 @@ function createNodeSys(c = {}) {
1558
1554
  onProcessInterrupt: (cb) => {
1559
1555
  if (!onInterruptsCallbacks.includes(cb)) onInterruptsCallbacks.push(cb);
1560
1556
  },
1561
- platformPath: path,
1557
+ platformPath: nodePath,
1562
1558
  readDir(p) {
1563
1559
  return new Promise((resolve) => {
1564
1560
  fs.readdir(p, (err, files) => {
1565
1561
  if (err) resolve([]);
1566
1562
  else resolve(files.map((f) => {
1567
- return normalizePath(path.join(p, f));
1563
+ return normalizePath(nodePath.join(p, f));
1568
1564
  }));
1569
1565
  });
1570
1566
  });
@@ -1575,9 +1571,9 @@ function createNodeSys(c = {}) {
1575
1571
  readDirSync(p) {
1576
1572
  try {
1577
1573
  return fs.readdirSync(p).map((f) => {
1578
- return normalizePath(path.join(p, f));
1574
+ return normalizePath(nodePath.join(p, f));
1579
1575
  });
1580
- } catch (e) {}
1576
+ } catch {}
1581
1577
  return [];
1582
1578
  },
1583
1579
  readFile(p, encoding) {
@@ -1595,12 +1591,12 @@ function createNodeSys(c = {}) {
1595
1591
  readFileSync(p) {
1596
1592
  try {
1597
1593
  return fs.readFileSync(p, "utf8");
1598
- } catch (e) {}
1594
+ } catch {}
1599
1595
  },
1600
1596
  homeDir() {
1601
1597
  try {
1602
1598
  return os.homedir();
1603
- } catch (e) {}
1599
+ } catch {}
1604
1600
  },
1605
1601
  realpath(p) {
1606
1602
  return new Promise((resolve) => {
@@ -1652,8 +1648,8 @@ function createNodeSys(c = {}) {
1652
1648
  force: true
1653
1649
  }, (err) => {
1654
1650
  resolve({
1655
- basename: path.basename(p),
1656
- dirname: path.dirname(p),
1651
+ basename: nodePath.basename(p),
1652
+ dirname: nodePath.dirname(p),
1657
1653
  path: p,
1658
1654
  removedDirs: [],
1659
1655
  removedFiles: [],
@@ -1662,8 +1658,8 @@ function createNodeSys(c = {}) {
1662
1658
  });
1663
1659
  else fs.rmdir(p, (err) => {
1664
1660
  resolve({
1665
- basename: path.basename(p),
1666
- dirname: path.dirname(p),
1661
+ basename: nodePath.basename(p),
1662
+ dirname: nodePath.dirname(p),
1667
1663
  path: p,
1668
1664
  removedDirs: [],
1669
1665
  removedFiles: [],
@@ -1680,8 +1676,8 @@ function createNodeSys(c = {}) {
1680
1676
  });
1681
1677
  else fs.rmdirSync(p);
1682
1678
  return {
1683
- basename: path.basename(p),
1684
- dirname: path.dirname(p),
1679
+ basename: nodePath.basename(p),
1680
+ dirname: nodePath.dirname(p),
1685
1681
  path: p,
1686
1682
  removedDirs: [],
1687
1683
  removedFiles: [],
@@ -1689,8 +1685,8 @@ function createNodeSys(c = {}) {
1689
1685
  };
1690
1686
  } catch (e) {
1691
1687
  return {
1692
- basename: path.basename(p),
1693
- dirname: path.dirname(p),
1688
+ basename: nodePath.basename(p),
1689
+ dirname: nodePath.dirname(p),
1694
1690
  path: p,
1695
1691
  removedDirs: [],
1696
1692
  removedFiles: [],
@@ -1702,8 +1698,8 @@ function createNodeSys(c = {}) {
1702
1698
  return new Promise((resolve) => {
1703
1699
  fs.unlink(p, (err) => {
1704
1700
  resolve({
1705
- basename: path.basename(p),
1706
- dirname: path.dirname(p),
1701
+ basename: nodePath.basename(p),
1702
+ dirname: nodePath.dirname(p),
1707
1703
  path: p,
1708
1704
  error: err
1709
1705
  });
@@ -1712,8 +1708,8 @@ function createNodeSys(c = {}) {
1712
1708
  },
1713
1709
  removeFileSync(p) {
1714
1710
  const results = {
1715
- basename: path.basename(p),
1716
- dirname: path.dirname(p),
1711
+ basename: nodePath.basename(p),
1712
+ dirname: nodePath.dirname(p),
1717
1713
  path: p,
1718
1714
  error: null
1719
1715
  };
@@ -1732,6 +1728,11 @@ function createNodeSys(c = {}) {
1732
1728
  * Watch a directory for changes using @parcel/watcher.
1733
1729
  * Uses native file system events (FSEvents on macOS, inotify on Linux, ReadDirectoryChangesW on Windows)
1734
1730
  * for efficient, low-latency change detection.
1731
+ *
1732
+ * @param p - the directory path to watch
1733
+ * @param callback - the callback function when changes occur
1734
+ * @param _recursive - unused recursive flag
1735
+ * @returns a file watcher with a close method
1735
1736
  */
1736
1737
  sys.watchDirectory = (p, callback, _recursive) => {
1737
1738
  logger?.debug(`NODE_SYS_DEBUG::watchDir ${p}`);
@@ -1775,11 +1776,15 @@ function createNodeSys(c = {}) {
1775
1776
  /**
1776
1777
  * Watch an individual file for changes using @parcel/watcher.
1777
1778
  * Watches the parent directory and filters events for the specific file.
1779
+ *
1780
+ * @param filePath - the file path to watch
1781
+ * @param callback - the callback function when the file changes
1782
+ * @returns a file watcher with a close method
1778
1783
  */
1779
1784
  sys.watchFile = (filePath, callback) => {
1780
1785
  logger?.debug(`NODE_SYS_DEBUG::watchFile ${filePath}`);
1781
1786
  const normalizedPath = normalizePath(filePath);
1782
- const dirPath = path.dirname(filePath);
1787
+ const dirPath = nodePath.dirname(filePath);
1783
1788
  const subscriptionPromise = parcelWatcher.subscribe(dirPath, (err, events) => {
1784
1789
  if (err) {
1785
1790
  logger?.error(`Watch error for ${filePath}: ${err.message}`);
@@ -1916,39 +1921,13 @@ function createNodeSys(c = {}) {
1916
1921
  totalmem: totalmem()
1917
1922
  }
1918
1923
  };
1919
- sys.lazyRequire = new NodeLazyRequire(new NodeResolveModule(), {
1920
- "@types/jest": {
1921
- minVersion: "24.9.1",
1922
- recommendedVersion: "29",
1923
- maxVersion: "29.0.0"
1924
- },
1925
- jest: {
1926
- minVersion: "24.9.0",
1927
- recommendedVersion: "29",
1928
- maxVersion: "29.0.0"
1929
- },
1930
- "jest-cli": {
1931
- minVersion: "24.9.0",
1932
- recommendedVersion: "29",
1933
- maxVersion: "29.0.0"
1934
- },
1935
- puppeteer: {
1936
- minVersion: "10.0.0",
1937
- recommendedVersion: "20"
1938
- },
1939
- "puppeteer-core": {
1940
- minVersion: "10.0.0",
1941
- recommendedVersion: "20"
1942
- },
1943
- "workbox-build": {
1944
- minVersion: "4.3.1",
1945
- recommendedVersion: "4.3.1"
1946
- }
1947
- });
1924
+ sys.lazyRequire = new NodeLazyRequire(new NodeResolveModule(), { "workbox-build": {
1925
+ minVersion: "4.3.1",
1926
+ recommendedVersion: "7"
1927
+ } });
1948
1928
  prcs.on("SIGINT", runInterruptsCallbacks);
1949
1929
  prcs.on("exit", runInterruptsCallbacks);
1950
1930
  return sys;
1951
1931
  }
1952
-
1953
1932
  //#endregion
1954
- export { LOG_LEVELS as a, CustomElementsExportBehaviorOptions as i, setupNodeProcess as n, buildEvents as o, createNodeLogger as r, createNodeSys as t };
1933
+ export { LOG_LEVELS as a, CustomElementsExportBehaviorOptions as i, setupNodeProcess as n, buildEvents as o, createNodeLogger as r, createNodeSys as t };