@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.
- package/cli/index.cjs +12 -8
- package/cli/index.js +12 -8
- package/cli/package.json +1 -1
- package/compiler/package.json +1 -1
- package/compiler/stencil.js +60 -28
- package/compiler/stencil.min.js +2 -2
- package/dependencies.json +1 -1
- package/dev-server/client/index.js +1 -1
- package/dev-server/client/package.json +1 -1
- package/dev-server/connector.html +2 -2
- package/dev-server/index.js +1 -1
- package/dev-server/package.json +1 -1
- package/dev-server/server-process.js +6 -5
- package/dev-server/ws.js +1 -1
- package/internal/app-data/package.json +1 -1
- package/internal/client/css-shim.js +1 -1
- package/internal/client/dom.js +1 -1
- package/internal/client/index.js +108 -5
- package/internal/client/package.json +1 -1
- package/internal/client/patch-browser.js +19 -1
- package/internal/client/patch-esm.js +1 -1
- package/internal/client/shadow-css.js +1 -1
- package/internal/hydrate/index.js +48 -37
- package/internal/hydrate/package.json +1 -1
- package/internal/hydrate/runner.d.ts +16 -15
- package/internal/hydrate/runner.js +4 -2
- package/internal/package.json +1 -1
- package/internal/stencil-core/index.d.ts +1 -0
- package/internal/stencil-private.d.ts +10 -0
- package/internal/stencil-public-compiler.d.ts +12 -18
- package/internal/stencil-public-runtime.d.ts +20 -0
- package/internal/testing/index.js +53 -41
- package/internal/testing/package.json +1 -1
- package/mock-doc/index.cjs +1 -1
- package/mock-doc/index.js +1 -1
- package/mock-doc/package.json +1 -1
- package/package.json +7 -7
- package/screenshot/package.json +1 -1
- package/sys/node/glob.js +1 -1
- package/sys/node/index.js +1 -1
- package/sys/node/package.json +1 -1
- package/sys/node/worker.js +1 -1
- package/testing/index.js +72 -66
- package/testing/package.json +1 -1
package/testing/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
Stencil Testing v3.0.0-
|
|
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
|
-
|
|
128
|
-
|
|
129
|
-
|
|
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:
|
|
135
|
-
|
|
136
|
-
lines: []
|
|
138
|
+
relFilePath: void 0,
|
|
139
|
+
type: "typescript"
|
|
137
140
|
};
|
|
138
|
-
if (1 === e.category && (
|
|
139
|
-
|
|
140
|
-
const
|
|
141
|
-
lineIndex:
|
|
142
|
-
lineNumber:
|
|
143
|
-
text:
|
|
144
|
-
errorCharStart:
|
|
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 (
|
|
148
|
-
0 ===
|
|
149
|
-
|
|
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:
|
|
152
|
-
lineNumber:
|
|
153
|
-
text:
|
|
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
|
-
|
|
160
|
+
r.lines.unshift(e);
|
|
158
161
|
}
|
|
159
|
-
if (
|
|
162
|
+
if (o.lineIndex + 1 < n.length) {
|
|
160
163
|
const e = {
|
|
161
|
-
lineIndex:
|
|
162
|
-
lineNumber:
|
|
163
|
-
text:
|
|
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
|
-
|
|
170
|
+
r.lines.push(e);
|
|
168
171
|
}
|
|
169
172
|
}
|
|
170
|
-
var
|
|
171
|
-
return
|
|
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-
|
|
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
|
-
|
|
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(
|
|
4174
|
-
e.
|
|
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
|
|
4184
|
+
const r = new Set;
|
|
4179
4185
|
testing.win.__stencil_spec_options = e;
|
|
4180
|
-
const
|
|
4186
|
+
const s = testing.win.document, n = {
|
|
4181
4187
|
win: testing.win,
|
|
4182
|
-
doc:
|
|
4183
|
-
body:
|
|
4188
|
+
doc: s,
|
|
4189
|
+
body: s.body,
|
|
4184
4190
|
build: appData.BUILD,
|
|
4185
4191
|
styles: testing.styles,
|
|
4186
|
-
setContent: e => (
|
|
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
|
-
},
|
|
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
|
-
|
|
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
|
-
})),
|
|
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,
|
|
4291
|
-
!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 && (
|
|
4296
|
-
"string" == typeof e.direction &&
|
|
4297
|
-
"string" == typeof 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
|
-
|
|
4305
|
+
n.doc.cookie = e.cookie;
|
|
4300
4306
|
} catch (e) {}
|
|
4301
4307
|
if ("string" == typeof e.referrer) try {
|
|
4302
|
-
|
|
4308
|
+
n.doc.referrer = e.referrer;
|
|
4303
4309
|
} catch (e) {}
|
|
4304
4310
|
if ("string" == typeof e.userAgent) try {
|
|
4305
|
-
|
|
4311
|
+
n.win.navigator.userAgent = e.userAgent;
|
|
4306
4312
|
} catch (e) {}
|
|
4307
|
-
if (testing.bootstrapLazy(
|
|
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$:
|
|
4322
|
+
$hostElement$: n.body
|
|
4317
4323
|
};
|
|
4318
4324
|
testing.renderVdom(t, e.template());
|
|
4319
|
-
} else "string" == typeof e.html && (
|
|
4320
|
-
!1 !== e.flushQueue && await
|
|
4321
|
-
let
|
|
4322
|
-
return Object.defineProperty(
|
|
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 ==
|
|
4325
|
-
const e =
|
|
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(
|
|
4334
|
+
}), Object.defineProperty(n, "rootInstance", {
|
|
4329
4335
|
get() {
|
|
4330
|
-
const e = testing.getHostRef(
|
|
4336
|
+
const e = testing.getHostRef(n.root);
|
|
4331
4337
|
return null != e ? e.$lazyInstance$ : null;
|
|
4332
4338
|
}
|
|
4333
|
-
}), e.hydrateServerSide && testing.insertVdomAnnotations(
|
|
4334
|
-
|
|
4335
|
-
Promise.resolve())),
|
|
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],
|