@stencil/core 2.17.1 → 2.17.2-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.
@@ -94,9 +94,17 @@ declare type LogLevelFlags = ObjectFromKeys<typeof LOG_LEVEL_CLI_ARGS, LogLevel>
94
94
  * on actual flags passed by the user.
95
95
  */
96
96
  export interface ConfigFlags extends BooleanConfigFlags, StringConfigFlags, NumberConfigFlags, StringNumberConfigFlags, LogLevelFlags {
97
- task?: TaskCommand | null;
98
- args?: string[];
99
- knownArgs?: string[];
100
- unknownArgs?: string[];
97
+ task: TaskCommand | null;
98
+ args: string[];
99
+ knownArgs: string[];
100
+ unknownArgs: string[];
101
101
  }
102
+ /**
103
+ * Helper function for initializing a `ConfigFlags` object. Provide any overrides
104
+ * for default values and off you go!
105
+ *
106
+ * @param init an object with any overrides for default values
107
+ * @returns a complete CLI flag object
108
+ */
109
+ export declare const createConfigFlags: (init?: Partial<ConfigFlags>) => ConfigFlags;
102
110
  export {};
package/cli/index.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- Stencil CLI (CommonJS) v2.17.1 | MIT Licensed | https://stenciljs.com
2
+ Stencil CLI (CommonJS) v2.17.2-0 | MIT Licensed | https://stenciljs.com
3
3
  */
4
4
  'use strict';
5
5
 
@@ -522,21 +522,33 @@ const CLI_ARG_ALIASES = {
522
522
  port: 'p',
523
523
  version: 'v',
524
524
  };
525
-
526
525
  /**
527
- * Parse command line arguments into a structured `ConfigFlags` object
526
+ * Helper function for initializing a `ConfigFlags` object. Provide any overrides
527
+ * for default values and off you go!
528
528
  *
529
- * @param args an array of config flags
530
- * @param sys an optional compiler system
531
- * @returns a structured ConfigFlags object
529
+ * @param init an object with any overrides for default values
530
+ * @returns a complete CLI flag object
532
531
  */
