@stencil/core 3.0.0-beta.1 → 3.0.0-rc.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 (44) hide show
  1. package/cli/index.cjs +12 -8
  2. package/cli/index.js +12 -8
  3. package/cli/package.json +1 -1
  4. package/compiler/package.json +1 -1
  5. package/compiler/stencil.js +60 -28
  6. package/compiler/stencil.min.js +2 -2
  7. package/dependencies.json +1 -1
  8. package/dev-server/client/index.js +1 -1
  9. package/dev-server/client/package.json +1 -1
  10. package/dev-server/connector.html +2 -2
  11. package/dev-server/index.js +1 -1
  12. package/dev-server/package.json +1 -1
  13. package/dev-server/server-process.js +6 -5
  14. package/dev-server/ws.js +1 -1
  15. package/internal/app-data/package.json +1 -1
  16. package/internal/client/css-shim.js +1 -1
  17. package/internal/client/dom.js +1 -1
  18. package/internal/client/index.js +108 -5
  19. package/internal/client/package.json +1 -1
  20. package/internal/client/patch-browser.js +19 -1
  21. package/internal/client/patch-esm.js +1 -1
  22. package/internal/client/shadow-css.js +1 -1
  23. package/internal/hydrate/index.js +48 -37
  24. package/internal/hydrate/package.json +1 -1
  25. package/internal/hydrate/runner.d.ts +16 -15
  26. package/internal/hydrate/runner.js +4 -2
  27. package/internal/package.json +1 -1
  28. package/internal/stencil-core/index.d.ts +1 -0
  29. package/internal/stencil-private.d.ts +10 -0
  30. package/internal/stencil-public-compiler.d.ts +12 -18
  31. package/internal/stencil-public-runtime.d.ts +20 -0
  32. package/internal/testing/index.js +53 -41
  33. package/internal/testing/package.json +1 -1
  34. package/mock-doc/index.cjs +1 -1
  35. package/mock-doc/index.js +1 -1
  36. package/mock-doc/package.json +1 -1
  37. package/package.json +7 -7
  38. package/screenshot/package.json +1 -1
  39. package/sys/node/glob.js +1 -1
  40. package/sys/node/index.js +1 -1
  41. package/sys/node/package.json +1 -1
  42. package/sys/node/worker.js +1 -1
  43. package/testing/index.js +72 -66
  44. package/testing/package.json +1 -1
package/testing/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- Stencil Testing v3.0.0-beta.1 | MIT Licensed | https://stenciljs.com
2
+ Stencil Testing v3.0.0-rc.1 | MIT Licensed | https://stenciljs.com
3
3
  */
