@stencil/core 4.18.3 → 4.19.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 (47) hide show
  1. package/cli/index.cjs +43 -16
  2. package/cli/index.js +43 -16
  3. package/cli/package.json +1 -1
  4. package/compiler/package.json +1 -1
  5. package/compiler/stencil.js +175 -72
  6. package/dev-server/client/index.js +1 -1
  7. package/dev-server/client/package.json +1 -1
  8. package/dev-server/connector.html +3 -3
  9. package/dev-server/index.js +1 -1
  10. package/dev-server/package.json +1 -1
  11. package/dev-server/server-process.js +2 -2
  12. package/dev-server/ws.js +1 -1
  13. package/internal/app-data/package.json +1 -1
  14. package/internal/client/index.js +534 -507
  15. package/internal/client/package.json +3 -1
  16. package/internal/client/patch-browser.js +1 -1
  17. package/internal/hydrate/index.js +108 -50
  18. package/internal/hydrate/package.json +1 -1
  19. package/internal/hydrate/runner.d.ts +29 -11
  20. package/internal/hydrate/runner.js +239 -260
  21. package/internal/package.json +1 -1
  22. package/internal/stencil-private.d.ts +39 -14
  23. package/internal/stencil-public-compiler.d.ts +21 -0
  24. package/internal/stencil-public-runtime.d.ts +0 -2
  25. package/internal/testing/index.js +439 -407
  26. package/internal/testing/package.json +1 -1
  27. package/mock-doc/index.cjs +137 -131
  28. package/mock-doc/index.d.ts +18 -4
  29. package/mock-doc/index.js +137 -131
  30. package/mock-doc/package.json +1 -1
  31. package/package.json +34 -6
  32. package/screenshot/index.js +1 -1
  33. package/screenshot/package.json +1 -1
  34. package/screenshot/pixel-match.js +1 -1
  35. package/sys/node/index.js +10 -10
  36. package/sys/node/package.json +1 -1
  37. package/sys/node/worker.js +1 -1
  38. package/testing/index.js +95 -16
  39. package/testing/jest/jest-27-and-under/matchers/events.d.ts +4 -0
  40. package/testing/jest/jest-27-and-under/matchers/index.d.ts +2 -1
  41. package/testing/jest/jest-28/matchers/events.d.ts +4 -0
  42. package/testing/jest/jest-28/matchers/index.d.ts +2 -1
  43. package/testing/jest/jest-29/matchers/events.d.ts +4 -0
  44. package/testing/jest/jest-29/matchers/index.d.ts +2 -1
  45. package/testing/mocks.d.ts +9 -9
  46. package/testing/package.json +1 -1
  47. package/testing/puppeteer/puppeteer-declarations.d.ts +11 -0
@@ -1,5 +1,5 @@
1
1
  /*!
2
- Stencil Compiler v4.18.3 | MIT Licensed | https://stenciljs.com
2
+ Stencil Compiler v4.19.0 | MIT Licensed | https://stenciljs.com
3
3
  */
4
4
  "use strict";
5
5
  var __create = Object.create;
@@ -115662,18 +115662,18 @@ ${lanes.join("\n")}
115662
115662
  0
115663
115663
  /* Call */
115664
115664
  );
