@stencil/core 2.15.0 → 2.16.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 (52) hide show
  1. package/cli/index.cjs +157 -70
  2. package/cli/index.js +157 -70
  3. package/cli/package.json +1 -1
  4. package/compiler/package.json +1 -1
  5. package/compiler/stencil.js +719 -174
  6. package/compiler/stencil.min.js +2 -2
  7. package/dependencies.json +1 -1
  8. package/dev-server/client/index.js +3 -3
  9. package/dev-server/client/package.json +1 -1
  10. package/dev-server/client/test/hmr-util.spec.d.ts +1 -0
  11. package/dev-server/client/test/status.spec.d.ts +1 -0
  12. package/dev-server/connector.html +3 -3
  13. package/dev-server/index.js +1 -1
  14. package/dev-server/package.json +1 -1
  15. package/dev-server/server-process.js +3 -3
  16. package/internal/app-data/package.json +1 -1
  17. package/internal/client/css-shim.js +2 -2
  18. package/internal/client/dom.js +1 -1
  19. package/internal/client/index.js +11 -9
  20. package/internal/client/package.json +1 -1
  21. package/internal/client/patch-browser.js +1 -1
  22. package/internal/client/patch-esm.js +1 -1
  23. package/internal/client/polyfills/css-shim.js +1 -1
  24. package/internal/client/shadow-css.js +2 -3
  25. package/internal/hydrate/index.js +34 -29
  26. package/internal/hydrate/package.json +1 -1
  27. package/internal/hydrate/runner.js +1 -1
  28. package/internal/hydrate/shadow-css.js +9 -9
  29. package/internal/package.json +1 -1
  30. package/internal/stencil-private.d.ts +39 -3
  31. package/internal/stencil-public-compiler.d.ts +69 -3
  32. package/internal/stencil-public-docs.d.ts +3 -0
  33. package/internal/testing/index.js +34 -29
  34. package/internal/testing/package.json +1 -1
  35. package/internal/testing/shadow-css.js +9 -9
  36. package/mock-doc/index.cjs +18 -4
  37. package/mock-doc/index.d.ts +12 -2
  38. package/mock-doc/index.js +18 -4
  39. package/mock-doc/package.json +1 -1
  40. package/package.json +24 -17
  41. package/screenshot/package.json +1 -1
  42. package/sys/node/autoprefixer.js +1 -1
  43. package/sys/node/index.js +2046 -1338
  44. package/sys/node/node-fetch.js +1 -1
  45. package/sys/node/package.json +1 -1
  46. package/sys/node/worker.js +1 -1
  47. package/testing/index.js +8 -8
  48. package/testing/jest/test/jest-config.spec.d.ts +1 -0
  49. package/testing/jest/test/jest-preprocessor.spec.d.ts +1 -0
  50. package/testing/jest/test/jest-runner.spec.d.ts +1 -0
  51. package/testing/jest/test/jest-serializer.spec.d.ts +1 -0
  52. package/testing/package.json +1 -1
@@ -1,5 +1,5 @@
1
1
  /*!
2
- Stencil Mock Doc (CommonJS) v2.15.0 | MIT Licensed | https://stenciljs.com
2
+ Stencil Mock Doc (CommonJS) v2.16.0 | MIT Licensed | https://stenciljs.com
3
3
  */
