@stencil/core 5.0.0-beta.26 → 5.0.0-beta.27

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,10 +1,11 @@
1
1
  import { n as __require } from "./rolldown-runtime-BhDjJH2R.mjs";
2
- import "./client-CVXS3JZ-.mjs";
2
+ import "./client-9wOO56Ye.mjs";
3
3
  import { c as isFunction, f as isString, m as noop, r as flatOne } from "./helpers-Cpp3qc3u.mjs";
4
4
  import { $ as catchError, K as normalizePath, X as buildError, Y as TASK_CANCELED_MSG, nt as shouldIgnoreError, rt as isGlob } from "./util-IKfWWLJo.mjs";
5
5
  import fs from "node:fs";
6
6
  import nodePath from "node:path";
7
7
  import { pathToFileURL } from "node:url";
8
+ import picomatch from "picomatch";
8
9
  import path from "path";
9
10
  import chalk from "chalk";
10
11
  import { createHash } from "node:crypto";
@@ -766,7 +767,13 @@ async function nodeCopyTasks(copyTasks, srcDir) {
766
767
  filePaths: []
767
768
  };
768
769
  try {
769
- 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
+ })));
770
777
  const allCopyTasks = [];
771
778
  while (copyTasks.length > 0) {
772
779
  const tasks = copyTasks.splice(0, 100);
@@ -791,9 +798,21 @@ async function processGlobs(copyTask, srcDir) {
791
798
  dest: copyTask.keepDirStructure ? path.join(copyTask.dest, copyTask.src) : copyTask.dest,
792
799
  warn: copyTask.warn,
793
800
  ignore: copyTask.ignore,
794
- keepDirStructure: copyTask.keepDirStructure
801
+ keepDirStructure: copyTask.keepDirStructure,
802
+ destRoot: copyTask.dest
795
803
  }];
796
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
+ }
797
816
  function getSrcAbsPath(srcDir, src) {
798
817
  if (path.isAbsolute(src)) return src;
799
818
  return path.join(srcDir, src);
@@ -812,17 +831,25 @@ function createGlobCopyTask(copyTask, srcDir, globRelPath) {
812
831
  dest,
813
832
  ignore: copyTask.ignore,
814
833
  warn: copyTask.warn,
815
- keepDirStructure: copyTask.keepDirStructure
834
+ keepDirStructure: copyTask.keepDirStructure,
835
+ destRoot: copyTask.dest
816
836
  };
817
837
  }
818
- 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) {
819
846
  try {
820
847
  copyTask.src = normalizePath(copyTask.src);
821
848
  copyTask.dest = normalizePath(copyTask.dest);
822
849
  if ((await stat(copyTask.src)).isDirectory()) {
823
850
  if (!results.dirPaths.includes(copyTask.dest)) results.dirPaths.push(copyTask.dest);
824
- await processCopyTaskDirectory(results, allCopyTasks, copyTask);
825
- } 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))) {
826
853
  if (!results.filePaths.includes(copyTask.dest)) results.filePaths.push(copyTask.dest);
827
854
  allCopyTasks.push(copyTask);
828
855
  }
@@ -833,7 +860,7 @@ async function processCopyTask(results, allCopyTasks, copyTask) {
833
860
  }
834
861
  }
835
862
  }
836
- async function processCopyTaskDirectory(results, allCopyTasks, copyTask) {
863
+ async function processCopyTaskDirectory(results, allCopyTasks, copyTask, walk) {
837
864
  try {
838
865
  const dirItems = await readdir(copyTask.src);
839
866
  await Promise.all(dirItems.map(async (dirItem) => {
@@ -841,7 +868,7 @@ async function processCopyTaskDirectory(results, allCopyTasks, copyTask) {
841
868
  src: path.join(copyTask.src, dirItem),
842
869
  dest: path.join(copyTask.dest, dirItem),
843
870
  warn: copyTask.warn
844
- });
871
+ }, walk);
845
872
  }));
