@stencil/core 2.17.4 → 2.18.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 (88) hide show
  1. package/cli/index.cjs +285 -220
  2. package/cli/index.d.ts +1 -0
  3. package/cli/index.js +285 -220
  4. package/cli/package.json +1 -1
  5. package/compiler/lib.dom.d.ts +620 -89
  6. package/compiler/lib.dom.iterable.d.ts +27 -3
  7. package/compiler/lib.es2015.core.d.ts +3 -3
  8. package/compiler/lib.es2015.iterable.d.ts +2 -1
  9. package/compiler/lib.es2015.reflect.d.ts +1 -1
  10. package/compiler/lib.es2020.bigint.d.ts +7 -5
  11. package/compiler/lib.es2020.d.ts +2 -0
  12. package/compiler/lib.es2020.date.d.ts +44 -0
  13. package/compiler/lib.es2020.intl.d.ts +51 -11
  14. package/compiler/lib.es2020.number.d.ts +30 -0
  15. package/compiler/lib.es2021.intl.d.ts +106 -4
  16. package/compiler/lib.es2022.array.d.ts +123 -0
  17. package/compiler/lib.es2022.d.ts +26 -0
  18. package/compiler/lib.es2022.error.d.ts +75 -0
  19. package/compiler/lib.es2022.full.d.ts +25 -0
  20. package/compiler/lib.es2022.intl.d.ts +111 -0
  21. package/compiler/lib.es2022.object.d.ts +28 -0
  22. package/compiler/lib.es2022.string.d.ts +27 -0
  23. package/compiler/lib.es5.d.ts +25 -19
  24. package/compiler/lib.esnext.d.ts +1 -1
  25. package/compiler/lib.esnext.intl.d.ts +4 -1
  26. package/compiler/lib.webworker.d.ts +236 -40
  27. package/compiler/lib.webworker.iterable.d.ts +10 -3
  28. package/compiler/package.json +1 -1
  29. package/compiler/stencil.d.ts +2 -2
  30. package/compiler/stencil.js +47263 -45624
  31. package/compiler/stencil.min.js +2 -2
  32. package/compiler/sys/in-memory-fs.d.ts +218 -0
  33. package/dependencies.json +10 -1
  34. package/dev-server/client/index.d.ts +2 -2
  35. package/dev-server/client/index.js +241 -241
  36. package/dev-server/client/package.json +1 -1
  37. package/dev-server/connector.html +3 -3
  38. package/dev-server/index.d.ts +1 -1
  39. package/dev-server/index.js +2 -2
  40. package/dev-server/package.json +1 -1
  41. package/dev-server/server-process.js +1198 -1167
  42. package/internal/app-data/package.json +1 -1
  43. package/internal/client/css-shim.js +2 -2
  44. package/internal/client/dom.js +1 -1
  45. package/internal/client/index.js +1022 -824
  46. package/internal/client/package.json +1 -1
  47. package/internal/client/patch-browser.js +1 -1
  48. package/internal/client/patch-esm.js +1 -1
  49. package/internal/client/polyfills/css-shim.js +1 -1
  50. package/internal/client/shadow-css.js +1 -1
  51. package/internal/hydrate/index.js +119 -119
  52. package/internal/hydrate/package.json +1 -1
  53. package/internal/hydrate/runner.d.ts +1 -1
  54. package/internal/hydrate/runner.js +100 -100
  55. package/internal/package.json +1 -1
  56. package/internal/stencil-core/index.d.ts +8 -10
  57. package/internal/stencil-private.d.ts +77 -138
  58. package/internal/stencil-public-compiler.d.ts +44 -10
  59. package/internal/stencil-public-runtime.d.ts +15 -4
  60. package/internal/testing/index.js +148 -148
  61. package/internal/testing/package.json +1 -1
  62. package/mock-doc/index.cjs +534 -518
  63. package/mock-doc/index.d.ts +13 -12
  64. package/mock-doc/index.js +534 -518
  65. package/mock-doc/package.json +1 -1
  66. package/package.json +23 -32
  67. package/readme.md +27 -33
  68. package/screenshot/index.d.ts +1 -1
  69. package/screenshot/index.js +13 -13
  70. package/screenshot/package.json +1 -1
  71. package/screenshot/pixel-match.js +983 -849
  72. package/sys/node/glob.js +1 -1
  73. package/sys/node/index.d.ts +2 -0
  74. package/sys/node/index.js +374 -373
  75. package/sys/node/package.json +1 -1
  76. package/sys/node/worker.js +1 -1
  77. package/testing/index.d.ts +6 -6
  78. package/testing/index.js +427 -441
  79. package/testing/jest/jest-config.d.ts +1 -1
  80. package/testing/matchers/index.d.ts +3 -3
  81. package/testing/mock-fetch.d.ts +1 -1
  82. package/testing/mocks.d.ts +2 -2
  83. package/testing/package.json +1 -1
  84. package/testing/puppeteer/puppeteer-element.d.ts +2 -2
  85. package/testing/puppeteer/puppeteer-events.d.ts +1 -1
  86. package/testing/testing-logger.d.ts +1 -1
  87. package/testing/testing-utils.d.ts +5 -4
  88. package/testing/testing.d.ts +1 -1
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stencil/core/mock-doc",
3
- "version": "2.17.4",
3
+ "version": "2.18.1",
4
4
  "description": "Mock window, document and DOM outside of a browser environment.",