4
4
  var mockDoc = (function(exports) {
5
5
  'use strict';
@@ -381,7 +381,7 @@ function toDataAttribute(str) {
381
381
  .toLowerCase());
382
382
  }
383
383
  function dashToPascalCase(str) {
384
- str = String(str).substr(5);
384
+ str = String(str).slice(5);
385
385
  return str
386
386
  .split('-')
387
387
  .map((segment, index) => {
@@ -585,7 +585,7 @@ function cssCaseToJsCase(str) {
585
585
  .split('-')
586
586
  .map((segment) => segment.charAt(0).toUpperCase() + segment.slice(1))
587
587
  .join('');
588
- str = str.substr(0, 1).toLowerCase() + str.substr(1);
588
+ str = str.slice(0, 1).toLowerCase() + str.slice(1);
589
589
  }
590
590
  return str;
591
591
  }
@@ -1528,7 +1528,11 @@ class MockNode {
1528
1528
  if (otherNode === this) {
1529
1529
  return true;
1530
1530
  }
1531
- return this.childNodes.includes(otherNode);
1531
+ const childNodes = Array.from(this.childNodes);
1532
+ if (childNodes.includes(otherNode)) {
1533
+ return true;
1534
+ }
1535
+ return childNodes.some((node) => this.contains.bind(node)(otherNode));
1532
1536
  }
1533
1537
  removeChild(childNode) {
1534
1538
  const index = this.childNodes.indexOf(childNode);
@@ -3165,6 +3169,15 @@ class MockResponse {
3165
3169
  }
3166
3170
  }
3167
3171
 
3172
+ class MockDOMParser {
3173
+ parseFromString(htmlToParse, mimeType) {
3174
+ if (mimeType !== 'text/html') {
3175
+ console.error('XML parsing not implemented yet, continuing as html');
3176
+ }
3177
+ return parseHtmlToDocument(htmlToParse);
3178
+ }
3179
+ }
3180
+
3168
3181
  function setupGlobal(gbl) {
3169
3182
  if (gbl.window == null) {
3170
3183
  const win = (gbl.window = new MockWindow());
@@ -3294,6 +3307,7 @@ const GLOBAL_CONSTRUCTORS = [
3294
3307
  ['MouseEvent', MockMouseEvent],
3295
3308
  ['Request', MockRequest],
3296
3309
  ['Response', MockResponse],
3310
+ ['DOMParser', MockDOMParser],
3297
3311
  ['HTMLAnchorElement', MockAnchorElement],
3298
3312
  ['HTMLBaseElement', MockBaseElement],
3299
3313
  ['HTMLButtonElement', MockButtonElement],
@@ -191,6 +191,7 @@ declare class MockLinkElement extends MockHTMLElement {
191
191
  set href(value: string);
192
192
  }
193
193
  declare class MockMetaElement extends MockHTMLElement {
194
+ content: string;
194
195
  constructor(ownerDocument: any);
195
196
  }
196
197
  declare class MockScriptElement extends MockHTMLElement {
@@ -624,6 +625,10 @@ declare function parseHtmlToDocument(html: string, ownerDocument?: MockDocument)
624
625
  declare function parseHtmlToFragment(html: string, ownerDocument?: MockDocument): any;
625
626
  declare function parseDocumentUtil(ownerDocument: any, html: string): any;
626
627
  declare function parseFragmentUtil(ownerDocument: any, html: string): any;
628
+ declare type DOMParserSupportedType = 'text/html' | 'text/xml' | 'application/xml' | 'application/xhtml+xml' | 'image/svg+xml';
629
+ declare class MockDOMParser {
630
+ parseFromString(htmlToParse: string, mimeType: DOMParserSupportedType): MockDocument;
631
+ }
627
632
  /**
628
633
  * https://developer.mozilla.org/en-US/docs/Web/API/Performance
629
634
  */
@@ -750,6 +755,11 @@ declare class MockWindow {
750
755
  screenY: number;
751
756
  scrollX: number;
752
757
  scrollY: number;
758
+ CustomEvent: typeof MockCustomEvent;
759
+ Event: typeof MockEvent;
760
+ Headers: typeof MockHeaders;
761
+ KeyboardEvent: typeof MockKeyboardEvent;
762
+ MouseEvent: typeof MockMouseEvent;
753
763
  constructor(html?: string | boolean);
754
764
  addEventListener(type: string, handler: (ev?: any) => void): void;
755
765
  alert(msg: string): void;
@@ -787,8 +797,8 @@ declare class MockWindow {
787
797
  get IntersectionObserver(): typeof MockIntersectionObserver;
788
798
  get localStorage(): MockStorage;
789
799
  set localStorage(locStorage: MockStorage);
790
- get location(): Location;
791
- set location(val: Location);
800
+ get location(): MockLocation;
801
+ set location(val: Location | string);
792
802
  matchMedia(): {
793
803
  matches: boolean;
794
804
  };
package/mock-doc/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- Stencil Mock Doc v2.15.0 | MIT Licensed | https://stenciljs.com
2
+ Stencil Mock Doc v2.16.0 | MIT Licensed | https://stenciljs.com
3
3
  */
4
4
  const CONTENT_REF_ID = 'r';
5
5
  const ORG_LOCATION_ID = 'o';
@@ -378,7 +378,7 @@ function toDataAttribute(str) {
378
378
  .toLowerCase());
379
379
  }
380
380
  function dashToPascalCase(str) {
381
- str = String(str).substr(5);
381
+ str = String(str).slice(5);
382
382
  return str
383
383
  .split('-')
384
384
  .map((segment, index) => {
@@ -582,7 +582,7 @@ function cssCaseToJsCase(str) {
582
582
  .split('-')
583
583
  .map((segment) => segment.charAt(0).toUpperCase() + segment.slice(1))
584
584
  .join('');
585
- str = str.substr(0, 1).toLowerCase() + str.substr(1);
585
+ str = str.slice(0, 1).toLowerCase() + str.slice(1);
586
586
  }
587
587
  return str;
588
588
  }
@@ -1525,7 +1525,11 @@ class MockNode {
1525
1525
  if (otherNode === this) {
1526
1526
  return true;
1527
1527
  }
1528
- return this.childNodes.includes(otherNode);
1528
+ const childNodes = Array.from(this.childNodes);
1529
+ if (childNodes.includes(otherNode)) {
1530
+ return true;
1531
+ }
1532
+ return childNodes.some((node) => this.contains.bind(node)(otherNode));
1529
1533
  }
1530
1534
  removeChild(childNode) {
1531
1535
  const index = this.childNodes.indexOf(childNode);
@@ -3162,6 +3166,15 @@ class MockResponse {
3162
3166
  }
3163
3167
  }
3164
3168
 
3169
+ class MockDOMParser {
3170
+ parseFromString(htmlToParse, mimeType) {
3171
+ if (mimeType !== 'text/html') {
3172
+ console.error('XML parsing not implemented yet, continuing as html');
3173
+ }
3174
+ return parseHtmlToDocument(htmlToParse);
3175
+ }
3176
+ }
3177
+
3165
3178
  function setupGlobal(gbl) {
3166
3179
  if (gbl.window == null) {
3167
3180
  const win = (gbl.window = new MockWindow());
@@ -3291,6 +3304,7 @@ const GLOBAL_CONSTRUCTORS = [
3291
3304
  ['MouseEvent', MockMouseEvent],
3292
3305
  ['Request', MockRequest],
3293
3306
  ['Response', MockResponse],
3307
+ ['DOMParser', MockDOMParser],
3294
3308
  ['HTMLAnchorElement', MockAnchorElement],
3295
3309
  ['HTMLBaseElement', MockBaseElement],
3296
3310
  ['HTMLButtonElement', MockButtonElement],
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stencil/core/mock-doc",
3
- "version": "2.15.0",
3
+ "version": "2.16.0",
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.15.0",
3
+ "version": "2.16.0",
4
4
  "license": "MIT",
5
5
  "main": "./internal/stencil-core/index.cjs",
6
6
  "module": "./internal/stencil-core/index.js",
@@ -10,6 +10,8 @@
10
10
  },
11
11
  "files": [
12
12
  "!**/*.map",
13
+ "!**/*.stub.ts",
14
+ "!**/*.stub.tsx",
13
15
  "bin/",
14
16
  "cli/",
15
17
  "compiler/",
@@ -22,37 +24,38 @@
22
24
  "testing/"
23
25
  ],
24
26
  "scripts": {
27
+ "build": "node scripts --prepare && npm run tsc.prod && npm run rollup.prod.ci",
25
28
  "clean": "rm -rf build/ cli/ compiler/ dev-server/ internal/ mock-doc/ sys/ testing/ && npm run clean-scripts",
26
29
  "clean-scripts": "rm -rf scripts/build",
27
- "start": "npm run watch",
28
- "build": "node scripts --prepare && npm run tsc.prod && npm run rollup.prod.ci",
29
- "watch": "node scripts && npm run tsc && concurrently \"npm run rollup.watch\" \"npm run tsc.watch\"",
30
+ "license": "node scripts --license",
31
+ "lint": "eslint \"src/*.ts\" \"src/**/*.ts\" \"src/**/*.tsx\"",
32
+ "prettier": "npm run prettier.base -- --write",
33
+ "prettier.base": "prettier \"./({bin,scripts,src,test}/**/*.{ts,tsx,js,jsx})|bin/stencil\"",
34
+ "prettier.dry-run": "npm run prettier.base -- --list-different",
30
35
  "release": "node scripts --release --publish",
31
36
  "release.prepare": "node scripts --release --prepare",
32
- "tsc": "tsc --incremental",
33
- "tsc.prod": "tsc",
34
- "tsc.scripts": "tsc -p scripts/tsconfig.json",
35
- "tsc.watch": "tsc --incremental --watch",
36
37
  "rollup": "rollup --config",
37
38
  "rollup.prod": "rollup --config --config-prod",
38
39
  "rollup.prod.ci": "rollup --config --config-prod --config-ci",
39
40
  "rollup.watch": "rollup --watch --config",
40
- "license": "node scripts --license",
41
- "prettier": "npm run prettier.base -- --write",
42
- "prettier.base": "prettier \"./({bin,scripts,src,test}/**/*.{ts,tsx,js,jsx})|bin/stencil\"",
43
- "prettier.dry-run": "npm run prettier.base -- --list-different",
41
+ "start": "npm run watch",
44
42
  "test": "jest --coverage",
45
43
  "test.analysis": "cd test && npm run analysis.build-and-analyze",
44
+ "test.bundlers": "cd test && npm run bundlers",
46
45
  "test.dist": "node scripts --validate-build",
47
46
  "test.end-to-end": "cd test/end-to-end && npm ci && npm test && npm run test.dist",
48
47
  "test.jest": "jest",
49
48
  "test.karma": "cd test/karma && npm ci && npm run karma",
50
49
  "test.karma.prod": "cd test/karma && npm ci && npm run karma.prod",
51
- "test.testing": "node scripts/test/validate-testing.js",
52
- "test.sys.node": "echo test.sys.node",
53
50
  "test.prod": "npm run test.dist && npm run test.end-to-end && npm run test.jest && npm run test.karma && npm run test.sys.node && npm run test.testing && npm run test.analysis",
51
+ "test.testing": "node scripts/test/validate-testing.js",
54
52
  "test.watch": "jest --watch",
55
- "test.watch-all": "jest --watchAll --coverage"
53
+ "test.watch-all": "jest --watchAll --coverage",
54
+ "tsc": "tsc --incremental",
55
+ "tsc.prod": "tsc",
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\""
56
59
  },
57
60
  "devDependencies": {
58
61
  "@ionic/prettier-config": "^2.0.0",
@@ -62,6 +65,7 @@
62
65
  "@rollup/plugin-replace": "2.3.4",
63
66
  "@rollup/pluginutils": "4.1.0",
64
67
  "@types/autoprefixer": "^10.2.0",
68
+ "@types/eslint": "^8.4.2",
65
69
  "@types/exit": "^0.1.31",
66
70
  "@types/fs-extra": "^9.0.8",
67
71
  "@types/glob": "^7.1.2",
@@ -82,6 +86,8 @@
82
86
  "@types/webpack": "^4.41.26",
83
87
  "@types/ws": "^7.4.0",
84
88
  "@types/yarnpkg__lockfile": "^1.1.5",
89
+ "@typescript-eslint/eslint-plugin": "^5.20.0",
90
+ "@typescript-eslint/parser": "^5.20.0",
85
91
  "@yarnpkg/lockfile": "^1.1.0",
86
92
  "ansi-colors": "4.1.1",
87
93
  "autoprefixer": "10.2.5",
@@ -90,6 +96,8 @@
90
96
  "core-js-builder": "~3.6.5",
91
97
  "css": "^3.0.0",
92
98
  "dts-bundle-generator": "~5.3.0",
99
+ "eslint": "^8.13.0",
100
+ "eslint-config-prettier": "^8.5.0",
93
101
  "execa": "4.1.0",
94
102
  "exit": "^0.1.2",
95
103
  "fast-deep-equal": "3.1.3",
@@ -106,7 +114,7 @@
106
114
  "merge-source-map": "^1.1.0",
107
115
  "mime-db": "^1.46.0",
108
116
  "minimatch": "3.0.4",
109
- "node-fetch": "2.6.1",
117
+ "node-fetch": "2.6.7",
110
118
  "open": "8.2.1",
111
119
  "open-in-editor": "2.2.0",
112
120
  "parse5": "6.0.1",
@@ -118,7 +126,6 @@
118
126
  "puppeteer": "~10.0.0",
119
127
  "rollup": "2.42.3",
120
128
  "rollup-plugin-sourcemaps": "^0.6.3",
121
- "semiver": "^1.1.0",
122
129
  "semver": "7.3.4",
123
130
  "sizzle": "^2.3.6",
124
131
  "terser": "5.6.1",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stencil/core/screenshot",
3
- "version": "2.15.0",
3
+ "version": "2.16.0",
4
4
  "description": "Stencil Screenshot.",
5
5
  "main": "./index.js",
6
6
  "types": "./index.d.ts",