115665
- const isPromise2 = !!getAwaitedTypeOfPromise(type);
115666
- if (callSignatures.length === 0 && !isPromise2) {
115665
+ const isPromise = !!getAwaitedTypeOfPromise(type);
115666
+ if (callSignatures.length === 0 && !isPromise) {
115667
115667
  return;
115668
115668
  }
115669
115669
  const testedNode = isIdentifier(location) ? location : isPropertyAccessExpression(location) ? location.name : void 0;
115670
115670
  const testedSymbol = testedNode && getSymbolAtLocation(testedNode);
115671
- if (!testedSymbol && !isPromise2) {
115671
+ if (!testedSymbol && !isPromise) {
115672
115672
  return;
115673
115673
  }
115674
115674
  const isUsed = testedSymbol && isBinaryExpression(condExpr2.parent) && isSymbolUsedInBinaryExpressionChain(condExpr2.parent, testedSymbol) || testedSymbol && body2 && isSymbolUsedInConditionBody(condExpr2, body2, testedNode, testedSymbol);
115675
115675
  if (!isUsed) {
115676
- if (isPromise2) {
115676
+ if (isPromise) {
115677
115677
  errorAndMaybeSuggestAwait(
115678
115678
  location,
115679
115679
  /*maybeMissingAwait*/
@@ -231091,16 +231091,16 @@ ${e.message}`;
231091
231091
  var typescript_5_4_5_bundle_cache_min_default = ts;
231092
231092
 
231093
231093
  // src/version.ts
231094
- var buildId = "1716921701";
231095
- var minfyJsId = "terser5.31.0_7";
231094
+ var buildId = "1719433468";
231095
+ var minfyJsId = "terser5.31.1_7";
231096
231096
  var optimizeCssId = "autoprefixer10.4.19_postcss8.4.38_7";
231097
231097
  var parse5Version = "7.1.2";
231098
231098
  var rollupVersion = "2.56.3";
231099
231099
  var jqueryVersion = "4.0.0-pre";
231100
- var terserVersion = "5.31.0";
231100
+ var terserVersion = "5.31.1";
231101
231101
  var typescriptVersion = "5.4.5";
231102
- var vermoji = "\u{1F604}";
231103
- var version = "4.18.3";
231102
+ var vermoji = "\u{1F3C4}";
231103
+ var version = "4.19.0";
231104
231104
  var versions = {
231105
231105
  stencil: version,
231106
231106
  parse5: parse5Version,
@@ -231392,7 +231392,6 @@ var isNumber = (v) => typeof v === "number";
231392
231392
  var isObject = (val) => val != null && typeof val === "object" && Array.isArray(val) === false;
231393
231393
  var isString = (v) => typeof v === "string";
231394
231394
  var isIterable = (v) => isDefined(v) && isFunction(v[Symbol.iterator]);
231395
- var isPromise = (v) => !!v && (typeof v === "object" || typeof v === "function") && typeof v.then === "function";
231396
231395
 
231397
231396
  // src/utils/is-glob.ts
231398
231397
  var isGlob = (str) => {
@@ -237067,9 +237066,10 @@ function replace(options) {
237067
237066
  }
237068
237067
  var functionValues = mapToFunctions(replacements);
237069
237068
  var keys2 = Object.keys(functionValues).sort(longest).map(escape3);
237070
- var lookahead2 = preventAssignment ? "(?!\\s*(=[^=]|:[^:]))" : "";
237069
+ var lookbehind = preventAssignment ? "(?<!\\b(?:const|let|var)\\s*)" : "";
237070
+ var lookahead2 = preventAssignment ? "(?!\\s*=[^=])" : "";
237071
237071
  var pattern = new RegExp(
237072
- delimiters[0] + "(" + keys2.join("|") + ")" + delimiters[1] + lookahead2,
237072
+ "" + lookbehind + delimiters[0] + "(" + keys2.join("|") + ")" + delimiters[1] + lookahead2,
237073
237073
  "g"
237074
237074
  );
237075
237075
  return {
@@ -239883,7 +239883,7 @@ var SourceMapGenerator = class _SourceMapGenerator {
239883
239883
  }
239884
239884
  };
239885
239885
 
239886
- // scripts/build/terser-5_31_0-bundle-cache.min.js
239886
+ // scripts/build/terser-5_31_1-bundle-cache.min.js
239887
239887
  function characters(e) {
239888
239888
  return e.split("");
239889
239889
  }
@@ -242577,7 +242577,7 @@ def_transform(AST_Node, noop2), def_transform(AST_LabeledStatement, function(e,
242577
242577
  }
242578
242578
  function u(e2, t2) {
242579
242579
  e2.DEFMETHOD("to_mozilla_ast", function(e3) {
242580
- return this, n4 = t2(this, e3), i2 = this.start, o2 = this.end, i2 && o2 ? (null != i2.pos && null != o2.endpos && (n4.range = [i2.pos, o2.endpos]), i2.line && (n4.loc = { start: { line: i2.line, column: i2.col }, end: o2.endline ? { line: o2.endline, column: o2.endcol } : null }, i2.file && (n4.loc.source = i2.file)), n4) : n4;
242580
+ return n4 = t2(this, e3), i2 = this.start, o2 = this.end, i2 && o2 ? (null != i2.pos && null != o2.endpos && (n4.range = [i2.pos, o2.endpos]), i2.line && (n4.loc = { start: { line: i2.line, column: i2.col }, end: o2.endline ? { line: o2.endline, column: o2.endcol } : null }, i2.file && (n4.loc.source = i2.file)), n4) : n4;
242581
242581
  var n4, i2, o2;
242582
242582
  });
242583
242583
  }
@@ -243985,7 +243985,10 @@ function has_break_or_continue(e, t) {
243985
243985
  return t instanceof AST_LabeledStatement && i.push(t), i.push(e), e.body.walk(i), n3;
243986
243986
  }
243987
243987
  function maintain_this_binding(e, t, n3) {
243988
- return e instanceof AST_UnaryPrefix && "delete" == e.operator || e instanceof AST_Call && e.expression === t && (n3 instanceof AST_Chain || n3 instanceof AST_PropAccess || n3 instanceof AST_SymbolRef && "eval" == n3.name) ? make_sequence(t, [make_node(AST_Number, t, { value: 0 }), n3]) : n3;
243988
+ return requires_sequence_to_maintain_binding(e, t, n3) ? make_sequence(t, [make_node(AST_Number, t, { value: 0 }), n3]) : n3;
243989
+ }
243990
+ function requires_sequence_to_maintain_binding(e, t, n3) {
243991
+ return e instanceof AST_UnaryPrefix && "delete" == e.operator || e instanceof AST_Call && e.expression === t && (n3 instanceof AST_Chain || n3 instanceof AST_PropAccess || n3 instanceof AST_SymbolRef && "eval" == n3.name);
243989
243992
  }
243990
243993
  function is_func_expr(e) {
243991
243994
  return e instanceof AST_Arrow || e instanceof AST_Function;
@@ -244837,6 +244840,23 @@ def_eval(AST_PropAccess, function(e, t) {
244837
244840
  return t && make_sequence(this, t);
244838
244841
  });
244839
244842
  var r_keep_assign = /keep_assign/;
244843
+ function is_used_in_expression(e) {
244844
+ for (let t, n3, i = -1; t = e.parent(i), n3 = e.parent(i + 1); i++) {
244845
+ if (!(n3 instanceof AST_Sequence)) {
244846
+ if (n3 instanceof AST_Unary) {
244847
+ const e2 = n3.operator;
244848
+ if ("void" === e2) return false;
244849
+ if ("typeof" === e2 || "+" === e2 || "-" === e2 || "!" === e2 || "~" === e2) continue;
244850
+ }
244851
+ return true;
244852
+ }
244853
+ if (n3.expressions.indexOf(t) !== n3.expressions.length - 1) {
244854
+ const t2 = e.parent(i + 2);
244855
+ return !(n3.expressions.length > 2 || 1 === n3.expressions.length || !requires_sequence_to_maintain_binding(t2, n3, n3.expressions[1]));
244856
+ }
244857
+ }
244858
+ return true;
244859
+ }
244840
244860
  function def_reduce_vars(e, t) {
244841
244861
  e.DEFMETHOD("reduce_vars", t);
244842
244862
  }
@@ -244952,11 +244972,14 @@ AST_Scope.DEFMETHOD("drop_unused", function(e) {
244952
244972
  var f = new TreeTransformer(function(u2, c2, _2) {
244953
244973
  var p2 = f.parent();
244954
244974
  if (i) {
244955
- const e2 = o(u2);
244956
- if (e2 instanceof AST_SymbolRef) {
244957
- var d = e2.definition(), m = r.has(d.id);
244975
+ const t2 = o(u2);
244976
+ if (t2 instanceof AST_SymbolRef) {
244977
+ var d = t2.definition(), m = r.has(d.id);
244958
244978
  if (u2 instanceof AST_Assign) {
244959
- if (!m || a.has(d.id) && a.get(d.id) !== u2) return maintain_this_binding(p2, u2, u2.right.transform(f));
244979
+ if (!m || a.has(d.id) && a.get(d.id) !== u2) {
244980
+ const t3 = u2.right.transform(f);
244981
+ return m || t3.has_side_effects(e) || is_used_in_expression(f) ? maintain_this_binding(p2, u2, t3) : _2 ? MAP.skip : make_node(AST_Number, u2, { value: 0 });
244982
+ }
244960
244983
  } else if (!m) return _2 ? MAP.skip : make_node(AST_Number, u2, { value: 0 });
244961
244984
  }
244962
244985
  }
@@ -245025,6 +245048,13 @@ AST_Scope.DEFMETHOD("drop_unused", function(e) {
245025
245048
  return l = u2, c2(u2, this), l = e2, u2;
245026
245049
  }
245027
245050
  }
245051
+ }, function(e2, t2) {
245052
+ if (e2 instanceof AST_Sequence) switch (e2.expressions.length) {
245053
+ case 0:
245054
+ return t2 ? MAP.skip : make_node(AST_Number, e2, { value: 0 });
245055
+ case 1:
245056
+ return e2.expressions[0];
245057
+ }
245028
245058
  });
245029
245059
  function p(e2, n4) {
245030
245060
  var i2;
@@ -248158,7 +248188,8 @@ var getRollupOptions = (config, compilerCtx, buildCtx, bundleOpts) => {
248158
248188
  treeshake: getTreeshakeOption(config, bundleOpts),
248159
248189
  preserveEntrySignatures: (_c = bundleOpts.preserveEntrySignatures) != null ? _c : "strict",
248160
248190
  onwarn: createOnWarnFn(buildCtx.diagnostics),
248161
- cache: compilerCtx.rollupCache.get(bundleOpts.id)
248191
+ cache: compilerCtx.rollupCache.get(bundleOpts.id),
248192
+ external: config.rollupConfig.inputOptions.external
248162
248193
  };
248163
248194
  return rollupOptions;
248164
248195
  };
@@ -249751,7 +249782,7 @@ var getBuildFeatures = (cmps) => {
249751
249782
  member: cmps.some((c) => c.hasMember),
249752
249783
  method: cmps.some((c) => c.hasMethod),
249753
249784
  mode: cmps.some((c) => c.hasMode),
249754
- observeAttribute: cmps.some((c) => c.hasAttribute),
249785
+ observeAttribute: cmps.some((c) => c.hasAttribute || c.hasWatchCallback),
249755
249786
  prop: cmps.some((c) => c.hasProp),
249756
249787
  propBoolean: cmps.some((c) => c.hasPropBoolean),
249757
249788
  propNumber: cmps.some((c) => c.hasPropNumber),
@@ -250553,12 +250584,17 @@ var writeHydrateOutputs = (config, compilerCtx, buildCtx, outputTargets, rollupO
250553
250584
  var writeHydrateOutput = async (config, compilerCtx, buildCtx, outputTarget, rollupOutput) => {
250554
250585
  const hydratePackageName = await getHydratePackageName(config, compilerCtx);
250555
250586
  const hydrateAppDirPath = outputTarget.dir;
250587
+ if (!hydrateAppDirPath) {
250588
+ throw new Error(`outputTarget config missing the "dir" property`);
250589
+ }
250556
250590
  const hydrateCoreIndexPath = join(hydrateAppDirPath, "index.js");
250591
+ const hydrateCoreIndexPathESM = join(hydrateAppDirPath, "index.mjs");
250557
250592
  const hydrateCoreIndexDtsFilePath = join(hydrateAppDirPath, "index.d.ts");
250558
250593
  const pkgJsonPath = join(hydrateAppDirPath, "package.json");
250559
250594
  const pkgJsonCode = getHydratePackageJson(
250560
250595
  config,
250561
250596
  hydrateCoreIndexPath,
250597
+ hydrateCoreIndexPathESM,
250562
250598
  hydrateCoreIndexDtsFilePath,
250563
250599
  hydratePackageName
250564
250600
  );
@@ -250577,24 +250613,32 @@ var writeHydrateOutput = async (config, compilerCtx, buildCtx, outputTarget, rol
250577
250613
  })
250578
250614
  );
250579
250615
  };
250580
- var getHydratePackageJson = (config, hydrateAppFilePath, hydrateDtsFilePath, hydratePackageName) => {
250616
+ var getHydratePackageJson = (config, hydrateAppFilePathCJS, hydrateAppFilePathESM, hydrateDtsFilePath, hydratePackageName) => {
250581
250617
  const pkg = {
250582
250618
  name: hydratePackageName,
250583
250619
  description: `${config.namespace} component hydration app.`,
250584
- main: (0, import_path26.basename)(hydrateAppFilePath),
250585
- types: (0, import_path26.basename)(hydrateDtsFilePath)
250620
+ main: (0, import_path26.basename)(hydrateAppFilePathCJS),
250621
+ types: (0, import_path26.basename)(hydrateDtsFilePath),
250622
+ exports: {
250623
+ ".": {
250624
+ require: `./${(0, import_path26.basename)(hydrateAppFilePathCJS)}`,
250625
+ import: `./${(0, import_path26.basename)(hydrateAppFilePathESM)}`
250626
+ }
250627
+ }
250586
250628
  };
250587
250629
  return JSON.stringify(pkg, null, 2);
250588
250630
  };
250589
250631
  var getHydratePackageName = async (config, compilerCtx) => {
250632
+ const directoryName = (0, import_path26.basename)(config.rootDir);
250590
250633
  try {
250591
250634
  const rootPkgFilePath = join(config.rootDir, "package.json");
250592
250635
  const pkgStr = await compilerCtx.fs.readFile(rootPkgFilePath);
250593
250636
  const pkgData = JSON.parse(pkgStr);
250594
- return `${pkgData.name}/hydrate`;
250637
+ const scope = pkgData.name || directoryName;
250638
+ return `${scope}/hydrate`;
250595
250639
  } catch (e) {
250596
250640
  }
250597
- return `${config.fsNamespace}/hydrate`;
250641
+ return `${config.fsNamespace || directoryName}/hydrate`;
250598
250642
  };
250599
250643
  var copyHydrateRunnerDts = async (config, compilerCtx, hydrateAppDirPath) => {
250600
250644
  const packageDir = join(config.sys.getCompilerExecutingPath(), "..", "..");
@@ -250604,6 +250648,15 @@ var copyHydrateRunnerDts = async (config, compilerCtx, hydrateAppDirPath) => {
250604
250648
  };
250605
250649
 
250606
250650
  // src/compiler/output-targets/dist-hydrate-script/generate-hydrate-app.ts
250651
+ var buildHydrateAppFor = async (format, rollupBuild, config, compilerCtx, buildCtx, outputTargets) => {
250652
+ const file = format === "esm" ? "index.mjs" : "index.js";
250653
+ const rollupOutput = await rollupBuild.generate({
250654
+ banner: generatePreamble(config),
250655
+ format,
250656
+ file
250657
+ });
250658
+ await writeHydrateOutputs(config, compilerCtx, buildCtx, outputTargets, rollupOutput);
250659
+ };
250607
250660
  var generateHydrateApp = async (config, compilerCtx, buildCtx, outputTargets) => {
250608
250661
  try {
250609
250662
  const packageDir = join(config.sys.getCompilerExecutingPath(), "..", "..");
@@ -250611,6 +250664,7 @@ var generateHydrateApp = async (config, compilerCtx, buildCtx, outputTargets) =>
250611
250664
  const mockDoc = join(packageDir, "mock-doc", "index.js");
250612
250665
  const rollupOptions = {
250613
250666
  ...config.rollupConfig.inputOptions,
250667
+ external: ["stream"],
250614
250668
  input,
250615
250669
  inlineDynamicImports: true,
250616
250670
  plugins: [
@@ -250637,12 +250691,10 @@ var generateHydrateApp = async (config, compilerCtx, buildCtx, outputTargets) =>
250637
250691
  onwarn: createOnWarnFn(buildCtx.diagnostics)
250638
250692
  };
250639
250693
  const rollupAppBuild = await rollup(rollupOptions);
250640
- const rollupOutput = await rollupAppBuild.generate({
250641
- banner: generatePreamble(config),
250642
- format: "cjs",
250643
- file: "index.js"
250644
- });
250645
- await writeHydrateOutputs(config, compilerCtx, buildCtx, outputTargets, rollupOutput);
250694
+ await Promise.all([
250695
+ buildHydrateAppFor("cjs", rollupAppBuild, config, compilerCtx, buildCtx, outputTargets),
250696
+ buildHydrateAppFor("esm", rollupAppBuild, config, compilerCtx, buildCtx, outputTargets)
250697
+ ]);
250646
250698
  } catch (e) {
250647
250699
  if (!buildCtx.hasError) {
250648
250700
  loadRollupDiagnostics(config, compilerCtx, buildCtx, e);
@@ -252622,7 +252674,7 @@ var validateRollupConfig = (config) => {
252622
252674
  if (rollupConfig.inputOptions && isObject(rollupConfig.inputOptions)) {
252623
252675
  cleanRollupConfig = {
252624
252676
  ...cleanRollupConfig,
252625
- inputOptions: pluck(rollupConfig.inputOptions, ["context", "moduleContext", "treeshake"])
252677
+ inputOptions: pluck(rollupConfig.inputOptions, ["context", "moduleContext", "treeshake", "external"])
252626
252678
  };
252627
252679
  }
252628
252680
  if (rollupConfig.outputOptions && isObject(rollupConfig.outputOptions)) {
@@ -252849,6 +252901,7 @@ var validateConfig = (userConfig = {}, bootstrapConfig) => {
252849
252901
  devMode,
252850
252902
  extras: config.extras || {},
252851
252903
  flags,
252904
+ generateExportMaps: isBoolean(config.generateExportMaps) ? config.generateExportMaps : false,
252852
252905
  hashFileNames,
252853
252906
  hashedFileNameLength: (_c = config.hashedFileNameLength) != null ? _c : DEFAULT_HASHED_FILENAME_LENGTH,
252854
252907
  hydratedFlag: validateHydrated(config),
@@ -254171,6 +254224,9 @@ export interface CustomElementsDefineOptions {
254171
254224
  rel?: (el: EventTarget, eventName: string, listener: EventListenerOrEventListenerObject, options: boolean | AddEventListenerOptions) => void;
254172
254225
  }
254173
254226
  export declare function defineCustomElements(win?: Window, opts?: CustomElementsDefineOptions): void;
254227
+ /**
254228
+ * @deprecated
254229
+ */
254174
254230
  export declare function applyPolyfills(): Promise<void>;
254175
254231
 
254176
254232
  /**
@@ -254366,7 +254422,7 @@ var updateTypeName = (currentTypeName, typeAlias) => {
254366
254422
  return currentTypeName;
254367
254423
  }
254368
254424
  const endingStrChar = "(?!(\"|'|`))";
254369
- const typeNameRegex = new RegExp(`${typeAlias.localName}\\b${endingStrChar}`, "g");
254425
+ const typeNameRegex = new RegExp(`\\b${typeAlias.localName}\\b${endingStrChar}`, "g");
254370
254426
  return currentTypeName.replace(typeNameRegex, typeAlias.importName);
254371
254427
  };
254372
254428
  var copyStencilCoreDts = async (config, compilerCtx) => {
@@ -254661,6 +254717,9 @@ var updateImportReferenceFactory = (typeCounts, filePath, config) => {
254661
254717
  }
254662
254718
  const newTypeName = getIncrementTypeName(typeName);
254663
254719
  existingTypeImportData[importResolvedFile].push({
254720
+ // Since we create a unique ID for each type for documentation generation purposes, we can parse
254721
+ // that ID to get the original name for the export
254722
+ originalName: typeReference.id.split("::").pop(),
254664
254723
  localName: typeName,
254665
254724
  importName: newTypeName
254666
254725
  });
@@ -254716,10 +254775,10 @@ var generateComponentTypesFile = (config, buildCtx, areTypesInternal) => {
254716
254775
  importFilePath = normalizePath("./" + relative(config.srcDir, filePath)).replace(/\.(tsx|ts)$/, "");
254717
254776
  }
254718
254777
  return `{ ${typeData.sort(sortImportNames).map((td2) => {
254719
- if (td2.localName === td2.importName) {
254720
- return `${td2.importName}`;
254778
+ if (td2.originalName === td2.importName) {
254779
+ return `${td2.originalName}`;
254721
254780
  } else {
254722
- return `${td2.localName} as ${td2.importName}`;
254781
+ return `${td2.originalName} as ${td2.importName}`;
254723
254782
  }
254724
254783
  }).join(`, `)} } from "${importFilePath}";`;
254725
254784
  });
@@ -258120,10 +258179,11 @@ var runTsProgram = async (config, compilerCtx, buildCtx, tsBuilder) => {
258120
258179
  const typesOutputTarget = config.outputTargets.filter(isOutputTargetDistTypes);
258121
258180
  const emittedDts = [];
258122
258181
  const emitCallback = (emitFilePath, data2, _w, _e, tsSourceFiles) => {
258182
+ if (emitFilePath.includes("e2e.") || emitFilePath.includes("spec.") || emitFilePath.endsWith("e2e.d.ts") || emitFilePath.endsWith("spec.d.ts")) {
258183
+ return;
258184
+ }
258123
258185
  if (emitFilePath.endsWith(".js") || emitFilePath.endsWith("js.map")) {
258124
258186
  updateModule(config, compilerCtx, buildCtx, tsSourceFiles[0], data2, emitFilePath, tsTypeChecker, null);
258125
- } else if (emitFilePath.endsWith(".e2e.d.ts") || emitFilePath.endsWith(".spec.d.ts") || emitFilePath === "e2e.d.ts" || emitFilePath === "spec.d.ts") {
258126
- return;
258127
258187
  } else if (emitFilePath.endsWith(".d.ts")) {
258128
258188
  const srcDtsPath = normalizePath(tsSourceFiles[0].fileName);
258129
258189
  const relativeEmitFilepath = getRelativeDts(config, srcDtsPath, emitFilePath);
@@ -258761,19 +258821,25 @@ var packageJsonWarn = (config, compilerCtx, buildCtx, msg, jsonField) => {
258761
258821
  var PRIMARY_PACKAGE_TARGET_CONFIGS = {
258762
258822
  dist: {
258763
258823
  getModulePath: (rootDir, outputTargetDir) => normalizePath(relative(rootDir, join(outputTargetDir, "index.js"))),
258764
- getTypesPath: (rootDir, outputTargetConfig) => normalizePath(relative(rootDir, join(outputTargetConfig.typesDir, "index.d.ts")))
258824
+ getTypesPath: (rootDir, outputTargetConfig) => normalizePath(relative(rootDir, join(outputTargetConfig.typesDir, "index.d.ts"))),
258825
+ getMainPath: (rootDir, outputTargetDir) => normalizePath(relative(rootDir, join(outputTargetDir, "index.cjs.js")))
258765
258826
  },
258766
258827
  "dist-collection": {
258767
- getModulePath: (rootDir, outputTargetDir) => normalizePath(relative(rootDir, join(outputTargetDir, "index.js")))
258828
+ getModulePath: (rootDir, outputTargetDir) => normalizePath(relative(rootDir, join(outputTargetDir, "index.js"))),
258829
+ getTypesPath: () => null,
258830
+ getMainPath: () => null
258768
258831
  },
258769
258832
  "dist-custom-elements": {
258770
258833
  getModulePath: (rootDir, outputTargetDir) => normalizePath(relative(rootDir, join(outputTargetDir, "index.js"))),
258771
258834
  getTypesPath: (rootDir, outputTargetConfig) => {
258772
258835
  return outputTargetConfig.generateTypeDeclarations ? normalizePath(relative(rootDir, join(outputTargetConfig.dir, "index.d.ts"))) : null;
258773
- }
258836
+ },
258837
+ getMainPath: () => null
258774
258838
  },
258775
258839
  "dist-types": {
258776
- getTypesPath: (rootDir, outputTargetConfig) => normalizePath(relative(rootDir, join(outputTargetConfig.typesDir, "index.d.ts")))
258840
+ getModulePath: () => null,
258841
+ getTypesPath: (rootDir, outputTargetConfig) => normalizePath(relative(rootDir, join(outputTargetConfig.typesDir, "index.d.ts"))),
258842
+ getMainPath: () => null
258777
258843
  }
258778
258844
  };
258779
258845
  var validatePrimaryPackageOutputTarget = (config, compilerCtx, buildCtx) => {
@@ -258963,6 +259029,58 @@ var validateBuildFiles = (config, compilerCtx, buildCtx) => {
258963
259029
  ]);
258964
259030
  };
258965
259031
 
259032
+ // src/compiler/build/write-export-maps.ts
259033
+ var import_child_process = require("child_process");
259034
+ var writeExportMaps = (config, buildCtx) => {
259035
+ var _a;
259036
+ const eligiblePrimaryTargets = config.outputTargets.filter(isEligiblePrimaryPackageOutputTarget);
259037
+ if (eligiblePrimaryTargets.length > 0) {
259038
+ const primaryTarget = (_a = eligiblePrimaryTargets.find((o) => o.isPrimaryPackageOutputTarget)) != null ? _a : eligiblePrimaryTargets[0];
259039
+ const outputTargetConfig = PRIMARY_PACKAGE_TARGET_CONFIGS[primaryTarget.type];
259040
+ if (outputTargetConfig.getModulePath) {
259041
+ const importPath = outputTargetConfig.getModulePath(config.rootDir, primaryTarget.dir);
259042
+ if (importPath) {
259043
+ (0, import_child_process.execSync)(`npm pkg set "exports[.][import]"="${importPath}"`);
259044
+ }
259045
+ }
259046
+ if (outputTargetConfig.getMainPath) {
259047
+ const requirePath = outputTargetConfig.getMainPath(config.rootDir, primaryTarget.dir);
259048
+ if (requirePath) {
259049
+ (0, import_child_process.execSync)(`npm pkg set "exports[.][require]"="${requirePath}"`);
259050
+ }
259051
+ }
259052
+ if (outputTargetConfig.getTypesPath) {
259053
+ const typesPath = outputTargetConfig.getTypesPath(config.rootDir, primaryTarget);
259054
+ if (typesPath) {
259055
+ (0, import_child_process.execSync)(`npm pkg set "exports[.][types]"="${typesPath}"`);
259056
+ }
259057
+ }
259058
+ }
259059
+ const distLazyLoader = config.outputTargets.find(isOutputTargetDistLazyLoader);
259060
+ if (distLazyLoader != null) {
259061
+ let outDir = relative(config.rootDir, distLazyLoader.dir);
259062
+ if (!outDir.startsWith(".")) {
259063
+ outDir = "./" + outDir;
259064
+ }
259065
+ (0, import_child_process.execSync)(`npm pkg set "exports[./loader][import]"="${outDir}/index.js"`);
259066
+ (0, import_child_process.execSync)(`npm pkg set "exports[./loader][require]"="${outDir}/index.cjs"`);
259067
+ (0, import_child_process.execSync)(`npm pkg set "exports[./loader][types]"="${outDir}/index.d.ts"`);
259068
+ }
259069
+ const distCustomElements = config.outputTargets.find(isOutputTargetDistCustomElements);
259070
+ if (distCustomElements != null) {
259071
+ let outDir = relative(config.rootDir, distCustomElements.dir);
259072
+ if (!outDir.startsWith(".")) {
259073
+ outDir = "./" + outDir;
259074
+ }
259075
+ buildCtx.components.forEach((cmp) => {
259076
+ (0, import_child_process.execSync)(`npm pkg set "exports[./${cmp.tagName}][import]"="${outDir}/${cmp.tagName}.js"`);
259077
+ if (distCustomElements.generateTypeDeclarations) {
259078
+ (0, import_child_process.execSync)(`npm pkg set "exports[./${cmp.tagName}][types]"="${outDir}/${cmp.tagName}.d.ts"`);
259079
+ }
259080
+ });
259081
+ }
259082
+ };
259083
+
258966
259084
  // src/compiler/build/write-build.ts
258967
259085
  var writeBuild = async (config, compilerCtx, buildCtx) => {
258968
259086
  const timeSpan = buildCtx.createTimeSpan(`writeBuildFiles started`, true);
@@ -258977,6 +259095,9 @@ var writeBuild = async (config, compilerCtx, buildCtx) => {
258977
259095
  await compilerCtx.cache.commit();
258978
259096
  buildCtx.debug(`in-memory-fs: ${compilerCtx.fs.getMemoryStats()}`);
258979
259097
  buildCtx.debug(`cache: ${compilerCtx.cache.getMemoryStats()}`);
259098
+ if (config.generateExportMaps) {
259099
+ writeExportMaps(config, buildCtx);
259100
+ }
258980
259101
  await outputServiceWorkers(config, buildCtx);
258981
259102
  await validateBuildFiles(config, compilerCtx, buildCtx);
258982
259103
  } catch (e) {
@@ -261855,10 +261976,7 @@ var prerenderWorker = async (sys, prerenderRequest) => {
261855
261976
  }
261856
261977
  if (typeof prerenderConfig.beforeHydrate === "function") {
261857
261978
  try {
261858
- const rtn = prerenderConfig.beforeHydrate(doc, url);
261859
- if (isPromise(rtn)) {
261860
- await rtn;
261861
- }
261979
+ await prerenderConfig.beforeHydrate(doc, url);
261862
261980
  } catch (e) {
261863
261981
  catchError(results.diagnostics, e);
261864
261982
  }
@@ -261883,7 +262001,7 @@ var prerenderWorker = async (sys, prerenderRequest) => {
261883
262001
  excludeStaticComponents(doc, hydrateOpts, hydrateResults);
261884
262002
  }
261885
262003
  if (hydrateOpts.addModulePreloads) {
261886
- if (!prerenderRequest.isDebug) {
262004
+ if (!prerenderRequest.isDebug && componentGraph) {
261887
262005
  addModulePreloads(doc, hydrateOpts, hydrateResults, componentGraph);
261888
262006
  }
261889
262007
  } else {
@@ -261920,10 +262038,7 @@ var prerenderWorker = async (sys, prerenderRequest) => {
261920
262038
  }
261921
262039
  if (typeof prerenderConfig.afterHydrate === "function") {
261922
262040
  try {
261923
- const rtn = prerenderConfig.afterHydrate(doc, url, results);
261924
- if (isPromise(rtn)) {
261925
- await rtn;
261926
- }
262041
+ await prerenderConfig.afterHydrate(doc, url, results);
261927
262042
  } catch (e) {
261928
262043
  catchError(results.diagnostics, e);
261929
262044
  }
@@ -261935,7 +262050,7 @@ var prerenderWorker = async (sys, prerenderRequest) => {
261935
262050
  }
261936
262051
  return results;
261937
262052
  }
261938
- const html = hydrateApp.serializeDocumentToString(doc, hydrateOpts);
262053
+ const html = await hydrateApp.serializeDocumentToString(doc, hydrateOpts);
261939
262054
  prerenderEnsureDir(sys, prerenderCtx2, results.filePath);
261940
262055
  const writePromise = sys.writeFile(results.filePath, html);
261941
262056
  if (Array.isArray(hydrateResults.staticData) && hydrateResults.staticData.length > 0) {
@@ -262635,17 +262750,13 @@ var prerenderUrl = async (results, manager, url) => {
262635
262750
  var import_mock_doc3 = require("../mock-doc/index.cjs");
262636
262751
  var generateTemplateHtml = async (config, prerenderConfig, diagnostics, isDebug, srcIndexHtmlPath, outputTarget, hydrateOpts, manager) => {
262637
262752
  try {
262638
- if (!isString(srcIndexHtmlPath)) {
262753
+ if (!isString(srcIndexHtmlPath) && outputTarget.indexHtml) {
262639
262754
  srcIndexHtmlPath = outputTarget.indexHtml;
262640
262755
  }
262641
262756
  let templateHtml;
262642
262757
  if (isFunction(prerenderConfig.loadTemplate)) {
262643
262758
  const loadTemplateResult = prerenderConfig.loadTemplate(srcIndexHtmlPath);
262644
- if (isPromise(loadTemplateResult)) {
262645
- templateHtml = await loadTemplateResult;
262646
- } else {
262647
- templateHtml = loadTemplateResult;
262648
- }
262759
+ templateHtml = await loadTemplateResult;
262649
262760
  } else {
262650
262761
  templateHtml = await config.sys.readFile(srcIndexHtmlPath);
262651
262762
  }
@@ -262658,7 +262769,7 @@ var generateTemplateHtml = async (config, prerenderConfig, diagnostics, isDebug,
262658
262769
  staticSite = !hasStencilScript(doc);
262659
262770
  }
262660
262771
  doc.documentElement.classList.add("hydrated");
262661
- if (hydrateOpts.inlineExternalStyleSheets && !isDebug) {
262772
+ if (hydrateOpts.inlineExternalStyleSheets && !isDebug && outputTarget.appDir) {
262662
262773
  try {
262663
262774
  await inlineExternalStyleSheets(config.sys, outputTarget.appDir, doc);
262664
262775
  } catch (e) {
@@ -262672,7 +262783,7 @@ var generateTemplateHtml = async (config, prerenderConfig, diagnostics, isDebug,
262672
262783
  catchError(diagnostics, e);
262673
262784
  }
262674
262785
  }
262675
- if (hydrateOpts.minifyStyleElements && !isDebug) {
262786
+ if (hydrateOpts.minifyStyleElements && !isDebug && outputTarget.baseUrl) {
262676
262787
  try {
262677
262788
  const baseUrl = new URL(outputTarget.baseUrl, manager.devServerHostUrl);
262678
262789
  await minifyStyleElements(config.sys, outputTarget.appDir, doc, baseUrl, true);
@@ -262682,20 +262793,12 @@ var generateTemplateHtml = async (config, prerenderConfig, diagnostics, isDebug,
262682
262793
  }
262683
262794
  if (isFunction(prerenderConfig.beforeSerializeTemplate)) {
262684
262795
  const beforeSerializeResults = prerenderConfig.beforeSerializeTemplate(doc);
262685
- if (isPromise(beforeSerializeResults)) {
262686
- doc = await beforeSerializeResults;
262687
- } else {
262688
- doc = beforeSerializeResults;
262689
- }
262796
+ doc = await beforeSerializeResults;
262690
262797
  }
262691
262798
  let html = (0, import_mock_doc3.serializeNodeToHtml)(doc);
262692
262799
  if (isFunction(prerenderConfig.afterSerializeTemplate)) {
262693
262800
  const afterSerializeResults = prerenderConfig.afterSerializeTemplate(html);
262694
- if (isPromise(afterSerializeResults)) {
262695
- html = await afterSerializeResults;
262696
- } else {
262697
- html = afterSerializeResults;
262698
- }
262801
+ html = await afterSerializeResults;
262699
262802
  }
262700
262803
  return {
262701
262804
  html,
@@ -1,5 +1,5 @@
1
1
  /*!
2
- Stencil Dev Server Client v4.18.3 | MIT Licensed | https://stenciljs.com
2
+ Stencil Dev Server Client v4.19.0 | MIT Licensed | https://stenciljs.com
3
3
  */
4
4
 
5
5
  // src/dev-server/client/app-error.css
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stencil/core/dev-server/client",
3
- "version": "4.18.3",
3
+ "version": "4.19.0",
4
4
  "description": "Stencil Dev Server Client.",
5
5
  "main": "./index.js",
6
6
  "types": "./index.d.ts",