5
5
  "main": "./index.cjs",
6
6
  "module": "./index.js",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stencil/core",
3
- "version": "2.17.4",
3
+ "version": "2.18.1",
4
4
  "license": "MIT",
5
5
  "main": "./internal/stencil-core/index.cjs",
6
6
  "module": "./internal/stencil-core/index.js",
@@ -30,7 +30,7 @@
30
30
  "license": "node scripts --license",
31
31
  "lint": "eslint \"src/*.ts\" \"src/**/*.ts\" \"src/**/*.tsx\"",
32
32
  "prettier": "npm run prettier.base -- --write",
33
- "prettier.base": "prettier \"./({bin,scripts,src,test}/**/*.{ts,tsx,js,jsx})|bin/stencil\"",
33
+ "prettier.base": "prettier \"./({bin,scripts,src,test}/**/*.{ts,tsx,js,jsx})|bin/stencil|.github/(**/)?*.(yml|yaml)|*.js\"",
34
34
  "prettier.dry-run": "npm run prettier.base -- --list-different",
35
35
  "release": "node scripts --release --publish",
36
36
  "release.prepare": "node scripts --release --prepare",
@@ -54,8 +54,7 @@
54
54
  "tsc": "tsc --incremental",
55
55
  "tsc.prod": "tsc",
56
56
  "tsc.scripts": "tsc -p scripts/tsconfig.json",
57
- "tsc.watch": "tsc --incremental --watch",
58
- "watch": "node scripts && npm run tsc && concurrently \"npm run rollup.watch\" \"npm run tsc.watch\""
57
+ "tsc.watch": "tsc --incremental --watch"
59
58
  },
