@stencil/core 3.0.0-beta.1 → 3.0.0-rc.1

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 (44) hide show
  1. package/cli/index.cjs +12 -8
  2. package/cli/index.js +12 -8
  3. package/cli/package.json +1 -1
  4. package/compiler/package.json +1 -1
  5. package/compiler/stencil.js +60 -28
  6. package/compiler/stencil.min.js +2 -2
  7. package/dependencies.json +1 -1
  8. package/dev-server/client/index.js +1 -1
  9. package/dev-server/client/package.json +1 -1
  10. package/dev-server/connector.html +2 -2
  11. package/dev-server/index.js +1 -1
  12. package/dev-server/package.json +1 -1
  13. package/dev-server/server-process.js +6 -5
  14. package/dev-server/ws.js +1 -1
  15. package/internal/app-data/package.json +1 -1
  16. package/internal/client/css-shim.js +1 -1
  17. package/internal/client/dom.js +1 -1
  18. package/internal/client/index.js +108 -5
  19. package/internal/client/package.json +1 -1
  20. package/internal/client/patch-browser.js +19 -1
  21. package/internal/client/patch-esm.js +1 -1
  22. package/internal/client/shadow-css.js +1 -1
  23. package/internal/hydrate/index.js +48 -37
  24. package/internal/hydrate/package.json +1 -1
  25. package/internal/hydrate/runner.d.ts +16 -15
  26. package/internal/hydrate/runner.js +4 -2
  27. package/internal/package.json +1 -1
  28. package/internal/stencil-core/index.d.ts +1 -0
  29. package/internal/stencil-private.d.ts +10 -0
  30. package/internal/stencil-public-compiler.d.ts +12 -18
  31. package/internal/stencil-public-runtime.d.ts +20 -0
  32. package/internal/testing/index.js +53 -41
  33. package/internal/testing/package.json +1 -1
  34. package/mock-doc/index.cjs +1 -1
  35. package/mock-doc/index.js +1 -1
  36. package/mock-doc/package.json +1 -1
  37. package/package.json +7 -7
  38. package/screenshot/package.json +1 -1
  39. package/sys/node/glob.js +1 -1
  40. package/sys/node/index.js +1 -1
  41. package/sys/node/package.json +1 -1
  42. package/sys/node/worker.js +1 -1
  43. package/testing/index.js +72 -66
  44. package/testing/package.json +1 -1
package/cli/index.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- Stencil CLI (CommonJS) v3.0.0-beta.1 | MIT Licensed | https://stenciljs.com
2
+ Stencil CLI (CommonJS) v3.0.0-rc.1 | MIT Licensed | https://stenciljs.com
3
3
  */
4
4
  'use strict';
5
5
 