4
4
  function _lazyRequire(e) {
5
5
  return new Proxy({}, {
@@ -124,51 +124,54 @@ function getCompilerOptions(e) {
124
124
  if (!t) return null;
125
125
  const r = stencil_js.ts.readConfigFile(t, stencil_js.ts.sys.readFile);
126
126
  if (r.error) throw new Error(formatDiagnostic((e => {
127
- const t = {
128
- level: "warn",
129
- type: "typescript",
130
- language: "typescript",
131
- header: "TypeScript",
127
+ var t;
128
+ const r = {
129
+ absFilePath: void 0,
132
130
  code: e.code.toString(),
131
+ columnNumber: void 0,
132
+ header: "TypeScript",
133
+ language: "typescript",
134
+ level: "warn",
135
+ lineNumber: void 0,
136
+ lines: [],
133
137
  messageText: flattenDiagnosticMessageText(e, e.messageText),
134
- relFilePath: null,
135
- absFilePath: null,
136
- lines: []
138
+ relFilePath: void 0,
139
+ type: "typescript"
137
140
  };
138
- if (1 === e.category && (t.level = "error"), e.file) {
139
- t.absFilePath = e.file.fileName;
140
- const s = "string" != typeof (r = e.file.text) ? [] : (r = r.replace(/\\r/g, "\n")).split("\n"), n = e.file.getLineAndCharacterOfPosition(e.start), i = {
141
- lineIndex: n.line,
142
- lineNumber: n.line + 1,
143
- text: s[n.line],
144
- errorCharStart: n.character,
145
- errorLength: Math.max(e.length, 1)
141
+ if (1 === e.category && (r.level = "error"), e.file && "number" == typeof e.start) {
142
+ r.absFilePath = e.file.fileName;
143
+ const n = "string" != typeof (s = e.file.text) ? [] : (s = s.replace(/\\r/g, "\n")).split("\n"), i = e.file.getLineAndCharacterOfPosition(e.start), o = {
144
+ lineIndex: i.line,
145
+ lineNumber: i.line + 1,
146
+ text: n[i.line],
147
+ errorCharStart: i.character,
148
+ errorLength: Math.max(null !== (t = e.length) && void 0 !== t ? t : 0, 1)
146
149
  };
147
- if (t.lineNumber = i.lineNumber, t.columnNumber = i.errorCharStart + 1, t.lines.push(i),
148
- 0 === i.errorLength && i.errorCharStart > 0 && (i.errorLength = 1, i.errorCharStart--),
149
- i.lineIndex > 0) {
150
+ if (r.lineNumber = o.lineNumber, r.columnNumber = o.errorCharStart + 1, r.lines.push(o),
151
+ 0 === o.errorLength && o.errorCharStart > 0 && (o.errorLength = 1, o.errorCharStart--),
152
+ o.lineIndex > 0) {
150
153
  const e = {
151
- lineIndex: i.lineIndex - 1,
152
- lineNumber: i.lineNumber - 1,
153
- text: s[i.lineIndex - 1],
154
+ lineIndex: o.lineIndex - 1,
155
+ lineNumber: o.lineNumber - 1,
156
+ text: n[o.lineIndex - 1],
154
157
  errorCharStart: -1,
155
158
  errorLength: -1
156
159
  };
157
- t.lines.unshift(e);
160
+ r.lines.unshift(e);
158
161
  }
159
- if (i.lineIndex + 1 < s.length) {
162
+ if (o.lineIndex + 1 < n.length) {
160
163
  const e = {
161
- lineIndex: i.lineIndex + 1,
162
- lineNumber: i.lineNumber + 1,
163
- text: s[i.lineIndex + 1],
164
+ lineIndex: o.lineIndex + 1,
165
+ lineNumber: o.lineNumber + 1,
166
+ text: n[o.lineIndex + 1],
164
167
  errorCharStart: -1,
165
168
  errorLength: -1
166
169
  };
167
- t.lines.push(e);
170
+ r.lines.push(e);
168
171
  }
169
172
  }
170
- var r;
171
- return t;
173
+ var s;
174
+ return r;
172
175
  })(r.error)));
173
176
  const s = stencil_js.ts.parseJsonConfigFileContent(r.config, stencil_js.ts.sys, e, void 0, t);
174
177
  return _tsCompilerOptions = s.options, _tsCompilerOptions;
@@ -3148,7 +3151,7 @@ const COMMON_DIR_MODULE_EXTS = [ ".tsx", ".ts", ".mjs", ".js", ".jsx", ".json",
3148
3151
  d("/");
3149
3152
  const C = {
3150
3153
  name: "in-memory",
3151
- version: "3.0.0-beta.1",
3154
+ version: "3.0.0-rc.1",
3152
3155
  events: a,
3153
3156
  access: async e => u(e),
3154
3157
  accessSync: u,
@@ -4023,13 +4026,15 @@ exports.createJestPuppeteerEnvironment = function createJestPuppeteerEnvironment
4023
4026
  ...e
4024
4027
  }), exports.mockValidatedConfig = function mockValidatedConfig(e = {}) {
4025
4028
  var t;
4026
- const r = mockConfig(e);
4029
+ const r = mockConfig(e), s = path__default.default.resolve("/");
4027
4030
  return {
4028
4031
  ...r,
4029
4032
  flags: createConfigFlags(),
4033
+ hydratedFlag: null,
4030
4034
  logger: mockLogger(),
4031
4035
  outputTargets: null !== (t = r.outputTargets) && void 0 !== t ? t : [],
4032
- rootDir: path__default.default.resolve("/"),
4036
+ packageJsonFilePath: path__default.default.join(s, "package.json"),
4037
+ rootDir: s,
4033
4038
  sys: createTestingSystem(),
4034
4039
  testing: {},
4035
4040
  ...e
@@ -4169,27 +4174,28 @@ exports.createJestPuppeteerEnvironment = function createJestPuppeteerEnvironment
4169
4174
  }
4170
4175
  return t;
4171
4176
  }, exports.newSpecPage = async function newSpecPage(e) {
4177
+ var t;
4172
4178
  if (null == e) throw new Error("NewSpecPageOptions required");
4173
- testing.resetPlatform(), resetBuildConditionals(appData.BUILD), Array.isArray(e.components) && testing.registerComponents(e.components),
4174
- e.hydrateClientSide && (e.includeAnnotations = !0), e.hydrateServerSide ? (e.includeAnnotations = !0,
4175
- testing.setSupportsShadowDom(!1)) : (e.includeAnnotations = !!e.includeAnnotations,
4179
+ testing.resetPlatform(null !== (t = e.platform) && void 0 !== t ? t : {}), resetBuildConditionals(appData.BUILD),
4180
+ Array.isArray(e.components) && testing.registerComponents(e.components), e.hydrateClientSide && (e.includeAnnotations = !0),
4181
+ e.hydrateServerSide ? (e.includeAnnotations = !0, testing.setSupportsShadowDom(!1)) : (e.includeAnnotations = !!e.includeAnnotations,
4176
4182
  !1 === e.supportsShadowDom ? testing.setSupportsShadowDom(!1) : testing.setSupportsShadowDom(!0)),
4177
4183
  appData.BUILD.cssAnnotations = e.includeAnnotations;
4178
- const t = new Set;
4184
+ const r = new Set;
4179
4185
  testing.win.__stencil_spec_options = e;
4180
- const r = testing.win.document, s = {
4186
+ const s = testing.win.document, n = {
4181
4187
  win: testing.win,
4182
- doc: r,
4183
- body: r.body,
4188
+ doc: s,
4189
+ body: s.body,
4184
4190
  build: appData.BUILD,
4185
4191
  styles: testing.styles,
4186
- setContent: e => (r.body.innerHTML = e, testing.flushAll()),
4192
+ setContent: e => (s.body.innerHTML = e, testing.flushAll()),
4187
4193
  waitForChanges: testing.flushAll,
4188
4194
  flushLoadModule: testing.flushLoadModule,
4189
4195
  flushQueue: testing.flushQueue
4190
- }, n = e.components.map((e => {
4196
+ }, i = e.components.map((e => {
4191
4197
  if (null == e.COMPILER_META) throw new Error('Invalid component class: Missing static "COMPILER_META" property.');
4192
- t.add(e.COMPILER_META.tagName), e.isProxied = !1, function r(e) {
4198
+ r.add(e.COMPILER_META.tagName), e.isProxied = !1, function t(e) {
4193
4199
  var t, r, s, n, i, o;
4194
4200
  "function" == typeof (null === (t = e.prototype) || void 0 === t ? void 0 : t.__componentWillLoad) && (e.prototype.componentWillLoad = e.prototype.__componentWillLoad,
4195
4201
  e.prototype.__componentWillLoad = null), "function" == typeof (null === (r = e.prototype) || void 0 === r ? void 0 : r.__componentWillUpdate) && (e.prototype.componentWillUpdate = e.prototype.__componentWillUpdate,
@@ -4227,7 +4233,7 @@ exports.createJestPuppeteerEnvironment = function createJestPuppeteerEnvironment
4227
4233
  return trimFalsy([ r, e.tagName, Object.keys(s).length > 0 ? s : void 0, n.length > 0 ? n : void 0 ]);
4228
4234
  })(e, !0))) ])(s, [ e.COMPILER_META ]);
4229
4235
  return i;
4230
- })), i = (e => {
4236
+ })), o = (e => {
4231
4237
  const t = e.some((e => e.htmlTagNames.includes("slot"))), r = e.some((e => "shadow" === e.encapsulation)), s = e.some((e => "shadow" !== e.encapsulation && e.htmlTagNames.includes("slot"))), n = {
4232
4238
  allRenderFn: e.every((e => e.hasRenderFn)),
4233
4239
  cmpDidLoad: e.some((e => e.hasComponentDidLoadFn)),
@@ -4287,24 +4293,24 @@ exports.createJestPuppeteerEnvironment = function createJestPuppeteerEnvironment
4287
4293
  return n.asyncLoading = n.cmpWillUpdate || n.cmpWillLoad || n.cmpWillRender, n.vdomAttribute = n.vdomAttribute || n.reflect,
4288
4294
  n.vdomPropOrAttr = n.vdomPropOrAttr || n.reflect, n;
4289
4295
  })(e.components.map((e => e.COMPILER_META)));
4290
- if (e.strictBuild ? Object.assign(appData.BUILD, i) : Object.keys(i).forEach((e => {
4291
- !0 === i[e] && (appData.BUILD[e] = !0);
4296
+ if (e.strictBuild ? Object.assign(appData.BUILD, o) : Object.keys(o).forEach((e => {
4297
+ !0 === o[e] && (appData.BUILD[e] = !0);
4292
4298
  })), appData.BUILD.asyncLoading = !0, e.hydrateClientSide ? (appData.BUILD.hydrateClientSide = !0,
4293
4299
  appData.BUILD.hydrateServerSide = !1) : e.hydrateServerSide && (appData.BUILD.hydrateServerSide = !0,
4294
4300
  appData.BUILD.hydrateClientSide = !1), appData.BUILD.cloneNodeFix = !1, appData.BUILD.shadowDomShim = !1,
4295
- appData.BUILD.safari10 = !1, appData.BUILD.attachStyles = !!e.attachStyles, "string" == typeof e.url && (s.win.location.href = e.url),
4296
- "string" == typeof e.direction && s.doc.documentElement.setAttribute("dir", e.direction),
4297
- "string" == typeof e.language && s.doc.documentElement.setAttribute("lang", e.language),
4301
+ appData.BUILD.safari10 = !1, appData.BUILD.attachStyles = !!e.attachStyles, "string" == typeof e.url && (n.win.location.href = e.url),
4302
+ "string" == typeof e.direction && n.doc.documentElement.setAttribute("dir", e.direction),
4303
+ "string" == typeof e.language && n.doc.documentElement.setAttribute("lang", e.language),
4298
4304
  "string" == typeof e.cookie) try {
4299
- s.doc.cookie = e.cookie;
4305
+ n.doc.cookie = e.cookie;
4300
4306
  } catch (e) {}
4301
4307
  if ("string" == typeof e.referrer) try {
4302
- s.doc.referrer = e.referrer;
4308
+ n.doc.referrer = e.referrer;
4303
4309
  } catch (e) {}
4304
4310
  if ("string" == typeof e.userAgent) try {
4305
- s.win.navigator.userAgent = e.userAgent;
4311
+ n.win.navigator.userAgent = e.userAgent;
4306
4312
  } catch (e) {}
4307
- if (testing.bootstrapLazy(n), "function" == typeof e.template) {
4313
+ if (testing.bootstrapLazy(i), "function" == typeof e.template) {
4308
4314
  const t = {
4309
4315
  $ancestorComponent$: void 0,
4310
4316
  $flags$: 0,
@@ -4313,26 +4319,26 @@ exports.createJestPuppeteerEnvironment = function createJestPuppeteerEnvironment
4313
4319
  $flags$: 0,
4314
4320
  $tagName$: "body"
4315
4321
  },
4316
- $hostElement$: s.body
4322
+ $hostElement$: n.body
4317
4323
  };
4318
4324
  testing.renderVdom(t, e.template());
4319
- } else "string" == typeof e.html && (s.body.innerHTML = e.html);
4320
- !1 !== e.flushQueue && await s.waitForChanges();
4321
- let o = null;
4322
- return Object.defineProperty(s, "root", {
4325
+ } else "string" == typeof e.html && (n.body.innerHTML = e.html);
4326
+ !1 !== e.flushQueue && await n.waitForChanges();
4327
+ let a = null;
4328
+ return Object.defineProperty(n, "root", {
4323
4329
  get() {
4324
- if (null == o && (o = findRootComponent(t, s.body)), null != o) return o;
4325
- const e = s.body.firstElementChild;
4330
+ if (null == a && (a = findRootComponent(r, n.body)), null != a) return a;
4331
+ const e = n.body.firstElementChild;
4326
4332
  return null != e ? e : null;
4327
4333
  }
4328
- }), Object.defineProperty(s, "rootInstance", {
4334
+ }), Object.defineProperty(n, "rootInstance", {
4329
4335
  get() {
4330
- const e = testing.getHostRef(s.root);
4336
+ const e = testing.getHostRef(n.root);
4331
4337
  return null != e ? e.$lazyInstance$ : null;
4332
4338
  }
4333
- }), e.hydrateServerSide && testing.insertVdomAnnotations(r, []), e.autoApplyChanges && (testing.startAutoApplyChanges(),
4334
- s.waitForChanges = () => (console.error('waitForChanges() cannot be used manually if the "startAutoApplyChanges" option is enabled'),
4335
- Promise.resolve())), s;
4339
+ }), e.hydrateServerSide && testing.insertVdomAnnotations(s, []), e.autoApplyChanges && (testing.startAutoApplyChanges(),
4340
+ n.waitForChanges = () => (console.error('waitForChanges() cannot be used manually if the "startAutoApplyChanges" option is enabled'),
4341
+ Promise.resolve())), n;
4336
4342
  }, exports.shuffleArray = function shuffleArray(e) {
4337
4343
  let t, r, s = e.length;
4338
4344
  for (;0 !== s; ) r = Math.floor(Math.random() * s), s -= 1, t = e[s], e[s] = e[r],
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stencil/core/testing",
3
- "version": "3.0.0-beta.1",
3
+ "version": "3.0.0-rc.1",
4
4
  "description": "Stencil testing suite.",
5
5
  "main": "./index.js",
6
6
  "types": "./index.d.ts",