60
59
  "devDependencies": {
61
60
  "@ionic/prettier-config": "^2.0.0",
@@ -64,47 +63,40 @@
64
63
  "@rollup/plugin-node-resolve": "9.0.0",
65
64
  "@rollup/plugin-replace": "2.3.4",
66
65
  "@rollup/pluginutils": "4.1.0",
67
- "@types/autoprefixer": "^10.2.0",
68
- "@types/eslint": "^8.4.2",
66
+ "@types/eslint": "^8.4.6",
69
67
  "@types/exit": "^0.1.31",
70
68
  "@types/fs-extra": "^9.0.8",
71
- "@types/glob": "^7.1.2",
69
+ "@types/glob": "^8.0.0",
72
70
  "@types/graceful-fs": "^4.1.5",
73
71
  "@types/inquirer": "^7.3.1",
74
- "@types/is-glob": "^4.0.1",
75
72
  "@types/jest": "^27.0.3",
76
- "@types/listr": "^0.14.2",
77
- "@types/mime-types": "^2.1.0",
73
+ "@types/listr": "^0.14.4",
78
74
  "@types/node": "^14.14.35",
79
- "@types/node-fetch": "^2.5.8",
80
75
  "@types/parse5": "^6.0.0",
81
- "@types/pixelmatch": "^4.0.0",
76
+ "@types/pixelmatch": "^5.2.4",
82
77
  "@types/pngjs": "^3.4.2",
83
78
  "@types/prompts": "^2.0.9",
84
- "@types/semver": "^7.3.4",
79
+ "@types/semver": "^7.3.12",
85
80
  "@types/sizzle": "^2.3.2",
86
81
  "@types/webpack": "^4.41.26",
87
82
  "@types/ws": "^7.4.0",
88
83
  "@types/yarnpkg__lockfile": "^1.1.5",
89
- "@typescript-eslint/eslint-plugin": "^5.20.0",
90
- "@typescript-eslint/parser": "^5.20.0",
84
+ "@typescript-eslint/eslint-plugin": "^5.38.0",
85
+ "@typescript-eslint/parser": "^5.38.0",
91
86
  "@yarnpkg/lockfile": "^1.1.0",
92
87
  "ansi-colors": "4.1.1",
93
88
  "autoprefixer": "10.2.5",
94
- "concurrently": "^6.0.0",
95
- "conventional-changelog-cli": "^2.1.1",
96
- "core-js-builder": "~3.6.5",
97
- "css": "^3.0.0",
98
- "dts-bundle-generator": "~5.3.0",
99
- "eslint": "^8.13.0",
89
+ "conventional-changelog-cli": "^2.2.2",
90
+ "dts-bundle-generator": "~6.12.0",
91
+ "eslint": "^8.23.1",
100
92
  "eslint-config-prettier": "^8.5.0",
101
- "eslint-plugin-jest": "^26.5.3",
93
+ "eslint-plugin-jest": "^27.0.4",
102
94
  "eslint-plugin-jsdoc": "^39.3.1",
95
+ "eslint-plugin-simple-import-sort": "^8.0.0",
103
96
  "execa": "4.1.0",
104
97
  "exit": "^0.1.2",
105
- "fast-deep-equal": "3.1.3",
106
- "fs-extra": "^9.1.0",
107
- "glob": "7.1.6",
98
+ "fs-extra": "^10.1.0",
99
+ "glob": "8.0.3",
108
100
  "graceful-fs": "~4.2.6",
109
101
  "hash.js": "^1.1.7",
110
102
  "inquirer": "^7.3.3",
@@ -112,27 +104,26 @@
112
104
  "jest-cli": "^27.4.5",
113
105
  "jest-environment-node": "^27.4.4",
114
106
  "listr": "^0.14.3",
115
- "magic-string": "^0.25.7",
107
+ "magic-string": "^0.26.3",
116
108
  "merge-source-map": "^1.1.0",
117
109
  "mime-db": "^1.46.0",
118
110
  "minimatch": "3.0.4",
119
111
  "node-fetch": "2.6.7",
120
- "open": "8.2.1",
112
+ "open": "^8.4.0",
121
113
  "open-in-editor": "2.2.0",
122
114
  "parse5": "6.0.1",
123
115
  "path-browserify": "^1.0.1",
124
- "pixelmatch": "4.0.2",
116
+ "pixelmatch": "5.3.0",
125
117
  "postcss": "^8.2.8",
126
- "prettier": "2.5.1",
118
+ "prettier": "2.7.1",
127
119
  "prompts": "2.4.0",
128
120
  "puppeteer": "~10.0.0",
129
121
  "rollup": "2.42.3",
130
122
  "rollup-plugin-sourcemaps": "^0.6.3",
131
- "semver": "7.3.4",
123
+ "semver": "^7.3.7",
132
124
  "sizzle": "^2.3.6",
133
125
  "terser": "5.6.1",
134
- "tslib": "^2.1.0",
135
- "typescript": "4.5.4",
126
+ "typescript": "4.7.4",
136
127
  "webpack": "^4.46.0",
137
128
  "ws": "7.4.6"
138
129
  },
package/readme.md CHANGED
@@ -9,7 +9,10 @@
9
9
  </h1>
10
10
 
11
11
  <p align="center">
12
- A compiler for generating <a href="https://www.webcomponents.org/introduction">Web Components</a>
12
+ A compiler for generating <a href="https://www.webcomponents.org/introduction" target="_blank" rel="noopener noref">Web Components</a>, built by the <a href="https://ionic.io/">Ionic team</a>.
13
+ </p>
14
+ <p align="center">
15
+ Stencil allows developers to use technologies like TypeScript and JSX to define components, then generate 100% standards-based Web Components that run on both <a href="https://stenciljs.com/docs/browser-support" target="_blank" rel="noopener noref">modern browsers and legacy browsers</a>
13
16
  </p>
14
17
 
15
18
  <p align="center">
@@ -43,46 +46,28 @@
43
46
  <a href="https://twitter.com/stenciljs">Twitter</a>
44
47
  </h2>
45
48
 