846
873
  } catch (e) {
847
874
  catchError(results.diagnostics, e);
@@ -869,10 +896,6 @@ function addMkDir(mkDirs, destDir) {
869
896
  if (!mkDirs.includes(destDir)) mkDirs.push(destDir);
870
897
  }
871
898
  const ROOT_DIR = normalizePath(path.resolve("/"));
872
- function shouldIgnore({ src, ignore = [] }) {
873
- const filePath = src.trim().toLowerCase();
874
- return ignore.some((ignoreFile) => filePath.endsWith(ignoreFile));
875
- }
876
899
  function asyncGlob(pattern, opts = {}) {
877
900
  const { nodir, ...rest } = opts;
878
901
  return glob(pattern, {
@@ -3297,17 +3297,23 @@ const vdomFnUtils = {
3297
3297
  * Convert a {@link d.VNode} to a {@link d.ChildNode} in order to present a
3298
3298
  * friendlier public interface (hence, 'convertToPublic').
3299
3299
  *
3300
- * @param node the virtual DOM node to convert
3300
+ * Functional components receive primitive children unwrapped, so those
3301
+ * become text-only child nodes.
3302
+ *
3303
+ * @param node the virtual DOM node (or primitive child) to convert
3301
3304
  * @returns a converted child node
3302
3305
  */
3303
- const convertToPublic = (node) => ({
3306
+ const convertToPublic = (node) => typeof node !== "object" ? {
3307
+ vtag: null,
3308
+ vtext: String(node)
3309
+ } : {
3304
3310
  vattrs: node.$attrs$,
3305
3311
  vchildren: node.$children$,
3306
3312
  vkey: node.$key$,
3307
3313
  vname: node.$name$,
3308
3314
  vtag: node.$tag$,
3309
3315
  vtext: node.$text$
3310
- });
3316
+ };
3311
3317
  /**
3312
3318
  * Convert a {@link d.ChildNode} back to an equivalent {@link d.VNode} in
3313
3319
  * order to use the resulting object in the virtual DOM. The initial object was
@@ -3324,11 +3330,11 @@ const convertToPrivate = (node) => {
3324
3330
  if (node.vname) vnodeData.name = node.vname;
3325
3331
  return h(node.vtag, vnodeData, ...node.vchildren || []);
3326
3332
  }
3327
- const vnode = newVNode(node.vtag, node.vtext);
3328
- vnode.$attrs$ = node.vattrs;
3329
- vnode.$children$ = node.vchildren;
3330
- vnode.$key$ = node.vkey;
3331
- vnode.$name$ = node.vname;
3333
+ const vnode = newVNode(node.vtag ?? null, node.vtext);
3334
+ vnode.$attrs$ = node.vattrs ?? null;
3335
+ vnode.$children$ = node.vchildren ?? null;
3336
+ vnode.$key$ = node.vkey ?? null;
3337
+ vnode.$name$ = node.vname ?? null;
3332
3338
  return vnode;
3333
3339
  };
3334
3340
  /**
@@ -3291,17 +3291,23 @@ const vdomFnUtils = {
3291
3291
  * Convert a {@link d.VNode} to a {@link d.ChildNode} in order to present a
3292
3292
  * friendlier public interface (hence, 'convertToPublic').
3293
3293
  *
3294
- * @param node the virtual DOM node to convert
3294
+ * Functional components receive primitive children unwrapped, so those
3295
+ * become text-only child nodes.
3296
+ *
3297
+ * @param node the virtual DOM node (or primitive child) to convert
3295
3298
  * @returns a converted child node
3296
3299
  */
3297
- const convertToPublic = (node) => ({
3300
+ const convertToPublic = (node) => typeof node !== "object" ? {
3301
+ vtag: null,
3302
+ vtext: String(node)
3303
+ } : {
3298
3304
  vattrs: node.$attrs$,
3299
3305
  vchildren: node.$children$,
3300
3306
  vkey: node.$key$,
3301
3307
  vname: node.$name$,
3302
3308
  vtag: node.$tag$,
3303
3309
  vtext: node.$text$
3304
- });
3310
+ };
3305
3311
  /**
3306
3312
  * Convert a {@link d.ChildNode} back to an equivalent {@link d.VNode} in
3307
3313
  * order to use the resulting object in the virtual DOM. The initial object was
@@ -3318,11 +3324,11 @@ const convertToPrivate = (node) => {
3318
3324
  if (node.vname) vnodeData.name = node.vname;
3319
3325
  return h(node.vtag, vnodeData, ...node.vchildren || []);
3320
3326
  }
3321
- const vnode = newVNode(node.vtag, node.vtext);
3322
- vnode.$attrs$ = node.vattrs;
3323
- vnode.$children$ = node.vchildren;
3324
- vnode.$key$ = node.vkey;
3325
- vnode.$name$ = node.vname;
3327
+ const vnode = newVNode(node.vtag ?? null, node.vtext);
3328
+ vnode.$attrs$ = node.vattrs ?? null;
3329
+ vnode.$children$ = node.vchildren ?? null;
3330
+ vnode.$key$ = node.vkey ?? null;
3331
+ vnode.$name$ = node.vname ?? null;
3326
3332
  return vnode;
3327
3333
  };
3328
3334
  /**
@@ -3163,17 +3163,23 @@ const vdomFnUtils = {
3163
3163
  * Convert a {@link d.VNode} to a {@link d.ChildNode} in order to present a
3164
3164
  * friendlier public interface (hence, 'convertToPublic').
3165
3165
  *
3166
- * @param node the virtual DOM node to convert
3166
+ * Functional components receive primitive children unwrapped, so those
3167
+ * become text-only child nodes.
3168
+ *
3169
+ * @param node the virtual DOM node (or primitive child) to convert
3167
3170
  * @returns a converted child node
3168
3171
  */
3169
- const convertToPublic = (node) => ({
3172
+ const convertToPublic = (node) => typeof node !== "object" ? {
3173
+ vtag: null,
3174
+ vtext: String(node)
3175
+ } : {
3170
3176
  vattrs: node.$attrs$,
3171
3177
  vchildren: node.$children$,
3172
3178
  vkey: node.$key$,
3173
3179
  vname: node.$name$,
3174
3180
  vtag: node.$tag$,
3175
3181
  vtext: node.$text$
3176
- });
3182
+ };
3177
3183
  /**
3178
3184
  * Convert a {@link d.ChildNode} back to an equivalent {@link d.VNode} in
3179
3185
  * order to use the resulting object in the virtual DOM. The initial object was
@@ -3190,11 +3196,11 @@ const convertToPrivate = (node) => {
3190
3196
  if (node.vname) vnodeData.name = node.vname;
3191
3197
  return h(node.vtag, vnodeData, ...node.vchildren || []);
3192
3198
  }
3193
- const vnode = newVNode(node.vtag, node.vtext);
3194
- vnode.$attrs$ = node.vattrs;
3195
- vnode.$children$ = node.vchildren;
3196
- vnode.$key$ = node.vkey;
3197
- vnode.$name$ = node.vname;
3199
+ const vnode = newVNode(node.vtag ?? null, node.vtext);
3200
+ vnode.$attrs$ = node.vattrs ?? null;
3201
+ vnode.$children$ = node.vchildren ?? null;
3202
+ vnode.$key$ = node.vkey ?? null;
3203
+ vnode.$name$ = node.vname ?? null;
3198
3204
  return vnode;
3199
3205
  };
3200
3206
  /**
@@ -2933,17 +2933,23 @@ const vdomFnUtils = {
2933
2933
  * Convert a {@link d.VNode} to a {@link d.ChildNode} in order to present a
2934
2934
  * friendlier public interface (hence, 'convertToPublic').
2935
2935
  *
2936
- * @param node the virtual DOM node to convert
2936
+ * Functional components receive primitive children unwrapped, so those
2937
+ * become text-only child nodes.
2938
+ *
2939
+ * @param node the virtual DOM node (or primitive child) to convert
2937
2940
  * @returns a converted child node
2938
2941
  */
2939
- const convertToPublic = (node) => ({
2942
+ const convertToPublic = (node) => typeof node !== "object" ? {
2943
+ vtag: null,
2944
+ vtext: String(node)
2945
+ } : {
2940
2946
  vattrs: node.$attrs$,
2941
2947
  vchildren: node.$children$,
2942
2948
  vkey: node.$key$,
2943
2949
  vname: node.$name$,
2944
2950
  vtag: node.$tag$,
2945
2951
  vtext: node.$text$
2946
- });
2952
+ };
2947
2953
  /**
2948
2954
  * Convert a {@link d.ChildNode} back to an equivalent {@link d.VNode} in
2949
2955
  * order to use the resulting object in the virtual DOM. The initial object was
@@ -2960,11 +2966,11 @@ const convertToPrivate = (node) => {
2960
2966
  if (node.vname) vnodeData.name = node.vname;
2961
2967
  return h(node.vtag, vnodeData, ...node.vchildren || []);
2962
2968
  }
2963
- const vnode = newVNode(node.vtag, node.vtext);
2964
- vnode.$attrs$ = node.vattrs;
2965
- vnode.$children$ = node.vchildren;
2966
- vnode.$key$ = node.vkey;
2967
- vnode.$name$ = node.vname;
2969
+ const vnode = newVNode(node.vtag ?? null, node.vtext);
2970
+ vnode.$attrs$ = node.vattrs ?? null;
2971
+ vnode.$children$ = node.vchildren ?? null;
2972
+ vnode.$key$ = node.vkey ?? null;
2973
+ vnode.$name$ = node.vname ?? null;
2968
2974
  return vnode;
2969
2975
  };
2970
2976
  /**
@@ -1,4 +1,4 @@
1
- import { Bt as Logger, nt as CompilerSystem } from "../../index-C41EOWaQ.mjs";
1
+ import { Bt as Logger, nt as CompilerSystem } from "../../index-DMJOS1Fo.mjs";
2
2
  //#region src/sys/node/logger/index.d.ts
3
3
  /**
4
4
  * Create a logger to run in a Node environment
@@ -1,2 +1,2 @@
1
- import { n as setupNodeProcess, r as createNodeLogger, t as createNodeSys } from "../../node-Bz2SOK7_.mjs";
1
+ import { n as setupNodeProcess, r as createNodeLogger, t as createNodeSys } from "../../node-DomivDBh.mjs";
2
2
  export { createNodeLogger, createNodeSys, setupNodeProcess };
@@ -1,5 +1,5 @@
1
- import { l as createWorkerMessageHandler } from "../../compiler-D7LTP5Hp.mjs";
2
- import { t as createNodeSys } from "../../node-Bz2SOK7_.mjs";
1
+ import { l as createWorkerMessageHandler } from "../../compiler-CBXVJZa8.mjs";
2
+ import { t as createNodeSys } from "../../node-DomivDBh.mjs";
3
3
  //#region src/sys/node/node-worker-thread.ts
4
4
  /**
5
5
  * Initialize a worker thread, setting up various machinery for managing
@@ -2112,7 +2112,9 @@ interface CopyTask {
2112
2112
  /**
2113
2113
  * Additional glob patterns to exclude from the copy operation, merged with
2114
2114
  * the built-in defaults: `__mocks__`, `__fixtures__`, `dist`, hidden dirs,
2115
- * `.ds_store`, `.gitignore`, `desktop.ini`, `thumbs.db`.
2115
+ * `.ds_store`, `.gitignore`, `desktop.ini`, `thumbs.db`. For a directory
2116
+ * `src`, patterns match paths relative to that directory; an explicitly
2117
+ * named `src` file is never ignored.
2116
2118
  */
2117
2119
  ignore?: string[];
2118
2120
  /**
@@ -33,7 +33,7 @@ import "@rollup/pluginutils";
33
33
  import { createHash } from "crypto";
34
34
  import { afterAll, vi } from "vitest";
35
35
  //#region src/version.ts
36
- const version = "5.0.0-beta.26";
36
+ const version = "5.0.0-beta.27";
37
37
  const MEMBER_FLAGS = {
38
38
  String: 1,
39
39
  Number: 2,
@@ -3690,17 +3690,23 @@ const vdomFnUtils = {
3690
3690
  * Convert a {@link d.VNode} to a {@link d.ChildNode} in order to present a
3691
3691
  * friendlier public interface (hence, 'convertToPublic').
3692
3692
  *
3693
- * @param node the virtual DOM node to convert
3693
+ * Functional components receive primitive children unwrapped, so those
3694
+ * become text-only child nodes.
3695
+ *
3696
+ * @param node the virtual DOM node (or primitive child) to convert
3694
3697
  * @returns a converted child node
3695
3698
  */
3696
- const convertToPublic = (node) => ({
3699
+ const convertToPublic = (node) => typeof node !== "object" ? {
3700
+ vtag: null,
3701
+ vtext: String(node)
3702
+ } : {
3697
3703
  vattrs: node.$attrs$,
3698
3704
  vchildren: node.$children$,
3699
3705
  vkey: node.$key$,
3700
3706
  vname: node.$name$,
3701
3707
  vtag: node.$tag$,
3702
3708
  vtext: node.$text$
3703
- });
3709
+ };
3704
3710
  /**
3705
3711
  * Convert a {@link d.ChildNode} back to an equivalent {@link d.VNode} in
3706
3712
  * order to use the resulting object in the virtual DOM. The initial object was
@@ -3717,11 +3723,11 @@ const convertToPrivate = (node) => {
3717
3723
  if (node.vname) vnodeData.name = node.vname;
3718
3724
  return h(node.vtag, vnodeData, ...node.vchildren || []);
3719
3725
  }
3720
- const vnode = newVNode(node.vtag, node.vtext);
3721
- vnode.$attrs$ = node.vattrs;
3722
- vnode.$children$ = node.vchildren;
3723
- vnode.$key$ = node.vkey;
3724
- vnode.$name$ = node.vname;
3726
+ const vnode = newVNode(node.vtag ?? null, node.vtext);
3727
+ vnode.$attrs$ = node.vattrs ?? null;
3728
+ vnode.$children$ = node.vchildren ?? null;
3729
+ vnode.$key$ = node.vkey ?? null;
3730
+ vnode.$name$ = node.vname ?? null;
3725
3731
  return vnode;
3726
3732
  };
3727
3733
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stencil/core",
3
- "version": "5.0.0-beta.26",
3
+ "version": "5.0.0-beta.27",
4
4
  "description": "A Compiler for Web Components and Progressive Web Apps",
5
5
  "keywords": [
6
6
  "components",
@@ -126,9 +126,9 @@
126
126
  "terser": "^5.50.0",
127
127
  "tinyglobby": "^0.2.17",
128
128
  "typescript": ">5.0.0 <7.0.0",
129
- "@stencil/cli": "5.0.0-beta.26",
130
- "@stencil/dev-server": "5.0.0-beta.26",
131
- "@stencil/mock-doc": "5.0.0-beta.26"
129
+ "@stencil/cli": "5.0.0-beta.27",
130
+ "@stencil/dev-server": "5.0.0-beta.27",
131
+ "@stencil/mock-doc": "5.0.0-beta.27"
132
132
  },
133
133
  "devDependencies": {
134
134
  "@ionic/prettier-config": "^4.0.0",