533
- const parseFlags = (args, sys) => {
532
+ const createConfigFlags = (init = {}) => {
534
533
  const flags = {
535
534
  task: null,
536
535
  args: [],
537
536
  knownArgs: [],
538
537
  unknownArgs: [],
538
+ ...init,
539
539
  };
540
+ return flags;
541
+ };
542
+
543
+ /**
544
+ * Parse command line arguments into a structured `ConfigFlags` object
545
+ *
546
+ * @param args an array of config flags
547
+ * @param sys an optional compiler system
548
+ * @returns a structured ConfigFlags object
549
+ */
550
+ const parseFlags = (args, sys) => {
551
+ const flags = createConfigFlags();
540
552
  // cmd line has more priority over npm scripts cmd
541
553
  flags.args = Array.isArray(args) ? args.slice() : [];
542
554
  if (flags.args.length > 0 && flags.args[0] && !flags.args[0].startsWith('-')) {
@@ -808,7 +820,7 @@ const getNpmConfigEnvArgs = (sys) => {
808
820
  const dependencies = [
809
821
  {
810
822
  name: "@stencil/core",
811
- version: "2.17.1",
823
+ version: "2.17.2-0",
812
824
  main: "compiler/stencil.js",
813
825
  resources: [
814
826
  "package.json",
@@ -2214,7 +2226,7 @@ const run = async (init) => {
2214
2226
  sys.applyGlobalPatch(sys.getCurrentDirectory());
2215
2227
  }
2216
2228
  if (task === 'help' || flags.help) {
2217
- await taskHelp({ task: 'help', args }, logger, sys);
2229
+ await taskHelp(createConfigFlags({ task: 'help', args }), logger, sys);
2218
2230
  return;
2219
2231
  }
2220
2232
  startupLog(logger, task);
@@ -2240,7 +2252,7 @@ const run = async (init) => {
2240
2252
  startupLogVersion(logger, task, coreCompiler);
2241
2253
  loadedCompilerLog(sys, logger, flags, coreCompiler);
2242
2254
  if (task === 'info') {
2243
- await telemetryAction(sys, { flags: { task: 'info' }, logger }, coreCompiler, async () => {
2255
+ await telemetryAction(sys, { flags: createConfigFlags({ task: 'info' }), logger }, coreCompiler, async () => {
2244
2256
  await taskInfo(coreCompiler, sys, logger);
2245
2257
  });
2246
2258
  return;
@@ -2278,7 +2290,7 @@ const run = async (init) => {
2278
2290
  const runTask = async (coreCompiler, config, task, sys) => {
2279
2291
  var _a, _b;
2280
2292
  const logger = (_a = config.logger) !== null && _a !== void 0 ? _a : createLogger();
2281
- const strictConfig = { ...config, flags: (_b = { ...config.flags }) !== null && _b !== void 0 ? _b : { task }, logger };
2293
+ const strictConfig = { ...config, flags: createConfigFlags((_b = config.flags) !== null && _b !== void 0 ? _b : { task }), logger };
2282
2294
  strictConfig.outputTargets = strictConfig.outputTargets || [];
2283
2295
  switch (task) {
2284
2296
  case 'build':
package/cli/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- Stencil CLI v2.17.1 | MIT Licensed | https://stenciljs.com
2
+ Stencil CLI v2.17.2-0 | MIT Licensed | https://stenciljs.com
3
3
  */
4
4
  /**
5
5
  * This sets the log level hierarchy for our terminal logger, ranging from
@@ -498,21 +498,33 @@ const CLI_ARG_ALIASES = {
498
498
  port: 'p',
499
499
  version: 'v',
500
500
  };
501
-
502
501
  /**
503
- * Parse command line arguments into a structured `ConfigFlags` object
502
+ * Helper function for initializing a `ConfigFlags` object. Provide any overrides
503
+ * for default values and off you go!
504
504
  *
505
- * @param args an array of config flags
506
- * @param sys an optional compiler system
507
- * @returns a structured ConfigFlags object
505
+ * @param init an object with any overrides for default values
506
+ * @returns a complete CLI flag object
508
507
  */
509
- const parseFlags = (args, sys) => {
508
+ const createConfigFlags = (init = {}) => {
510
509
  const flags = {
511
510
  task: null,
512
511
  args: [],
513
512
  knownArgs: [],
514
513
  unknownArgs: [],
514
+ ...init,
515
515
  };
516
+ return flags;
517
+ };
518
+
519
+ /**
520
+ * Parse command line arguments into a structured `ConfigFlags` object
521
+ *
522
+ * @param args an array of config flags
523
+ * @param sys an optional compiler system
524
+ * @returns a structured ConfigFlags object
525
+ */
526
+ const parseFlags = (args, sys) => {
527
+ const flags = createConfigFlags();
516
528
  // cmd line has more priority over npm scripts cmd
517
529
  flags.args = Array.isArray(args) ? args.slice() : [];
518
530
  if (flags.args.length > 0 && flags.args[0] && !flags.args[0].startsWith('-')) {
@@ -784,7 +796,7 @@ const getNpmConfigEnvArgs = (sys) => {
784
796
  const dependencies = [
785
797
  {
786
798
  name: "@stencil/core",
787
- version: "2.17.1",
799
+ version: "2.17.2-0",
788
800
  main: "compiler/stencil.js",
789
801
  resources: [
790
802
  "package.json",
@@ -2190,7 +2202,7 @@ const run = async (init) => {
2190
2202
  sys.applyGlobalPatch(sys.getCurrentDirectory());
2191
2203
  }
2192
2204
  if (task === 'help' || flags.help) {
2193
- await taskHelp({ task: 'help', args }, logger, sys);
2205
+ await taskHelp(createConfigFlags({ task: 'help', args }), logger, sys);
2194
2206
  return;
2195
2207
  }
2196
2208
  startupLog(logger, task);
@@ -2216,7 +2228,7 @@ const run = async (init) => {
2216
2228
  startupLogVersion(logger, task, coreCompiler);
2217
2229
  loadedCompilerLog(sys, logger, flags, coreCompiler);
2218
2230
  if (task === 'info') {
2219
- await telemetryAction(sys, { flags: { task: 'info' }, logger }, coreCompiler, async () => {
2231
+ await telemetryAction(sys, { flags: createConfigFlags({ task: 'info' }), logger }, coreCompiler, async () => {
2220
2232
  await taskInfo(coreCompiler, sys, logger);
2221
2233
  });
2222
2234
  return;
@@ -2254,7 +2266,7 @@ const run = async (init) => {
2254
2266
  const runTask = async (coreCompiler, config, task, sys) => {
2255
2267
  var _a, _b;
2256
2268
  const logger = (_a = config.logger) !== null && _a !== void 0 ? _a : createLogger();
2257
- const strictConfig = { ...config, flags: (_b = { ...config.flags }) !== null && _b !== void 0 ? _b : { task }, logger };
2269
+ const strictConfig = { ...config, flags: createConfigFlags((_b = config.flags) !== null && _b !== void 0 ? _b : { task }), logger };
2258
2270
  strictConfig.outputTargets = strictConfig.outputTargets || [];
2259
2271
  switch (task) {
2260
2272
  case 'build':
package/cli/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stencil/core/cli",
3
- "version": "2.17.1",
3
+ "version": "2.17.2-0",
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.1",
3
+ "version": "2.17.2-0",
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.1 | MIT Licensed | https://stenciljs.com
2
+ Stencil Compiler v2.17.2-0 | MIT Licensed | https://stenciljs.com
3
3
  */
4
4
  (function(exports) {
5
5
  'use strict';
@@ -4052,7 +4052,7 @@ const createCustomResolverAsync = (sys, inMemoryFs, exts) => {
4052
4052
  };
4053
4053
  };
4054
4054
 
4055
- const buildId = '20220711170106';
4055
+ const buildId = '20220719192625';
4056
4056
  const minfyJsId = 'terser5.6.1_7';
4057
4057
  const optimizeCssId = 'autoprefixer10.2.5_postcss8.2.13_7';
4058
4058
  const parse5Version = '6.0.1';
@@ -4060,8 +4060,8 @@ const rollupVersion = '2.42.3';
4060
4060
  const sizzleVersion = '2.42.3';
4061
4061
  const terserVersion = '5.6.1';
4062
4062
  const typescriptVersion = '4.5.4';
4063
- const vermoji = '😊';
4064
- const version$3 = '2.17.1';
4063
+ const vermoji = '🏜';
4064
+ const version$3 = '2.17.2-0';
4065
4065
  const versions = {
4066
4066
  stencil: version$3,
4067
4067
  parse5: parse5Version,
@@ -14939,6 +14939,25 @@ class MockMouseEvent extends MockEvent {
14939
14939
  }
14940
14940
  }
14941
14941
  }
14942
+ class MockUIEvent extends MockEvent {
14943
+ constructor(type, uiEventInitDic) {
14944
+ super(type);
14945
+ this.detail = null;
14946
+ this.view = null;
14947
+ if (uiEventInitDic != null) {
14948
+ Object.assign(this, uiEventInitDic);
14949
+ }
14950
+ }
14951
+ }
14952
+ class MockFocusEvent extends MockUIEvent {
14953
+ constructor(type, focusEventInitDic) {
14954
+ super(type);
14955
+ this.relatedTarget = null;
14956
+ if (focusEventInitDic != null) {
14957
+ Object.assign(this, focusEventInitDic);
14958
+ }
14959
+ }
14960
+ }
14942
14961
  class MockEventListener {
14943
14962
  constructor(type, handler) {
14944
14963
  this.type = type;
@@ -15852,7 +15871,7 @@ class MockElement extends MockNode {
15852
15871
  return shadowRoot;
15853
15872
  }
15854
15873
  blur() {
15855
- /**/
15874
+ dispatchEvent(this, new MockFocusEvent('blur', { relatedTarget: null, bubbles: true, cancelable: true, composed: true }));
15856
15875
  }
15857
15876
  get shadowRoot() {
15858
15877
  return this.__shadowRoot || null;
@@ -15922,7 +15941,9 @@ class MockElement extends MockNode {
15922
15941
  get firstElementChild() {
15923
15942
  return this.children[0] || null;
15924
15943
  }
15925
- focus(_options) { }
15944
+ focus(_options) {
15945
+ dispatchEvent(this, new MockFocusEvent('focus', { relatedTarget: null, bubbles: true, cancelable: true, composed: true }));
15946
+ }
15926
15947
  getAttribute(attrName) {
15927
15948
  if (attrName === 'style') {
15928
15949
  if (this.__style != null && this.__style.length > 0) {
@@ -17572,6 +17593,7 @@ const GLOBAL_CONSTRUCTORS = [
17572
17593
  ['CustomEvent', MockCustomEvent],
17573
17594
  ['Event', MockEvent],
17574
17595
  ['Headers', MockHeaders],
17596
+ ['FocusEvent', MockFocusEvent],
17575
17597
  ['KeyboardEvent', MockKeyboardEvent],
17576
17598
  ['MouseEvent', MockMouseEvent],
17577
17599
  ['Request', MockRequest],
@@ -56135,7 +56157,7 @@ const addCustomElementInputs = (buildCtx, bundleOpts) => {
56135
56157
  exp.push(`import { ${importName} as ${importAs}, defineCustomElement as cmpDefCustomEle } from '${cmp.sourceFilePath}';`);
56136
56158
  exp.push(`export const ${exportName} = ${importAs};`);
56137
56159
  exp.push(`export const defineCustomElement = cmpDefCustomEle;`);
56138
- // Here we push an export (with a rename for `defineCustomElement` for
56160
+ // Here we push an export (with a rename for `defineCustomElement`) for
56139
56161
  // this component onto our array which references the `coreKey` (prefixed
56140
56162
  // with `\0`). We have to do this so that our import is referencing the
56141
56163
  // correct virtual module, if we instead referenced, for instance,
@@ -60187,7 +60209,7 @@ const generateCustomElementsTypesOutput = async (config, compilerCtx, buildCtx,
60187
60209
  // the path where we're going to write the typedef for the whole dist-custom-elements output
60188
60210
  const customElementsDtsPath = join(outputTarget.dir, 'index.d.ts');
60189
60211
  // the directory where types for the individual components are written
60190
- const componentsTypeDirectoryPath = relative$1(outputTarget.dir, join(typesDir, 'components'));
60212
+ const componentsTypeDirectoryRelPath = relative$1(outputTarget.dir, typesDir);
60191
60213
  const components = buildCtx.components.filter((m) => !m.isCollectionDependency);
60192
60214
  const code = [
60193
60215
  `/* ${config.namespace} custom elements */`,
@@ -60196,7 +60218,14 @@ const generateCustomElementsTypesOutput = async (config, compilerCtx, buildCtx,
60196
60218
  const importName = component.componentClassName;
60197
60219
  // typedefs for individual components can be found under paths like
60198
60220
  // $TYPES_DIR/components/my-component/my-component.d.ts
60199
- const componentDTSPath = join(componentsTypeDirectoryPath, component.tagName, component.tagName);
60221
+ //
60222
+ // To construct this path we:
60223
+ //
60224
+ // - get the relative path to the component's source file from the source directory
60225
+ // - join that relative path to the relative path from the `index.d.ts` file to the
60226
+ // directory where typedefs are saved
60227
+ const componentSourceRelPath = relative$1(config.srcDir, component.sourceFilePath).replace('.tsx', '');
60228
+ const componentDTSPath = join(componentsTypeDirectoryRelPath, componentSourceRelPath);
60200
60229
  return `export { ${importName} as ${exportName} } from '${componentDTSPath}';`;
60201
60230
  }),
60202
60231
  ``,
@@ -64397,11 +64426,31 @@ const updateCompilerCtxCache = (config, compilerCtx, path, kind) => {
64397
64426
  }
64398
64427
  };
64399
64428
 
64429
+ /**
64430
+ * All the Boolean options supported by the Stencil CLI
64431
+ */
64432
+ /**
64433
+ * Helper function for initializing a `ConfigFlags` object. Provide any overrides
64434
+ * for default values and off you go!
64435
+ *
64436
+ * @param init an object with any overrides for default values
64437
+ * @returns a complete CLI flag object
64438
+ */
64439
+ const createConfigFlags = (init = {}) => {
64440
+ const flags = {
64441
+ task: null,
64442
+ args: [],
64443
+ knownArgs: [],
64444
+ unknownArgs: [],
64445
+ ...init,
64446
+ };
64447
+ return flags;
64448
+ };
64449
+
64400
64450
  const getConfig = (userConfig) => {
64401
64451
  var _a, _b;
64402
- const flags = (_a = userConfig.flags) !== null && _a !== void 0 ? _a : {};
64403
- const logger = (_b = userConfig.logger) !== null && _b !== void 0 ? _b : createLogger();
64404
- const config = { ...userConfig, flags, logger };
64452
+ const logger = (_a = userConfig.logger) !== null && _a !== void 0 ? _a : createLogger();
64453
+ const config = { ...userConfig, flags: createConfigFlags((_b = userConfig.flags) !== null && _b !== void 0 ? _b : {}), logger };
64405
64454
  if (!config.sys) {
64406
64455
  config.sys = createSystem({ logger: config.logger });
64407
64456
  }
@@ -65110,7 +65159,7 @@ const getComponentPathContent = (componentGraph, outputTarget) => {
65110
65159
  const dependencies = [
65111
65160
  {
65112
65161
  name: "@stencil/core",
65113
- version: "2.17.1",
65162
+ version: "2.17.2-0",
65114
65163
  main: "compiler/stencil.js",
65115
65164
  resources: [
65116
65165
  "package.json",