46
- [Stencil](https://stenciljs.com/) is a simple compiler for generating Web Components and static site generated progressive web apps (PWA). Stencil was built by the [Ionic](https://ionic.io/) team for its next generation of performant mobile and desktop Web Components.
47
-
48
- Stencil combines the best concepts of the most popular frontend frameworks into a compile-time rather than run-time tool. It combines TypeScript, JSX, an asynchronous rendering pipeline to ensure smooth running animations and lazy-loading, to generate 100% standards-based Web Components that run on both [modern browsers and legacy browsers](https://stenciljs.com/docs/browser-support).
49
-
50
- Stencil components are just Web Components, so they work in any major framework or with no framework at all. In many cases, Stencil can be used as a drop in replacement for traditional frontend frameworks given the capabilities now available in the browser, though using it as such is certainly not required.
51
-
52
- Stencil also enables a number of key capabilities on top of Web Components, in particular Server Side Rendering (SSR) without the need to run a headless browser, pre-rendering, and objects-as-properties (instead of just strings).
53
-
54
- ## Getting Started
55
-
56
- To create a new project using an interactive cli, run:
57
-
58
- ```bash
59
- npm init stencil
60
- ```
61
-
62
- To start developing your new Stencil project, run:
63
-
64
- ```bash
65
- npm start
66
- ```
67
-
68
- ## Creating components
69
-
70
- Stencil components are TypeScript classes with decorator metadata. The decorators themselves are purely build-time annotations so the compiler can read metadata about each component, and removed entirely for smaller efficient components.
49
+ ### Getting Started
71
50
 
72
- Create new components by creating files with a `.tsx` extension, such as `my-component.tsx`, and place them in `src/components`.
51
+ Start a new project by following our quick [Getting Started guide](https://stenciljs.com/docs/getting-started).
52
+ We would love to hear from you!
53
+ If you have any feedback or run into issues using Stencil, please file an [issue](https://github.com/ionic-team/stencil/issues/new) on this repository.
73
54
 
55
+ ### Examples
56
+ A Stencil component looks a lot like a class-based React component, with the addition of TypeScript decorators:
74
57
  ```tsx
75
58
  import { Component, Prop, h } from '@stencil/core';
76
59
 
77
60
  @Component({
78
- tag: 'my-component',
79
- styleUrl: 'my-component.css'
61
+ tag: 'my-component', // the name of the component's custom HTML tag
62
+ styleUrl: 'my-component.css', // css styles to apply to the component
63
+ shadow: true, // this component uses the ShadowDOM
80
64
  })
81
65
  export class MyComponent {
82
-
66
+ // The component accepts two arguments:
83
67
  @Prop() first: string;
84
68
  @Prop() last: string;
85
69
 
70
+ //The following HTML is rendered when our component is used
86
71
  render() {
87
72
  return (
88
73
  <div>
@@ -93,13 +78,22 @@ export class MyComponent {
93
78
  }
94
79
  ```
95
80
 
96
- To use this component, just use it like any other HTML element:
81
+ The component above can be used like any other HTML element:
97
82
 
98
83
  ```html
99
84
  <my-component first="Stencil" last="JS"></my-component>
100
85
  ```
101
86
 
102
- ## Thanks
87
+ Since Stencil generates web components, they work in any major framework or with no framework at all.
88
+ In many cases, Stencil can be used as a drop in replacement for traditional frontend framework, though using it as such is certainly not required.
89
+
90
+ ### Contributing
91
+
92
+ Thanks for your interest in contributing!
93
+ Please take a moment to read up on our guidelines for [contributing](https://github.com/ionic-team/stencil/blob/main/.github/CONTRIBUTING.md).
94
+ Please note that this project is released with a [Contributor Code of Conduct](https://github.com/ionic-team/stencil/blob/main/CODE_OF_CONDUCT.md). By participating in this project you agree to abide by its terms.
95
+
96
+ ### Thanks
103
97
  Stencil's internal testing suite is supported by the [BrowserStack Open-Source Program](https://www.browserstack.com/open-source)
104
98
  <br>
105
- <a target="_blank" href="https://www.browserstack.com/"><img width="200" src="https://www.browserstack.com/images/layout/browserstack-logo-600x315.png"></a>
99
+ <a href="https://www.browserstack.com/" target="_blank" rel="noopener noref"><img width="200" src="https://www.browserstack.com/images/layout/browserstack-logo-600x315.png"></a>
@@ -1,3 +1,3 @@
1
1
  export { ScreenshotConnector } from './connector-base';
2
2
  export { ScreenshotLocalConnector } from './connector-local';
3
- export { ScreenshotBuild, Screenshot, ScreenshotCompareResults, ScreenshotDiff } from '@stencil/core/internal';
3
+ export { Screenshot, ScreenshotBuild, ScreenshotCompareResults, ScreenshotDiff } from '@stencil/core/internal';
@@ -1,13 +1,13 @@
1
1
  'use strict';
2
2
 
3
- const fs = require('fs');
4
- const path = require('path');
5
3
  const os = require('os');
4
+ const path = require('path');
5
+ const fs = require('fs');
6
6
 
7
7
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
8
8
 
9
- const fs__default = /*#__PURE__*/_interopDefaultLegacy(fs);
10
9
  const path__default = /*#__PURE__*/_interopDefaultLegacy(path);
10
+ const fs__default = /*#__PURE__*/_interopDefaultLegacy(fs);
11
11
 
12
12
  function fileExists(filePath) {
13
13
  return new Promise((resolve) => {
@@ -500,18 +500,18 @@ const getEncodedRootLength = (path) => {
500
500
  return 0;
501
501
  const ch0 = path.charCodeAt(0);
502
502
  // POSIX or UNC
503
- if (ch0 === 47 /* slash */ || ch0 === 92 /* backslash */) {
503
+ if (ch0 === 47 /* CharacterCodes.slash */ || ch0 === 92 /* CharacterCodes.backslash */) {
504
504
  if (path.charCodeAt(1) !== ch0)
505
505
  return 1; // POSIX: "/" (or non-normalized "\")
506
- const p1 = path.indexOf(ch0 === 47 /* slash */ ? '/' : altDirectorySeparator, 2);
506
+ const p1 = path.indexOf(ch0 === 47 /* CharacterCodes.slash */ ? '/' : altDirectorySeparator, 2);
507
507
  if (p1 < 0)
508
508
  return path.length; // UNC: "//server" or "\\server"
509
509
  return p1 + 1; // UNC: "//server/" or "\\server\"
510
510
  }
511
511
  // DOS
512
- if (isVolumeCharacter(ch0) && path.charCodeAt(1) === 58 /* colon */) {
512
+ if (isVolumeCharacter(ch0) && path.charCodeAt(1) === 58 /* CharacterCodes.colon */) {
513
513
  const ch2 = path.charCodeAt(2);
514
- if (ch2 === 47 /* slash */ || ch2 === 92 /* backslash */)
514
+ if (ch2 === 47 /* CharacterCodes.slash */ || ch2 === 92 /* CharacterCodes.backslash */)
515
515
  return 3; // DOS: "c:/" or "c:\"
516
516
  if (path.length === 2)
517
517
  return 2; // DOS: "c:" (but not "c:d")
@@ -533,7 +533,7 @@ const getEncodedRootLength = (path) => {
533
533
  isVolumeCharacter(path.charCodeAt(authorityEnd + 1))) {
534
534
  const volumeSeparatorEnd = getFileUrlVolumeSeparatorEnd(path, authorityEnd + 2);
535
535
  if (volumeSeparatorEnd !== -1) {
536
- if (path.charCodeAt(volumeSeparatorEnd) === 47 /* slash */) {
536
+ if (path.charCodeAt(volumeSeparatorEnd) === 47 /* CharacterCodes.slash */) {
537
537
  // URL: "file:///c:/", "file://localhost/c:/", "file:///c%3a/", "file://localhost/c%3a/"
538
538
  return ~(volumeSeparatorEnd + 1);
539
539
  }
@@ -551,15 +551,15 @@ const getEncodedRootLength = (path) => {
551
551
  // relative
552
552
  return 0;
553
553
  };
554
- const isVolumeCharacter = (charCode) => (charCode >= 97 /* a */ && charCode <= 122 /* z */) ||
555
- (charCode >= 65 /* A */ && charCode <= 90 /* Z */);
554
+ const isVolumeCharacter = (charCode) => (charCode >= 97 /* CharacterCodes.a */ && charCode <= 122 /* CharacterCodes.z */) ||
555
+ (charCode >= 65 /* CharacterCodes.A */ && charCode <= 90 /* CharacterCodes.Z */);
556
556
  const getFileUrlVolumeSeparatorEnd = (url, start) => {
557
557
  const ch0 = url.charCodeAt(start);
558
- if (ch0 === 58 /* colon */)
558
+ if (ch0 === 58 /* CharacterCodes.colon */)
559
559
  return start + 1;
560
- if (ch0 === 37 /* percent */ && url.charCodeAt(start + 1) === 51 /* _3 */) {
560
+ if (ch0 === 37 /* CharacterCodes.percent */ && url.charCodeAt(start + 1) === 51 /* CharacterCodes._3 */) {
561
561
  const ch2 = url.charCodeAt(start + 2);
562
- if (ch2 === 97 /* a */ || ch2 === 65 /* A */)
562
+ if (ch2 === 97 /* CharacterCodes.a */ || ch2 === 65 /* CharacterCodes.A */)
563
563
  return start + 3;
564
564
  }
565
565
  return -1;
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stencil/core/screenshot",
3
- "version": "2.17.4",
3
+ "version": "2.18.1",
4
4
  "description": "Stencil Screenshot.",
5
5
  "main": "./index.js",
6
6
  "types": "./index.d.ts",