@stencil/core 2.14.1 → 2.15.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 (41) hide show
  1. package/bin/stencil +19 -13
  2. package/cli/index.cjs +72 -55
  3. package/cli/index.js +72 -55
  4. package/cli/package.json +1 -1
  5. package/compiler/package.json +1 -1
  6. package/compiler/stencil.js +248 -57
  7. package/compiler/stencil.min.js +2 -2
  8. package/dependencies.json +1 -1
  9. package/dev-server/client/index.js +3 -3
  10. package/dev-server/client/package.json +1 -1
  11. package/dev-server/connector.html +3 -3
  12. package/dev-server/index.js +1 -1
  13. package/dev-server/package.json +1 -1
  14. package/dev-server/server-process.js +2 -2
  15. package/internal/app-data/package.json +1 -1
  16. package/internal/client/css-shim.js +2 -2
  17. package/internal/client/dom.js +1 -1
  18. package/internal/client/index.js +1 -1
  19. package/internal/client/package.json +1 -1
  20. package/internal/client/patch-browser.js +1 -1
  21. package/internal/client/patch-esm.js +1 -1
  22. package/internal/client/polyfills/css-shim.js +1 -1
  23. package/internal/client/shadow-css.js +1 -1
  24. package/internal/hydrate/package.json +1 -1
  25. package/internal/hydrate/runner.d.ts +1 -1
  26. package/internal/hydrate/runner.js +1 -1
  27. package/internal/package.json +1 -1
  28. package/internal/stencil-public-compiler.d.ts +18 -14
  29. package/internal/testing/package.json +1 -1
  30. package/mock-doc/index.cjs +13 -3
  31. package/mock-doc/index.d.ts +4 -0
  32. package/mock-doc/index.js +13 -3
  33. package/mock-doc/package.json +1 -1
  34. package/package.json +7 -5
  35. package/screenshot/package.json +1 -1
  36. package/sys/node/index.js +11 -11
  37. package/sys/node/node-fetch.js +1 -1
  38. package/sys/node/package.json +1 -1
  39. package/sys/node/worker.js +1 -1
  40. package/testing/index.js +8 -8
  41. package/testing/package.json +1 -1
package/bin/stencil CHANGED
@@ -2,6 +2,7 @@
2
2
  'use strict';
3
3
 
4
4
  var minimumVersion = '12.10';
5
+ var futureDeprecationMinVersion = '14.0';
5
6
  var recommendedVersion = '14.5';
6
7
  var currentVersion = process.versions.node;
7
8
 
@@ -17,18 +18,22 @@ if (isNodeLT(minimumVersion)) {
17
18
  currentVersion +
18
19
  ', however Stencil requires v' +
19
20
  minimumVersion +
20
- '.0 or greater. It is recommended to use an Active LTS version of Node (https://nodejs.org/en/about/releases/).\n',
21
+ '.0 or greater. It is recommended to use an Active LTS version of Node (https://nodejs.org/en/about/releases/).\n'
21
22
  );
22
23
  process.exit(1);
23
24
  }
24
25
 