@@ -987,7 +987,7 @@ const dereferenceAlias = (maybeAlias) => {
987
987
  const dependencies = [
988
988
  {
989
989
  name: "@stencil/core",
990
- version: "3.0.0-beta.1",
990
+ version: "3.0.0-rc.1",
991
991
  main: "compiler/stencil.js",
992
992
  resources: [
993
993
  "package.json",
@@ -2554,16 +2554,20 @@ const run = async (init) => {
2554
2554
  * @public
2555
2555
  */
2556
2556
  const runTask = async (coreCompiler, config, task, sys) => {
2557
- var _a, _b, _c, _d, _e, _f;
2557
+ var _a, _b, _c, _d, _e, _f, _g;
2558
2558
  const logger = (_a = config.logger) !== null && _a !== void 0 ? _a : createLogger();
2559
+ const rootDir = (_b = config.rootDir) !== null && _b !== void 0 ? _b : '/';
2560
+ const configSys = (_c = sys !== null && sys !== void 0 ? sys : config.sys) !== null && _c !== void 0 ? _c : coreCompiler.createSystem({ logger });
2559
2561
  const strictConfig = {
2560
2562
  ...config,
2561
- flags: createConfigFlags((_b = config.flags) !== null && _b !== void 0 ? _b : { task }),
2563
+ flags: createConfigFlags((_d = config.flags) !== null && _d !== void 0 ? _d : { task }),
2564
+ hydratedFlag: (_e = config.hydratedFlag) !== null && _e !== void 0 ? _e : null,
2562
2565
  logger,
2563
- outputTargets: (_c = config.outputTargets) !== null && _c !== void 0 ? _c : [],
2564
- rootDir: (_d = config.rootDir) !== null && _d !== void 0 ? _d : '/',
2565
- sys: (_e = sys !== null && sys !== void 0 ? sys : config.sys) !== null && _e !== void 0 ? _e : coreCompiler.createSystem({ logger }),
2566
- testing: (_f = config.testing) !== null && _f !== void 0 ? _f : {},
2566
+ outputTargets: (_f = config.outputTargets) !== null && _f !== void 0 ? _f : [],
2567
+ packageJsonFilePath: configSys.platformPath.join(rootDir, 'package.json'),
2568
+ rootDir,
2569
+ sys: configSys,
2570
+ testing: (_g = config.testing) !== null && _g !== void 0 ? _g : {},
2567
2571
  };
2568
2572
  switch (task) {
2569
2573
  case 'build':
package/cli/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- Stencil CLI v3.0.0-beta.1 | MIT Licensed | https://stenciljs.com
2
+ Stencil CLI v3.0.0-rc.1 | MIT Licensed | https://stenciljs.com
3
3
  */
4
4
  /**
5
5
  * Convert a string from dash-case / kebab-case to PascalCase (or CamelCase,
@@ -963,7 +963,7 @@ const dereferenceAlias = (maybeAlias) => {
963
963
  const dependencies = [
964
964
  {
965
965
  name: "@stencil/core",
966
- version: "3.0.0-beta.1",
966
+ version: "3.0.0-rc.1",
967
967
  main: "compiler/stencil.js",
968
968
  resources: [
969
969
  "package.json",
@@ -2530,16 +2530,20 @@ const run = async (init) => {
2530
2530
  * @public
2531
2531
  */
2532
2532
  const runTask = async (coreCompiler, config, task, sys) => {
2533
- var _a, _b, _c, _d, _e, _f;
2533
+ var _a, _b, _c, _d, _e, _f, _g;
2534
2534
  const logger = (_a = config.logger) !== null && _a !== void 0 ? _a : createLogger();
2535
+ const rootDir = (_b = config.rootDir) !== null && _b !== void 0 ? _b : '/';
2536
+ const configSys = (_c = sys !== null && sys !== void 0 ? sys : config.sys) !== null && _c !== void 0 ? _c : coreCompiler.createSystem({ logger });
2535
2537
  const strictConfig = {
2536
2538
  ...config,
2537
- flags: createConfigFlags((_b = config.flags) !== null && _b !== void 0 ? _b : { task }),
2539
+ flags: createConfigFlags((_d = config.flags) !== null && _d !== void 0 ? _d : { task }),
2540
+ hydratedFlag: (_e = config.hydratedFlag) !== null && _e !== void 0 ? _e : null,
2538
2541
  logger,
2539
- outputTargets: (_c = config.outputTargets) !== null && _c !== void 0 ? _c : [],
2540
- rootDir: (_d = config.rootDir) !== null && _d !== void 0 ? _d : '/',
2541
- sys: (_e = sys !== null && sys !== void 0 ? sys : config.sys) !== null && _e !== void 0 ? _e : coreCompiler.createSystem({ logger }),
2542
- testing: (_f = config.testing) !== null && _f !== void 0 ? _f : {},
2542
+ outputTargets: (_f = config.outputTargets) !== null && _f !== void 0 ? _f : [],
2543
+ packageJsonFilePath: configSys.platformPath.join(rootDir, 'package.json'),
2544
+ rootDir,
2545
+ sys: configSys,
2546
+ testing: (_g = config.testing) !== null && _g !== void 0 ? _g : {},
2543
2547
  };
2544
2548
  switch (task) {
2545
2549
  case 'build':
package/cli/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stencil/core/cli",
3
- "version": "3.0.0-beta.1",
3
+ "version": "3.0.0-rc.1",
4
4
  "description": "Stencil CLI.",
5
5
  "main": "./index.cjs",
6
6
  "module": "./index.js",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stencil/core/compiler",
3
- "version": "3.0.0-beta.1",
3
+ "version": "3.0.0-rc.1",
4
4
  "description": "Stencil Compiler.",
5
5
  "main": "./stencil.js",
6
6
  "types": "./stencil.d.ts",
@@ -1,5 +1,5 @@
1
1
  /*!
2
- Stencil Compiler v3.0.0-beta.1 | MIT Licensed | https://stenciljs.com
2
+ Stencil Compiler v3.0.0-rc.1 | MIT Licensed | https://stenciljs.com
3
3
  */
4
4
  (function(exports) {
5
5
  'use strict';
@@ -1047,21 +1047,24 @@ const loadTypeScriptDiagnostics = (tsDiagnostics) => {
1047
1047
  * @returns a Stencil diagnostic, suitable for showing an error to the user
1048
1048
  */
1049
1049
  const loadTypeScriptDiagnostic = (tsDiagnostic) => {
1050
+ var _a;
1050
1051
  const d = {
1051
- level: 'warn',
1052
- type: 'typescript',
1053
- language: 'typescript',
1054
- header: 'TypeScript',
1052
+ absFilePath: undefined,
1055
1053
  code: tsDiagnostic.code.toString(),
1056
- messageText: flattenDiagnosticMessageText(tsDiagnostic, tsDiagnostic.messageText),
1057
- relFilePath: null,
1058
- absFilePath: null,
1054
+ columnNumber: undefined,
1055
+ header: 'TypeScript',
1056
+ language: 'typescript',
1057
+ level: 'warn',
1058
+ lineNumber: undefined,
1059
1059
  lines: [],
1060
+ messageText: flattenDiagnosticMessageText(tsDiagnostic, tsDiagnostic.messageText),
1061
+ relFilePath: undefined,
1062
+ type: 'typescript',
1060
1063
  };
1061
1064
  if (tsDiagnostic.category === 1) {
1062
1065
  d.level = 'error';
1063
1066
  }
1064
- if (tsDiagnostic.file) {
1067
+ if (tsDiagnostic.file && typeof tsDiagnostic.start === 'number') {
1065
1068
  d.absFilePath = tsDiagnostic.file.fileName;
1066
1069
  const sourceText = tsDiagnostic.file.text;
1067
1070
  const srcLines = splitLineBreaks(sourceText);
@@ -1071,7 +1074,7 @@ const loadTypeScriptDiagnostic = (tsDiagnostic) => {
1071
1074
  lineNumber: posData.line + 1,
1072
1075
  text: srcLines[posData.line],
1073
1076
  errorCharStart: posData.character,
1074
- errorLength: Math.max(tsDiagnostic.length, 1),
1077
+ errorLength: Math.max((_a = tsDiagnostic.length) !== null && _a !== void 0 ? _a : 0, 1),
1075
1078
  };
1076
1079
  d.lineNumber = errorLine.lineNumber;
1077
1080
  d.columnNumber = errorLine.errorCharStart + 1;
@@ -2098,7 +2101,7 @@ const process$3 = /*#__PURE__*/Object.assign(/*#__PURE__*/Object.create(null), p
2098
2101
  'default': process_1
2099
2102
  });
2100
2103
 
2101
- const buildId = '20230109182913';
2104
+ const buildId = '20230123172705';
2102
2105
  const minfyJsId = 'terser5.16.1_7';
2103
2106
  const optimizeCssId = 'autoprefixer10.4.13_postcss8.4.21_7';
2104
2107
  const parse5Version = '7.1.2';
@@ -2106,8 +2109,8 @@ const rollupVersion = '2.42.3';
2106
2109
  const sizzleVersion = '2.42.3';
2107
2110
  const terserVersion = '5.16.1';
2108
2111
  const typescriptVersion = '4.9.4';
2109
- const vermoji = '🚚';
2110
- const version$3 = '3.0.0-beta.1';
2112
+ const vermoji = '🍀';
2113
+ const version$3 = '3.0.0-rc.1';
2111
2114
  const versions = {
2112
2115
  stencil: version$3,
2113
2116
  parse5: parse5Version,
@@ -4839,6 +4842,7 @@ const autoprefixCss = async (cssText, opts) => {
4839
4842
  messageText: warning.text,
4840
4843
  level: 'warn',
4841
4844
  type: 'css',
4845
+ lines: [],
4842
4846
  });
4843
4847
  });
4844
4848
  output.output = result.css;
@@ -4849,6 +4853,7 @@ const autoprefixCss = async (cssText, opts) => {
4849
4853
  messageText: `CSS Error` + e,
4850
4854
  level: `error`,
4851
4855
  type: `css`,
4856
+ lines: [],
4852
4857
  };
4853
4858
  if (typeof e.name === 'string') {
4854
4859
  diagnostic.header = e.name;
@@ -57218,6 +57223,7 @@ const bundleCustomElements$1 = async (config, compilerCtx, buildCtx, outputTarge
57218
57223
  level: 'error',
57219
57224
  type: 'build',
57220
57225
  messageText: 'dist-custom-elements output target provided with no output target directory!',
57226
+ lines: [],
57221
57227
  });
57222
57228
  return;
57223
57229
  }
@@ -57314,7 +57320,7 @@ const generateEntryPoint$1 = (outputTarget, cmpImports = [], cmpExports = [], cm
57314
57320
  const imports = [];
57315
57321
  const exports = [];
57316
57322
  // Exports that are always present
57317
- exports.push(`export { setAssetPath, setPlatformOptions } from '${STENCIL_INTERNAL_CLIENT_ID}';`, `export * from '${USER_INDEX_ENTRY_ID}';`);
57323
+ exports.push(`export { setAssetPath, setNonce, setPlatformOptions } from '${STENCIL_INTERNAL_CLIENT_ID}';`, `export * from '${USER_INDEX_ENTRY_ID}';`);
57318
57324
  // Content related to global scripts
57319
57325
  if (outputTarget.includeGlobalScripts !== false) {
57320
57326
  imports.push(`import { globalScripts } from '${STENCIL_APP_GLOBALS_ID}';`);
@@ -59127,6 +59133,7 @@ function createEntryModule(cmps) {
59127
59133
  }
59128
59134
  const getLazyEntry = (isBrowser) => {
59129
59135
  const s = new MagicString$3(``);
59136
+ s.append(`export { setNonce } from '${STENCIL_CORE_ID}';\n`);
59130
59137
  s.append(`import { bootstrapLazy } from '${STENCIL_CORE_ID}';\n`);
59131
59138
  if (isBrowser) {
59132
59139
  s.append(`import { patchBrowser } from '${STENCIL_INTERNAL_CLIENT_PATCH_BROWSER_ID}';\n`);
@@ -60438,6 +60445,15 @@ export interface CustomElementsDefineOptions {
60438
60445
  }
60439
60446
  export declare function defineCustomElements(win?: Window, opts?: CustomElementsDefineOptions): Promise<void>;
60440
60447
  export declare function applyPolyfills(): Promise<void>;
60448
+
60449
+ /**
60450
+ * Used to specify a nonce value that corresponds with an application's CSP.
60451
+ * When set, the nonce will be added to all dynamically created script and style tags at runtime.
60452
+ * Alternatively, the nonce value can be set on a meta tag in the DOM head
60453
+ * (<meta name="csp-nonce" content="{ nonce value here }" />) which
60454
+ * will result in the same behavior.
60455
+ */
60456
+ export declare function setNonce(nonce: string): void;
60441
60457
  `;
60442
60458
  };
60443
60459
 
@@ -60507,6 +60523,15 @@ const generateCustomElementsTypesOutput$1 = async (config, compilerCtx, buildCtx
60507
60523
  ` */`,
60508
60524
  `export declare const setAssetPath: (path: string) => void;`,
60509
60525
  ``,
60526
+ `/**`,
60527
+ ` * Used to specify a nonce value that corresponds with an application's CSP.`,
60528
+ ` * When set, the nonce will be added to all dynamically created script and style tags at runtime.`,
60529
+ ` * Alternatively, the nonce value can be set on a meta tag in the DOM head`,
60530
+ ` * (<meta name="csp-nonce" content="{ nonce value here }" />) which`,
60531
+ ` * will result in the same behavior.`,
60532
+ ` */`,
60533
+ `export declare const setNonce: (nonce: string) => void`,
60534
+ ``,
60510
60535
  `export interface SetPlatformOptions {`,
60511
60536
  ` raf?: (c: FrameRequestCallback) => number;`,
60512
60537
  ` ael?: (el: EventTarget, eventName: string, listener: EventListenerOrEventListenerObject, options: boolean | AddEventListenerOptions) => void;`,
@@ -65082,8 +65107,9 @@ function generateBuildStats(config, buildCtx) {
65082
65107
  }
65083
65108
  catch (e) {
65084
65109
  const diagnostic = {
65085
- messageText: `Generate Build Stats Error: ` + e,
65086
65110
  level: `error`,
65111
+ lines: [],
65112
+ messageText: `Generate Build Stats Error: ` + e,
65087
65113
  type: `build`,
65088
65114
  };
65089
65115
  jsonData = {
@@ -66466,15 +66492,18 @@ const createConfigFlags = (init = {}) => {
66466
66492
  };
66467
66493
 
66468
66494
  const getConfig = (userConfig) => {
66469
- var _a, _b, _c, _d, _e;
66495
+ var _a, _b, _c, _d, _e, _f;
66470
66496
  const logger = (_a = userConfig.logger) !== null && _a !== void 0 ? _a : createLogger();
66497
+ const rootDir = (_b = userConfig.rootDir) !== null && _b !== void 0 ? _b : '/';
66471
66498
  const config = {
66472
66499
  ...userConfig,
66473
- flags: createConfigFlags((_b = userConfig.flags) !== null && _b !== void 0 ? _b : {}),
66500
+ flags: createConfigFlags((_c = userConfig.flags) !== null && _c !== void 0 ? _c : {}),
66501
+ hydratedFlag: (_d = userConfig.hydratedFlag) !== null && _d !== void 0 ? _d : null,
66474
66502
  logger,
66475
- outputTargets: (_c = userConfig.outputTargets) !== null && _c !== void 0 ? _c : [],
66476
- rootDir: (_d = userConfig.rootDir) !== null && _d !== void 0 ? _d : '/',
66477
- sys: (_e = userConfig.sys) !== null && _e !== void 0 ? _e : createSystem({ logger }),
66503
+ outputTargets: (_e = userConfig.outputTargets) !== null && _e !== void 0 ? _e : [],
66504
+ packageJsonFilePath: join(rootDir, 'package.json'),
66505
+ rootDir,
66506
+ sys: (_f = userConfig.sys) !== null && _f !== void 0 ? _f : createSystem({ logger }),
66478
66507
  testing: userConfig !== null && userConfig !== void 0 ? userConfig : {},
66479
66508
  };
66480
66509
  setPlatformPath(config.sys.platformPath);
@@ -68643,26 +68672,28 @@ const validateDevServer = (config, diagnostics) => {
68643
68672
  };
68644
68673
 
68645
68674
  /**
68646
- * Check the provided `.hydratedFlag` prop and return a properly-validated value.
68675
+ * Validate the `.hydratedFlag` property on the supplied config object and
68676
+ * return a properly-validated value.
68647
68677
  *
68648
68678
  * @param config the configuration we're examining
68649
68679
  * @returns a suitable value for the hydratedFlag property
68650
68680
  */
68651
68681
  const validateHydrated = (config) => {
68682
+ var _a;
68652
68683
  /**
68653
68684
  * If `config.hydratedFlag` is set to `null` that is an explicit signal that we
68654
68685
  * should _not_ create a default configuration when validating and should instead
68655
- * just return `undefined`. It may also have been set to `false`; this is an invalid
68686
+ * just return `null`. It may also have been set to `false`; this is an invalid
68656
68687
  * value as far as the type system is concerned, but users may ignore this.
68657
68688
  *
68658
68689
  * See {@link HydratedFlag} for more details.
68659
68690
  */
68660
68691
  if (config.hydratedFlag === null || config.hydratedFlag === false) {
68661
- return undefined;
68692
+ return null;
68662
68693
  }
68663
68694
  // Here we start building up a default config since `.hydratedFlag` wasn't set to
68664
68695
  // `null` on the provided config.
68665
- const hydratedFlag = { ...config.hydratedFlag };
68696
+ const hydratedFlag = { ...((_a = config.hydratedFlag) !== null && _a !== void 0 ? _a : {}) };
68666
68697
  if (!isString$1(hydratedFlag.name) || hydratedFlag.property === '') {
68667
68698
  hydratedFlag.name = `hydrated`;
68668
68699
  }
@@ -69035,13 +69066,16 @@ const validateConfig = (userConfig = {}, bootstrapConfig) => {
69035
69066
  const config = Object.assign({}, userConfig); // not positive it's json safe
69036
69067
  const diagnostics = [];
69037
69068
  const logger = bootstrapConfig.logger || config.logger || createLogger();
69069
+ const rootDir = typeof config.rootDir === 'string' ? config.rootDir : '/';
69038
69070
  const validatedConfig = {
69039
69071
  ...config,
69040
69072
  // flags _should_ be JSON safe
69041
69073
  flags: JSON.parse(JSON.stringify(config.flags || {})),
69074
+ hydratedFlag: validateHydrated(config),
69042
69075
  logger,
69043
69076
  outputTargets: (_a = config.outputTargets) !== null && _a !== void 0 ? _a : [],
69044
- rootDir: typeof config.rootDir === 'string' ? config.rootDir : '/',
69077
+ packageJsonFilePath: join(rootDir, 'package.json'),
69078
+ rootDir,
69045
69079
  sys: (_c = (_b = config.sys) !== null && _b !== void 0 ? _b : bootstrapConfig.sys) !== null && _c !== void 0 ? _c : createSystem({ logger }),
69046
69080
  testing: (_d = config.testing) !== null && _d !== void 0 ? _d : {},
69047
69081
  };
@@ -69120,8 +69154,6 @@ const validateConfig = (userConfig = {}, bootstrapConfig) => {
69120
69154
  validatedConfig.devServer = validateDevServer(validatedConfig, diagnostics);
69121
69155
  // testing
69122
69156
  validateTesting(validatedConfig, diagnostics);
69123
- // hydrate flag
69124
- validatedConfig.hydratedFlag = validateHydrated(validatedConfig);
69125
69157
  // bundles
69126
69158
  if (Array.isArray(validatedConfig.bundles)) {
69127
69159
  validatedConfig.bundles = sortBy(validatedConfig.bundles, (a) => a.components.length);
@@ -69978,7 +70010,7 @@ const getComponentPathContent = (componentGraph, outputTarget) => {
69978
70010
  const dependencies = [
69979
70011
  {
69980
70012
  name: "@stencil/core",
69981
- version: "3.0.0-beta.1",
70013
+ version: "3.0.0-rc.1",
69982
70014
  main: "compiler/stencil.js",
69983
70015
  resources: [
69984
70016
  "package.json",