@stencil/core 2.17.3 → 2.17.4

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.
package/cli/index.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- Stencil CLI (CommonJS) v2.17.3 | MIT Licensed | https://stenciljs.com
2
+ Stencil CLI (CommonJS) v2.17.4 | MIT Licensed | https://stenciljs.com
3
3
  */
4
4
  'use strict';
5
5
 
@@ -829,7 +829,7 @@ LOG_LEVELS.includes(maybeLogLevel);
829
829
  const dependencies = [
830
830
  {
831
831
  name: "@stencil/core",
832
- version: "2.17.3",
832
+ version: "2.17.4",
833
833
  main: "compiler/stencil.js",
834
834
  resources: [
835
835
  "package.json",
@@ -937,6 +937,11 @@ const dependencies = [
937
937
  }
938
938
  ];
939
939
 
940
+ /**
941
+ * Attempt to find a Stencil configuration file on the file system
942
+ * @param opts the options needed to find the configuration file
943
+ * @returns the results of attempting to find a configuration file on disk
944
+ */
940
945
  const findConfig = async (opts) => {
941
946
  const sys = opts.sys;
942
947
  const cwd = sys.getCurrentDirectory();
@@ -948,7 +953,7 @@ const findConfig = async (opts) => {
948
953
  let configPath = opts.configPath;
949
954
  if (isString(configPath)) {
950
955
  if (!sys.platformPath.isAbsolute(configPath)) {
951
- // passed in a custom stencil config location
956
+ // passed in a custom stencil config location,
952
957
  // but it's relative, so prefix the cwd
953
958
  configPath = normalizePath(sys.platformPath.join(cwd, configPath));
954
959
  }
@@ -2313,14 +2318,15 @@ const run = async (init) => {
2313
2318
  * @public
2314
2319
  */
2315
2320
  const runTask = async (coreCompiler, config, task, sys) => {
2316
- var _a, _b, _c;
2321
+ var _a, _b, _c, _d, _e;
2317
2322
  const logger = (_a = config.logger) !== null && _a !== void 0 ? _a : createLogger();
2318
2323
  const strictConfig = {
2319
2324
  ...config,
2320
2325
  flags: createConfigFlags((_b = config.flags) !== null && _b !== void 0 ? _b : { task }),
2321
2326
  logger,
2322
2327
  outputTargets: (_c = config.outputTargets) !== null && _c !== void 0 ? _c : [],
2323
- sys: sys !== null && sys !== void 0 ? sys : coreCompiler.createSystem({ logger }),
2328
+ sys: (_d = sys !== null && sys !== void 0 ? sys : config.sys) !== null && _d !== void 0 ? _d : coreCompiler.createSystem({ logger }),
2329
+ testing: (_e = config.testing) !== null && _e !== void 0 ? _e : {},
2324
2330
  };
2325
2331
  switch (task) {
2326
2332
  case 'build':
package/cli/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- Stencil CLI v2.17.3 | MIT Licensed | https://stenciljs.com
2
+ Stencil CLI v2.17.4 | MIT Licensed | https://stenciljs.com
3
3
  */
4
4
  /**
5
5
  * This sets the log level hierarchy for our terminal logger, ranging from
@@ -805,7 +805,7 @@ LOG_LEVELS.includes(maybeLogLevel);
805
805
  const dependencies = [
806
806
  {
807
807
  name: "@stencil/core",
808
- version: "2.17.3",
808
+ version: "2.17.4",
809
809
  main: "compiler/stencil.js",
810
810
  resources: [
811
811
  "package.json",
@@ -913,6 +913,11 @@ const dependencies = [
913
913
  }
914
914
  ];
915
915
 
916
+ /**
917
+ * Attempt to find a Stencil configuration file on the file system
918
+ * @param opts the options needed to find the configuration file
919
+ * @returns the results of attempting to find a configuration file on disk
920
+ */
916
921
  const findConfig = async (opts) => {
917
922
  const sys = opts.sys;
918
923
  const cwd = sys.getCurrentDirectory();
@@ -924,7 +929,7 @@ const findConfig = async (opts) => {
924
929
  let configPath = opts.configPath;
925
930
  if (isString(configPath)) {
926
931
  if (!sys.platformPath.isAbsolute(configPath)) {
927
- // passed in a custom stencil config location
932
+ // passed in a custom stencil config location,
928
933
  // but it's relative, so prefix the cwd
929
934
  configPath = normalizePath(sys.platformPath.join(cwd, configPath));
930
935
  }
@@ -2289,14 +2294,15 @@ const run = async (init) => {
2289
2294
  * @public
2290
2295
  */
2291
2296
  const runTask = async (coreCompiler, config, task, sys) => {
2292
- var _a, _b, _c;
2297
+ var _a, _b, _c, _d, _e;
2293
2298
  const logger = (_a = config.logger) !== null && _a !== void 0 ? _a : createLogger();
2294
2299
  const strictConfig = {
2295
2300
  ...config,
2296
2301
  flags: createConfigFlags((_b = config.flags) !== null && _b !== void 0 ? _b : { task }),
2297
2302
  logger,
2298
2303
  outputTargets: (_c = config.outputTargets) !== null && _c !== void 0 ? _c : [],
2299
- sys: sys !== null && sys !== void 0 ? sys : coreCompiler.createSystem({ logger }),
2304
+ sys: (_d = sys !== null && sys !== void 0 ? sys : config.sys) !== null && _d !== void 0 ? _d : coreCompiler.createSystem({ logger }),
2305
+ testing: (_e = config.testing) !== null && _e !== void 0 ? _e : {},
2300
2306
  };
2301
2307
  switch (task) {
2302
2308
  case 'build':
package/cli/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stencil/core/cli",
3
- "version": "2.17.3",
3
+ "version": "2.17.4",
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": "2.17.3",
3
+ "version": "2.17.4",
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 v2.17.3 | MIT Licensed | https://stenciljs.com
2
+ Stencil Compiler v2.17.4 | MIT Licensed | https://stenciljs.com
3
3
  */
4
4
  (function(exports) {
5
5
  'use strict';
@@ -4065,7 +4065,7 @@ const createCustomResolverAsync = (sys, inMemoryFs, exts) => {
4065
4065
  };
4066
4066
  };
4067
4067
 
4068
- const buildId = '20220802224219';
4068
+ const buildId = '20220822163920';
4069
4069
  const minfyJsId = 'terser5.6.1_7';
4070
4070
  const optimizeCssId = 'autoprefixer10.2.5_postcss8.2.13_7';
4071
4071
  const parse5Version = '6.0.1';
@@ -4073,8 +4073,8 @@ const rollupVersion = '2.42.3';
4073
4073
  const sizzleVersion = '2.42.3';
4074
4074
  const terserVersion = '5.6.1';
4075
4075
  const typescriptVersion = '4.5.4';
4076
- const vermoji = '🌭';
4077
- const version$3 = '2.17.3';
4076
+ const vermoji = '🐞';
4077
+ const version$3 = '2.17.4';
4078
4078
  const versions = {
4079
4079
  stencil: version$3,
4080
4080
  parse5: parse5Version,
@@ -11522,6 +11522,20 @@ const scopeCss = (cssText, scopeId, commentOriginalSelector) => {
11522
11522
  return cssText;
11523
11523
  };
11524
11524
 
11525
+ /**
11526
+ * Serialize data about a style import to an annotated path, where
11527
+ * the filename has a URL queryparams style string appended to it.
11528
+ * This could look like:
11529
+ *
11530
+ * ```
11531
+ * './some-file.CSS?tag=my-tag&mode=ios&encapsulation=scoped');
11532
+ * ```
11533
+ *
11534
+ * @param data import data to be serialized
11535
+ * @param styleImportData an argument which controls whether the import data
11536
+ * will be added to the path (formatted as queryparams)
11537
+ * @returns a formatted string
11538
+ */
11525
11539
  const serializeImportPath = (data, styleImportData) => {
11526
11540
  let p = data.importeePath;
11527
11541
  if (isString$1(p)) {
@@ -11552,6 +11566,13 @@ const serializeImportPath = (data, styleImportData) => {
11552
11566
  }
11553
11567
  return p;
11554
11568
  };
11569
+ /**
11570
+ * Parse import paths (filepaths possibly annotated w/ component metadata,
11571
+ * formatted as URL queryparams) into a structured format.
11572
+ *
11573
+ * @param importPath an annotated import path to examine
11574
+ * @returns formatted information about the import
11575
+ */
11555
11576
  const parseImportPath = (importPath) => {
11556
11577
  const parsedPath = {
11557
11578
  importPath,
@@ -41367,29 +41388,73 @@ const formatUrl = (config, pluginCtx, code, filePath, ext) => {
41367
41388
  return `const ${varName} = 'data:${mime};base64,${base64}';export default ${varName};`;
41368
41389
  };
41369
41390
 
41391
+ /**
41392
+ * A Rollup plugin which bundles up some transformation of CSS imports as well
41393
+ * as writing some files to disk for the `DIST_COLLECTION` output target.
41394
+ *
41395
+ * @param config a user-supplied configuration
41396
+ * @param compilerCtx the current compiler context
41397
+ * @param buildCtx the current build context
41398
+ * @param bundleOpts bundle options for Rollup
41399
+ * @returns a Rollup plugin which carries out the necessary work
41400
+ */
41370
41401
  const extTransformsPlugin = (config, compilerCtx, buildCtx, bundleOpts) => {
41371
41402
  return {
41372
41403
  name: 'extTransformsPlugin',
41404
+ /**
41405
+ * A custom function targeting the `transform` build hook in Rollup. See here for details:
41406
+ * https://rollupjs.org/guide/en/#transform
41407
+ *
41408
+ * Here we are ignoring the first argument (which contains the module's source code) and
41409
+ * only looking at the `id` argument. We use that `id` to get information about the module
41410
+ * in question from disk ourselves so that we can then do some transformations on it.
41411
+ *
41412
+ * @param _ an unused parameter (normally the code for a given module)
41413
+ * @param id the id of a module
41414
+ * @returns metadata for Rollup or null if no transformation should be done
41415
+ */
41373
41416
  async transform(_, id) {
41417
+ var _a, _b;
41374
41418
  if (/\0/.test(id)) {
41375
41419
  return null;
41376
41420
  }
41421
+ // The `id` here was possibly previously updated using
41422
+ // `serializeImportPath` to annotate the filepath with various metadata
41423
+ // serialized to query-params. If that was done for this particular `id`
41424
+ // then the `data` prop will not be null.
41377
41425
  const { data } = parseImportPath(id);
41378
41426
  if (data != null) {
41379
- let cmp;
41427
+ let cmp = undefined;
41380
41428
  const filePath = normalizeFsPath(id);
41381
41429
  const code = await compilerCtx.fs.readFile(filePath);
41382
41430
  if (typeof code !== 'string') {
41383
41431
  return null;
41384
41432
  }
41385
41433
  const pluginTransforms = await runPluginTransformsEsmImports(config, compilerCtx, buildCtx, code, filePath);
41386
- const commentOriginalSelector = bundleOpts.platform === 'hydrate' && data.encapsulation === 'shadow';
41434
+ // We need to check whether the current build is a dev-mode watch build w/ HMR enabled in
41435
+ // order to know how we'll want to set `commentOriginalSelector` (below). If we are doing
41436
+ // a hydrate build we need to set this to `true` because commenting-out selectors is what
41437
+ // gives us support for scoped CSS w/ hydrated components (we don't support shadow DOM and
41438
+ // styling via that route for them). However, we don't want to comment selectors in dev
41439
+ // mode when using HMR in the browser, since there we _do_ support putting stylesheets into
41440
+ // the shadow DOM and commenting out e.g. the `:host` selector in those stylesheets will
41441
+ // break components' CSS when an HMR update is sent to the browser.
41442
+ //
41443
+ // See https://github.com/ionic-team/stencil/issues/3461 for details
41444
+ const isDevWatchHMRBuild = config.flags.watch &&
41445
+ config.flags.dev &&
41446
+ config.flags.serve &&
41447
+ ((_b = (_a = config.devServer) === null || _a === void 0 ? void 0 : _a.reloadStrategy) !== null && _b !== void 0 ? _b : null) === 'hmr';
41448
+ const commentOriginalSelector = bundleOpts.platform === 'hydrate' && data.encapsulation === 'shadow' && !isDevWatchHMRBuild;
41387
41449
  if (data.tag) {
41388
41450
  cmp = buildCtx.components.find((c) => c.tagName === data.tag);
41389
41451
  const moduleFile = cmp && compilerCtx.moduleMap.get(cmp.sourceFilePath);
41390
41452
  if (moduleFile) {
41391
41453
  const collectionDirs = config.outputTargets.filter(isOutputTargetDistCollection);
41392
41454
  const relPath = relative$1(config.srcDir, pluginTransforms.id);
41455
+ // If we found a `moduleFile` in the module map above then we
41456
+ // should write the transformed CSS file (found in the return value
41457
+ // of `runPluginTransformsEsmImports`, above) to disk.
41393
41458
  await Promise.all(collectionDirs.map(async (outputTarget) => {
41394
41459
  const collectionPath = join(outputTarget.collectionDir, relPath);
41395
41460
  await compilerCtx.fs.writeFile(collectionPath, pluginTransforms.code);
@@ -57185,13 +57250,13 @@ const generateReadmeDocs = async (config, compilerCtx, docsData, outputTargets)
57185
57250
  }
57186
57251
  const strictCheck = readmeOutputTargets.some((o) => o.strict);
57187
57252
  if (strictCheck) {
57188
- strickCheckDocs(config, docsData);
57253
+ strictCheckDocs(config, docsData);
57189
57254
  }
57190
57255
  await Promise.all(docsData.components.map((cmpData) => {
57191
57256
  return generateReadme(config, compilerCtx, readmeOutputTargets, cmpData, docsData.components);
57192
57257
  }));
57193
57258
  };
57194
- const strickCheckDocs = (config, docsData) => {
57259
+ const strictCheckDocs = (config, docsData) => {
57195
57260
  docsData.components.forEach((component) => {
57196
57261
  component.props.forEach((prop) => {
57197
57262
  if (!prop.docs && prop.deprecation === undefined) {
@@ -64679,6 +64744,7 @@ const getConfig = (userConfig) => {
64679
64744
  logger,
64680
64745
  outputTargets: (_c = userConfig.outputTargets) !== null && _c !== void 0 ? _c : [],
64681
64746
  sys: (_d = userConfig.sys) !== null && _d !== void 0 ? _d : createSystem({ logger }),
64747
+ testing: userConfig !== null && userConfig !== void 0 ? userConfig : {},
64682
64748
  };
64683
64749
  setPlatformPath(config.sys.platformPath);
64684
64750
  if (config.flags.debug || config.flags.verbose) {
@@ -65385,7 +65451,7 @@ const getComponentPathContent = (componentGraph, outputTarget) => {
65385
65451
  const dependencies = [
65386
65452
  {
65387
65453
  name: "@stencil/core",
65388
- version: "2.17.3",
65454
+ version: "2.17.4",
65389
65455
  main: "compiler/stencil.js",
65390
65456
  resources: [
65391
65457
  "package.json",
@@ -65798,7 +65864,7 @@ const validateHydrated = (config) => {
65798
65864
  * Validate and return DIST_COLLECTION output targets, ensuring that the `dir`
65799
65865
  * property is set on them.
65800
65866
  *
65801
- * @param config the user-supplied configuration object
65867
+ * @param config a validated configuration object
65802
65868
  * @param userOutputs an array of output targets
65803
65869
  * @returns an array of validated DIST_COLLECTION output targets
65804
65870
  */
@@ -66107,20 +66173,20 @@ const validateVScodeDocsOutputTarget = (diagnostics, outputTarget) => {
66107
66173
  return outputTarget;
66108
66174
  };
66109
66175
 
66110
- const validateAngular = (userConfig, userOutputs) => {
66176
+ const validateAngular = (config, userOutputs) => {
66111
66177
  const angularOutputTargets = userOutputs.filter(isOutputTargetAngular);
66112
66178
  return angularOutputTargets.map((outputTarget) => {
66113
66179
  let directivesProxyFile = outputTarget.directivesProxyFile;
66114
66180
  if (directivesProxyFile && !isAbsolute$1(directivesProxyFile)) {
66115
- directivesProxyFile = join(userConfig.rootDir, directivesProxyFile);
66181
+ directivesProxyFile = join(config.rootDir, directivesProxyFile);
66116
66182
  }
66117
66183
  let directivesArrayFile = outputTarget.directivesArrayFile;
66118
66184
  if (directivesArrayFile && !isAbsolute$1(directivesArrayFile)) {
66119
- directivesArrayFile = join(userConfig.rootDir, directivesArrayFile);
66185
+ directivesArrayFile = join(config.rootDir, directivesArrayFile);
66120
66186
  }
66121
66187
  let directivesUtilsFile = outputTarget.directivesUtilsFile;
66122
66188
  if (directivesUtilsFile && !isAbsolute$1(directivesUtilsFile)) {
66123
- directivesUtilsFile = join(userConfig.rootDir, directivesUtilsFile);
66189
+ directivesUtilsFile = join(config.rootDir, directivesUtilsFile);
66124
66190
  }
66125
66191
  return {
66126
66192
  type: 'angular',
@@ -66738,7 +66804,7 @@ const validateWorkers = (config) => {
66738
66804
  * @returns an object with config and diagnostics props
66739
66805
  */
66740
66806
  const validateConfig = (userConfig = {}, bootstrapConfig) => {
66741
- var _a, _b, _c;
66807
+ var _a, _b, _c, _d;
66742
66808
  const config = Object.assign({}, userConfig); // not positive it's json safe
66743
66809
  const diagnostics = [];
66744
66810
  const logger = bootstrapConfig.logger || config.logger || createLogger();
@@ -66749,6 +66815,7 @@ const validateConfig = (userConfig = {}, bootstrapConfig) => {
66749
66815
  logger,
66750
66816
  outputTargets: (_a = config.outputTargets) !== null && _a !== void 0 ? _a : [],
66751
66817
  sys: (_c = (_b = config.sys) !== null && _b !== void 0 ? _b : bootstrapConfig.sys) !== null && _c !== void 0 ? _c : createSystem({ logger }),
66818
+ testing: (_d = config.testing) !== null && _d !== void 0 ? _d : {},
66752
66819
  };
66753
66820
  // default devMode false
66754
66821
  if (validatedConfig.flags.prod) {