25
- if (isNodeLT(recommendedVersion)) {
26
+ if (isNodeLT(futureDeprecationMinVersion)) {
27
+ console.warn(
28
+ '\nIn an upcoming major release of Stencil, Node v' + recommendedVersion + '.0 or higher will be required.\n'
29
+ );
30
+ } else if (isNodeLT(recommendedVersion)) {
26
31
  console.warn(
27
32
  '\nYour current version of Node is v' +
28
33
  currentVersion +
29
34
  ", however Stencil's recommendation is v" +
30
35
  recommendedVersion +
31
- '.0 or greater. Note that future versions of Stencil will eventually remove support for non-LTS Node versions and an Active LTS version is recommended (https://nodejs.org/en/about/releases/).\n',
36
+ '.0 or greater. Note that future versions of Stencil will eventually remove support for non-LTS Node versions and an Active LTS version is recommended (https://nodejs.org/en/about/releases/).\n'
32
37
  );
33
38
  }
34
39
 
@@ -39,13 +44,14 @@ var nodeSys = nodeApi.createNodeSys({ process: process, logger: nodeLogger });
39
44
 
40
45
  nodeApi.setupNodeProcess({ process: process, logger: nodeLogger });
41
46
 
42
- cli.run({
43
- args: process.argv.slice(2),
44
- logger: nodeLogger,
45
- sys: nodeSys,
46
- checkVersion: nodeApi.checkVersion
47
- })
48
- .catch(function (err) {
49
- console.error('uncaught error', err);
50
- process.exit(1);
51
- });
47
+ cli
48
+ .run({
49
+ args: process.argv.slice(2),
50
+ logger: nodeLogger,
51
+ sys: nodeSys,
52
+ checkVersion: nodeApi.checkVersion,
53
+ })
54
+ .catch(function (err) {
55
+ console.error('uncaught error', err);
56
+ process.exit(1);
57
+ });
package/cli/index.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- Stencil CLI (CommonJS) v2.14.1 | MIT Licensed | https://stenciljs.com
2
+ Stencil CLI (CommonJS) v2.15.1 | MIT Licensed | https://stenciljs.com
3
3
  */
4
4
  'use strict';
5
5
 
@@ -259,15 +259,16 @@ const pathComponents = (path, rootLength) => {
259
259
  * @returns an error message if the tag has an invalid name, undefined if the tag name passes all checks
260
260
  */
261
261
  const validateComponentTag = (tag) => {
262
+ // we want to check this first since we call some String.prototype methods below
263
+ if (typeof tag !== 'string') {
264
+ return `Tag "${tag}" must be a string type`;
265
+ }
262
266
  if (tag !== tag.trim()) {
263
267
  return `Tag can not contain white spaces`;
264
268
  }
265
269
  if (tag !== tag.toLowerCase()) {
266
270
  return `Tag can not contain upper case characters`;
267
271
  }
268
- if (typeof tag !== 'string') {
269
- return `Tag "${tag}" must be a string type`;
270
- }
271
272
  if (tag.length === 0) {
272
273
  return `Received empty tag value`;
273
274
  }
@@ -329,9 +330,19 @@ const parseFlags = (args, sys) => {
329
330
  });
330
331
  return flags;
331
332
  };
333
+ /**
334
+ * Parse command line arguments that are whitelisted via the BOOLEAN_ARG_OPTS,
335
+ * STRING_ARG_OPTS, and NUMBER_ARG_OPTS arrays in this file. Handles leading
336
+ * dashes on arguments, aliases that are defined for a small number of argument
337
+ * types, and parsing values for non-boolean arguments (e.g. port number).
338
+ *
339
+ * @param flags a ConfigFlags object
340
+ * @param args an array of command-line arguments to parse
341
+ * @param knownArgs an array to which all recognized, legal arguments are added
342
+ */
332
343
  const parseArgs = (flags, args, knownArgs) => {
333
- ARG_OPTS.boolean.forEach((booleanName) => {
334
- const alias = ARG_OPTS.alias[booleanName];
344
+ BOOLEAN_ARG_OPTS.forEach((booleanName) => {
345
+ const alias = ARG_OPTS_ALIASES[booleanName];
335
346
  const flagKey = configCase(booleanName);
336
347
  if (typeof flags[flagKey] !== 'boolean') {
337
348
  flags[flagKey] = null;
@@ -359,8 +370,8 @@ const parseArgs = (flags, args, knownArgs) => {
359
370
  }
360
371
  });
361
372
  });
362
- ARG_OPTS.string.forEach((stringName) => {
363
- const alias = ARG_OPTS.alias[stringName];
373
+ STRING_ARG_OPTS.forEach((stringName) => {
374
+ const alias = ARG_OPTS_ALIASES[stringName];
364
375
  const flagKey = configCase(stringName);
365
376
  if (typeof flags[flagKey] !== 'string') {
366
377
  flags[flagKey] = null;
@@ -403,8 +414,8 @@ const parseArgs = (flags, args, knownArgs) => {
403
414
  }
404
415
  }
405
416
  });
406
- ARG_OPTS.number.forEach((numberName) => {
407
- const alias = ARG_OPTS.alias[numberName];
417
+ NUMBER_ARG_OPTS.forEach((numberName) => {
418
+ const alias = ARG_OPTS_ALIASES[numberName];
408
419
  const flagKey = configCase(numberName);
409
420
  if (typeof flags[flagKey] !== 'number') {
410
421
  flags[flagKey] = null;
@@ -448,50 +459,56 @@ const parseArgs = (flags, args, knownArgs) => {
448
459
  };
449
460
  const configCase = (prop) => {
450
461
  prop = dashToPascalCase(prop);
451
- return prop.charAt(0).toLowerCase() + prop.substr(1);
462
+ return prop.charAt(0).toLowerCase() + prop.slice(1);
452
463
  };
453
- const ARG_OPTS = {
454
- boolean: [
455
- 'build',
456
- 'cache',
457
- 'check-version',
458
- 'ci',
459
- 'compare',
460
- 'debug',
461
- 'dev',
462
- 'devtools',
463
- 'docs',
464
- 'e2e',
465
- 'es5',
466
- 'esm',
467
- 'headless',
468
- 'help',
469
- 'log',
470
- 'open',
471
- 'prerender',
472
- 'prerender-external',
473
- 'prod',
474
- 'profile',
475
- 'service-worker',
476
- 'screenshot',
477
- 'serve',
478
- 'skip-node-check',
479
- 'spec',
480
- 'ssr',
481
- 'stats',
482
- 'update-screenshot',
483
- 'verbose',
484
- 'version',
485
- 'watch',
486
- ],
487
- number: ['max-workers', 'port'],
488
- string: ['address', 'config', 'docs-json', 'emulate', 'log-level', 'root', 'screenshot-connector'],
489
- alias: {
490
- config: 'c',
491
- help: 'h',
492
- port: 'p',
493
- version: 'v',
494
- },
464
+ const BOOLEAN_ARG_OPTS = [
465
+ 'build',
466
+ 'cache',
467
+ 'check-version',
468
+ 'ci',
469
+ 'compare',
470
+ 'debug',
471
+ 'dev',
472
+ 'devtools',
473
+ 'docs',
474
+ 'e2e',
475
+ 'es5',
476
+ 'esm',
477
+ 'headless',
478
+ 'help',
479
+ 'log',
480
+ 'open',
481
+ 'prerender',
482
+ 'prerender-external',
483
+ 'prod',
484
+ 'profile',
485
+ 'service-worker',
486
+ 'screenshot',
487
+ 'serve',
488
+ 'skip-node-check',
489
+ 'spec',
490
+ 'ssr',
491
+ 'stats',
492
+ 'update-screenshot',
493
+ 'verbose',
494
+ 'version',
495
+ 'watch',
496
+ ];
497
+ const NUMBER_ARG_OPTS = ['max-workers', 'port'];
498
+ const STRING_ARG_OPTS = [
499
+ 'address',
500
+ 'config',
501
+ 'docs-json',
502
+ 'emulate',
503
+ 'log-level',
504
+ 'root',
505
+ 'screenshot-connector',
506
+ ];
507
+ const ARG_OPTS_ALIASES = {
508
+ config: 'c',
509
+ help: 'h',
510
+ port: 'p',
511
+ version: 'v',
495
512
  };
496
513
  const getNpmConfigEnvArgs = (sys) => {
497
514
  // process.env.npm_config_argv
@@ -513,7 +530,7 @@ const getNpmConfigEnvArgs = (sys) => {
513
530
  const dependencies = [
514
531
  {
515
532
  name: "@stencil/core",
516
- version: "2.14.1",
533
+ version: "2.15.1",
517
534
  main: "compiler/stencil.js",
518
535
  resources: [
519
536
  "package.json",
@@ -1453,7 +1470,7 @@ describe('${name}', () => {
1453
1470
  /**
1454
1471
  * Convert a dash case string to pascal case.
1455
1472
  */
1456
- const toPascalCase = (str) => str.split('-').reduce((res, part) => res + part[0].toUpperCase() + part.substr(1), '');
1473
+ const toPascalCase = (str) => str.split('-').reduce((res, part) => res + part[0].toUpperCase() + part.slice(1), '');
1457
1474
 
1458
1475
  const taskTelemetry = async (config, sys, logger) => {
1459
1476
  const prompt = logger.dim(sys.details.platform === 'windows' ? '>' : '$');
package/cli/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- Stencil CLI v2.14.1 | MIT Licensed | https://stenciljs.com
2
+ Stencil CLI v2.15.1 | MIT Licensed | https://stenciljs.com
3
3
  */
4
4
  const toLowerCase = (str) => str.toLowerCase();
5
5
  const dashToPascalCase = (str) => toLowerCase(str)
@@ -235,15 +235,16 @@ const pathComponents = (path, rootLength) => {
235
235
  * @returns an error message if the tag has an invalid name, undefined if the tag name passes all checks
236
236
  */
237
237
  const validateComponentTag = (tag) => {
238
+ // we want to check this first since we call some String.prototype methods below
239
+ if (typeof tag !== 'string') {
240
+ return `Tag "${tag}" must be a string type`;
241
+ }
238
242
  if (tag !== tag.trim()) {
239
243
  return `Tag can not contain white spaces`;
240
244
  }
241
245
  if (tag !== tag.toLowerCase()) {
242
246
  return `Tag can not contain upper case characters`;
243
247
  }
244
- if (typeof tag !== 'string') {
245
- return `Tag "${tag}" must be a string type`;
246
- }
247
248
  if (tag.length === 0) {
248
249
  return `Received empty tag value`;
249
250
  }
@@ -305,9 +306,19 @@ const parseFlags = (args, sys) => {
305
306
  });
306
307
  return flags;
307
308
  };
309
+ /**
310
+ * Parse command line arguments that are whitelisted via the BOOLEAN_ARG_OPTS,
311
+ * STRING_ARG_OPTS, and NUMBER_ARG_OPTS arrays in this file. Handles leading
312
+ * dashes on arguments, aliases that are defined for a small number of argument
313
+ * types, and parsing values for non-boolean arguments (e.g. port number).
314
+ *
315
+ * @param flags a ConfigFlags object
316
+ * @param args an array of command-line arguments to parse
317
+ * @param knownArgs an array to which all recognized, legal arguments are added
318
+ */
308
319
  const parseArgs = (flags, args, knownArgs) => {
309
- ARG_OPTS.boolean.forEach((booleanName) => {
310
- const alias = ARG_OPTS.alias[booleanName];
320
+ BOOLEAN_ARG_OPTS.forEach((booleanName) => {
321
+ const alias = ARG_OPTS_ALIASES[booleanName];
311
322
  const flagKey = configCase(booleanName);
312
323
  if (typeof flags[flagKey] !== 'boolean') {
313
324
  flags[flagKey] = null;
@@ -335,8 +346,8 @@ const parseArgs = (flags, args, knownArgs) => {
335
346
  }
336
347
  });
337
348
  });
338
- ARG_OPTS.string.forEach((stringName) => {
339
- const alias = ARG_OPTS.alias[stringName];
349
+ STRING_ARG_OPTS.forEach((stringName) => {
350
+ const alias = ARG_OPTS_ALIASES[stringName];
340
351
  const flagKey = configCase(stringName);
341
352
  if (typeof flags[flagKey] !== 'string') {
342
353
  flags[flagKey] = null;
@@ -379,8 +390,8 @@ const parseArgs = (flags, args, knownArgs) => {
379
390
  }
380
391
  }
381
392
  });
382
- ARG_OPTS.number.forEach((numberName) => {
383
- const alias = ARG_OPTS.alias[numberName];
393
+ NUMBER_ARG_OPTS.forEach((numberName) => {
394
+ const alias = ARG_OPTS_ALIASES[numberName];
384
395
  const flagKey = configCase(numberName);
385
396
  if (typeof flags[flagKey] !== 'number') {
386
397
  flags[flagKey] = null;
@@ -424,50 +435,56 @@ const parseArgs = (flags, args, knownArgs) => {
424
435
  };
425
436
  const configCase = (prop) => {
426
437
  prop = dashToPascalCase(prop);
427
- return prop.charAt(0).toLowerCase() + prop.substr(1);
438
+ return prop.charAt(0).toLowerCase() + prop.slice(1);
428
439
  };
429
- const ARG_OPTS = {
430
- boolean: [
431
- 'build',
432
- 'cache',
433
- 'check-version',
434
- 'ci',
435
- 'compare',
436
- 'debug',
437
- 'dev',
438
- 'devtools',
439
- 'docs',
440
- 'e2e',
441
- 'es5',
442
- 'esm',
443
- 'headless',
444
- 'help',
445
- 'log',
446
- 'open',
447
- 'prerender',
448
- 'prerender-external',
449
- 'prod',
450
- 'profile',
451
- 'service-worker',
452
- 'screenshot',
453
- 'serve',
454
- 'skip-node-check',
455
- 'spec',
456
- 'ssr',
457
- 'stats',
458
- 'update-screenshot',
459
- 'verbose',
460
- 'version',
461
- 'watch',
462
- ],
463
- number: ['max-workers', 'port'],
464
- string: ['address', 'config', 'docs-json', 'emulate', 'log-level', 'root', 'screenshot-connector'],
465
- alias: {
466
- config: 'c',
467
- help: 'h',
468
- port: 'p',
469
- version: 'v',
470
- },
440
+ const BOOLEAN_ARG_OPTS = [
441
+ 'build',
442
+ 'cache',
443
+ 'check-version',
444
+ 'ci',
445
+ 'compare',
446
+ 'debug',
447
+ 'dev',
448
+ 'devtools',
449
+ 'docs',
450
+ 'e2e',
451
+ 'es5',
452
+ 'esm',
453
+ 'headless',
454
+ 'help',
455
+ 'log',
456
+ 'open',
457
+ 'prerender',
458
+ 'prerender-external',
459
+ 'prod',
460
+ 'profile',
461
+ 'service-worker',
462
+ 'screenshot',
463
+ 'serve',
464
+ 'skip-node-check',
465
+ 'spec',
466
+ 'ssr',
467
+ 'stats',
468
+ 'update-screenshot',
469
+ 'verbose',
470
+ 'version',
471
+ 'watch',
472
+ ];
473
+ const NUMBER_ARG_OPTS = ['max-workers', 'port'];
474
+ const STRING_ARG_OPTS = [
475
+ 'address',
476
+ 'config',
477
+ 'docs-json',
478
+ 'emulate',
479
+ 'log-level',
480
+ 'root',
481
+ 'screenshot-connector',
482
+ ];
483
+ const ARG_OPTS_ALIASES = {
484
+ config: 'c',
485
+ help: 'h',
486
+ port: 'p',
487
+ version: 'v',
471
488
  };
472
489
  const getNpmConfigEnvArgs = (sys) => {
473
490
  // process.env.npm_config_argv
@@ -489,7 +506,7 @@ const getNpmConfigEnvArgs = (sys) => {
489
506
  const dependencies = [
490
507
  {
491
508
  name: "@stencil/core",
492
- version: "2.14.1",
509
+ version: "2.15.1",
493
510
  main: "compiler/stencil.js",
494
511
  resources: [
495
512
  "package.json",
@@ -1429,7 +1446,7 @@ describe('${name}', () => {
1429
1446
  /**
1430
1447
  * Convert a dash case string to pascal case.
1431
1448
  */
1432
- const toPascalCase = (str) => str.split('-').reduce((res, part) => res + part[0].toUpperCase() + part.substr(1), '');
1449
+ const toPascalCase = (str) => str.split('-').reduce((res, part) => res + part[0].toUpperCase() + part.slice(1), '');
1433
1450
 
1434
1451
  const taskTelemetry = async (config, sys, logger) => {
1435
1452
  const prompt = logger.dim(sys.details.platform === 'windows' ? '>' : '$');
package/cli/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stencil/core/cli",
3
- "version": "2.14.1",
3
+ "version": "2.15.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": "2.14.1",
3
+ "version": "2.15.1",
4
4
  "description": "Stencil Compiler.",
5
5
  "main": "./stencil.js",
6
6
  "types": "./stencil.d.ts",