@stencil/core 2.16.0 → 2.17.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.
- package/cli/index.cjs +124 -16
- package/cli/index.js +124 -16
- package/cli/package.json +1 -1
- package/compiler/package.json +1 -1
- package/compiler/stencil.js +728 -263
- 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 +3 -3
- package/dev-server/index.js +1 -1
- package/dev-server/package.json +1 -1
- package/dev-server/server-process.js +4 -2
- 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 +1 -1
- package/internal/client/package.json +1 -1
- package/internal/client/patch-browser.js +1 -1
- package/internal/client/patch-esm.js +1 -1
- package/internal/client/shadow-css.js +1 -1
- package/internal/hydrate/index.js +3 -3
- package/internal/hydrate/package.json +1 -1
- package/internal/package.json +1 -1
- package/internal/stencil-private.d.ts +4 -0
- package/internal/stencil-public-compiler.d.ts +3 -2
- package/internal/testing/index.js +1 -1
- package/internal/testing/package.json +1 -1
- package/mock-doc/index.cjs +142 -5
- package/mock-doc/index.d.ts +77 -1
- package/mock-doc/index.js +142 -5
- package/mock-doc/package.json +1 -1
- package/package.json +2 -1
- package/screenshot/index.js +2 -0
- package/screenshot/package.json +1 -1
- package/sys/node/index.js +325 -314
- package/sys/node/package.json +1 -1
- package/sys/node/worker.js +1 -1
- package/testing/index.d.ts +1 -1
- package/testing/index.js +105 -62
- package/testing/mocks.d.ts +22 -2
- package/testing/package.json +1 -1
package/sys/node/package.json
CHANGED
package/sys/node/worker.js
CHANGED
package/testing/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ export { createTesting } from './testing';
|
|
|
3
3
|
export { createTestRunner } from './jest/jest-runner';
|
|
4
4
|
export { jestPreprocessor } from './jest/jest-preprocessor';
|
|
5
5
|
export { jestSetupTestFramework } from './jest/jest-setup-test-framework';
|
|
6
|
-
export { mockBuildCtx, mockConfig, mockCompilerCtx, mockDocument, mockLogger,
|
|
6
|
+
export { mockBuildCtx, mockConfig, mockCompilerCtx, mockDocument, mockLogger, mockCompilerSystem, mockWindow, mockModule, } from './mocks';
|
|
7
7
|
export { MockHeaders, MockRequest, MockRequestInit, MockRequestInfo, MockResponse, MockResponseInit, mockFetch, } from './mock-fetch';
|
|
8
8
|
export { newSpecPage } from './spec-page';
|
|
9
9
|
export { shuffleArray } from './testing-utils';
|
package/testing/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
Stencil Testing v2.
|
|
2
|
+
Stencil Testing v2.17.0 | MIT Licensed | https://stenciljs.com
|
|
3
3
|
*/
|
|
4
4
|
function _lazyRequire(e) {
|
|
5
5
|
return new Proxy({}, {
|
|
@@ -476,7 +476,11 @@ function mockConfig(e) {
|
|
|
476
476
|
nodeResolve: {
|
|
477
477
|
customResolveOptions: {}
|
|
478
478
|
},
|
|
479
|
-
sourceMap: !0
|
|
479
|
+
sourceMap: !0,
|
|
480
|
+
rollupPlugins: {
|
|
481
|
+
before: [],
|
|
482
|
+
after: []
|
|
483
|
+
}
|
|
480
484
|
};
|
|
481
485
|
}
|
|
482
486
|
|
|
@@ -499,7 +503,7 @@ function mockCompilerCtx(e) {
|
|
|
499
503
|
compilerOptions: null,
|
|
500
504
|
cache: null,
|
|
501
505
|
cssModuleImports: new Map,
|
|
502
|
-
events:
|
|
506
|
+
events: buildEvents(),
|
|
503
507
|
fs: null,
|
|
504
508
|
hasSuccessfulBuild: !1,
|
|
505
509
|
isActivelyBuilding: !1,
|
|
@@ -1237,7 +1241,7 @@ const path$2 = require("path"), index_js = _lazyRequire("../dev-server/index.js"
|
|
|
1237
1241
|
return t;
|
|
1238
1242
|
}, trimFalsy = e => {
|
|
1239
1243
|
const t = e;
|
|
1240
|
-
for (
|
|
1244
|
+
for (let e = t.length - 1; e >= 0 && !t[e]; e--) t.pop();
|
|
1241
1245
|
return t;
|
|
1242
1246
|
}, noop = () => {}, isFunction = e => "function" == typeof e, isString = e => "string" == typeof e, isIterable = e => (e => null != e)(e) && isFunction(e[Symbol.iterator]), windowsPathRegex = /^(?:[a-zA-Z]:|[\\/]{2}[^\\/]+[\\/]+[^\\/]+)?[\\/]$/, hasError = e => null != e && 0 !== e.length && e.some((e => "error" === e.level && "runtime" !== e.type)), normalizePath = e => {
|
|
1243
1247
|
if ("string" != typeof e) throw new Error("invalid path to normalize");
|
|
@@ -1351,22 +1355,26 @@ const jestPreprocessor = {
|
|
|
1351
1355
|
return [ process.version, _tsCompilerOptionsKey, e, t, r, !!s.instrument, 7 ].join(":");
|
|
1352
1356
|
}
|
|
1353
1357
|
}, deepEqual = function e(t, r) {
|
|
1354
|
-
var s, n, o, i, a, l, c, u, d, h;
|
|
1355
1358
|
if (t === r) return !0;
|
|
1356
1359
|
if (t && r && "object" == typeof t && "object" == typeof r) {
|
|
1357
|
-
|
|
1358
|
-
|
|
1360
|
+
const s = Array.isArray(t), n = Array.isArray(r);
|
|
1361
|
+
let o, i, a;
|
|
1362
|
+
if (s && n) {
|
|
1363
|
+
if (i = t.length, i != r.length) return !1;
|
|
1359
1364
|
for (o = i; 0 != o--; ) if (!e(t[o], r[o])) return !1;
|
|
1360
1365
|
return !0;
|
|
1361
1366
|
}
|
|
1362
1367
|
if (s != n) return !1;
|
|
1363
|
-
|
|
1368
|
+
const l = t instanceof Date, c = r instanceof Date;
|
|
1369
|
+
if (l != c) return !1;
|
|
1364
1370
|
if (l && c) return t.getTime() == r.getTime();
|
|
1365
|
-
|
|
1371
|
+
const u = t instanceof RegExp, d = r instanceof RegExp;
|
|
1372
|
+
if (u != d) return !1;
|
|
1366
1373
|
if (u && d) return t.toString() == r.toString();
|
|
1367
|
-
|
|
1374
|
+
const h = Object.keys(t);
|
|
1375
|
+
if (i = h.length, i !== Object.keys(r).length) return !1;
|
|
1368
1376
|
for (o = i; 0 != o--; ) if (!Object.prototype.hasOwnProperty.call(r, h[o])) return !1;
|
|
1369
|
-
for (o = i; 0 != o--; ) if (
|
|
1377
|
+
for (o = i; 0 != o--; ) if (a = h[o], !e(t[a], r[a])) return !1;
|
|
1370
1378
|
return !0;
|
|
1371
1379
|
}
|
|
1372
1380
|
return t != t && r != r;
|
|
@@ -2083,7 +2091,46 @@ const MAX_FAILED = 100, ONE_DAY = 864e5, ONE_WEEK = 7 * ONE_DAY, EXP_STORAGE_KEY
|
|
|
2083
2091
|
posix: null
|
|
2084
2092
|
}).posix = posix, pathBrowserify = posix;
|
|
2085
2093
|
|
|
2086
|
-
const
|
|
2094
|
+
const buildEvents = () => {
|
|
2095
|
+
const e = [], t = t => {
|
|
2096
|
+
const r = e.findIndex((e => e.callback === t));
|
|
2097
|
+
return r > -1 && (e.splice(r, 1), !0);
|
|
2098
|
+
};
|
|
2099
|
+
return {
|
|
2100
|
+
emit: (t, r) => {
|
|
2101
|
+
const s = t.toLowerCase().trim(), n = e.slice();
|
|
2102
|
+
for (const e of n) if (null == e.eventName) try {
|
|
2103
|
+
e.callback(t, r);
|
|
2104
|
+
} catch (e) {
|
|
2105
|
+
console.error(e);
|
|
2106
|
+
} else if (e.eventName === s) try {
|
|
2107
|
+
e.callback(r);
|
|
2108
|
+
} catch (e) {
|
|
2109
|
+
console.error(e);
|
|
2110
|
+
}
|
|
2111
|
+
},
|
|
2112
|
+
on: (r, s) => {
|
|
2113
|
+
if ("function" == typeof r) {
|
|
2114
|
+
const s = null, n = r;
|
|
2115
|
+
return e.push({
|
|
2116
|
+
eventName: s,
|
|
2117
|
+
callback: n
|
|
2118
|
+
}), () => t(n);
|
|
2119
|
+
}
|
|
2120
|
+
if ("string" == typeof r && "function" == typeof s) {
|
|
2121
|
+
const n = r.toLowerCase().trim(), o = s;
|
|
2122
|
+
return e.push({
|
|
2123
|
+
eventName: n,
|
|
2124
|
+
callback: o
|
|
2125
|
+
}), () => t(o);
|
|
2126
|
+
}
|
|
2127
|
+
return () => !1;
|
|
2128
|
+
},
|
|
2129
|
+
unsubscribeAll: () => {
|
|
2130
|
+
e.length = 0;
|
|
2131
|
+
}
|
|
2132
|
+
};
|
|
2133
|
+
}, IS_NODE_ENV = !("undefined" == typeof global || "function" != typeof require || !global.process || "string" != typeof __filename || global.origin && "string" == typeof global.origin);
|
|
2087
2134
|
|
|
2088
2135
|
IS_NODE_ENV && process.platform;
|
|
2089
2136
|
|
|
@@ -2697,46 +2744,7 @@ const createSystem = e => {
|
|
|
2697
2744
|
})(t, e)));
|
|
2698
2745
|
}
|
|
2699
2746
|
};
|
|
2700
|
-
})(), r = new Map, s = new Set, n = e => s.add(e), o = e => s.delete(e), i = (
|
|
2701
|
-
const e = [], t = t => {
|
|
2702
|
-
const r = e.findIndex((e => e.callback === t));
|
|
2703
|
-
return r > -1 && (e.splice(r, 1), !0);
|
|
2704
|
-
};
|
|
2705
|
-
return {
|
|
2706
|
-
emit: (t, r) => {
|
|
2707
|
-
const s = t.toLowerCase().trim(), n = e.slice();
|
|
2708
|
-
for (const e of n) if (null == e.eventName) try {
|
|
2709
|
-
e.callback(t, r);
|
|
2710
|
-
} catch (e) {
|
|
2711
|
-
console.error(e);
|
|
2712
|
-
} else if (e.eventName === s) try {
|
|
2713
|
-
e.callback(r);
|
|
2714
|
-
} catch (e) {
|
|
2715
|
-
console.error(e);
|
|
2716
|
-
}
|
|
2717
|
-
},
|
|
2718
|
-
on: (r, s) => {
|
|
2719
|
-
if ("function" == typeof r) {
|
|
2720
|
-
const s = null, n = r;
|
|
2721
|
-
return e.push({
|
|
2722
|
-
eventName: s,
|
|
2723
|
-
callback: n
|
|
2724
|
-
}), () => t(n);
|
|
2725
|
-
}
|
|
2726
|
-
if ("string" == typeof r && "function" == typeof s) {
|
|
2727
|
-
const n = r.toLowerCase().trim(), o = s;
|
|
2728
|
-
return e.push({
|
|
2729
|
-
eventName: n,
|
|
2730
|
-
callback: o
|
|
2731
|
-
}), () => t(o);
|
|
2732
|
-
}
|
|
2733
|
-
return () => !1;
|
|
2734
|
-
},
|
|
2735
|
-
unsubscribeAll: () => {
|
|
2736
|
-
e.length = 0;
|
|
2737
|
-
}
|
|
2738
|
-
};
|
|
2739
|
-
})(), a = IS_BROWSER_ENV && navigator.hardwareConcurrency || 1, l = e => {
|
|
2747
|
+
})(), r = new Map, s = new Set, n = e => s.add(e), o = e => s.delete(e), i = buildEvents(), a = IS_BROWSER_ENV && navigator.hardwareConcurrency || 1, l = e => {
|
|
2740
2748
|
if ("/" === e || "" === e) return "/";
|
|
2741
2749
|
const t = path$2.dirname(e), r = path$2.basename(e);
|
|
2742
2750
|
return t.endsWith("/") ? normalizePath(`${t}${r}`) : normalizePath(`${t}/${r}`);
|
|
@@ -2882,7 +2890,7 @@ const createSystem = e => {
|
|
|
2882
2890
|
u("/");
|
|
2883
2891
|
const S = {
|
|
2884
2892
|
name: "in-memory",
|
|
2885
|
-
version: "2.
|
|
2893
|
+
version: "2.17.0",
|
|
2886
2894
|
events: i,
|
|
2887
2895
|
access: async e => c(e),
|
|
2888
2896
|
accessSync: c,
|
|
@@ -3170,7 +3178,8 @@ const createSystem = e => {
|
|
|
3170
3178
|
r.readDirSync = s(r.readDirSync), r.stat = s(r.stat), r.statSync = s(r.statSync),
|
|
3171
3179
|
r.copyFile = n(r.copyFile), r.createDir = n(r.createDir), r.createDirSync = n(r.createDirSync),
|
|
3172
3180
|
r.removeFile = n(r.removeFile), r.removeFileSync = n(r.removeFileSync), r.writeFile = n(r.writeFile),
|
|
3173
|
-
r.writeFileSync = n(r.writeFileSync),
|
|
3181
|
+
r.writeFileSync = n(r.writeFileSync), r.getCompilerExecutingPath = () => "bin/stencil.js",
|
|
3182
|
+
Object.defineProperties(r, {
|
|
3174
3183
|
diskReads: {
|
|
3175
3184
|
get: () => e,
|
|
3176
3185
|
set(t) {
|
|
@@ -3202,16 +3211,16 @@ class TestingLogger {
|
|
|
3202
3211
|
return "";
|
|
3203
3212
|
}
|
|
3204
3213
|
info(...e) {
|
|
3205
|
-
this.isEnabled && console.log
|
|
3214
|
+
this.isEnabled && console.log(...e);
|
|
3206
3215
|
}
|
|
3207
3216
|
warn(...e) {
|
|
3208
|
-
this.isEnabled && console.warn
|
|
3217
|
+
this.isEnabled && console.warn(...e);
|
|
3209
3218
|
}
|
|
3210
3219
|
error(...e) {
|
|
3211
|
-
this.isEnabled && console.error
|
|
3220
|
+
this.isEnabled && console.error(...e);
|
|
3212
3221
|
}
|
|
3213
3222
|
debug(...e) {
|
|
3214
|
-
this.isEnabled && console.log
|
|
3223
|
+
this.isEnabled && console.log(...e);
|
|
3215
3224
|
}
|
|
3216
3225
|
color(e, t) {}
|
|
3217
3226
|
red(e) {
|
|
@@ -3773,13 +3782,47 @@ exports.createJestPuppeteerEnvironment = function createJestPuppeteerEnvironment
|
|
|
3773
3782
|
}
|
|
3774
3783
|
}, exports.mockBuildCtx = function mockBuildCtx(e, t) {
|
|
3775
3784
|
return e || (e = mockConfig()), t || (t = mockCompilerCtx(e)), new BuildContext(e, t);
|
|
3776
|
-
}, exports.mockCompilerCtx = mockCompilerCtx, exports.
|
|
3785
|
+
}, exports.mockCompilerCtx = mockCompilerCtx, exports.mockCompilerSystem = function mockCompilerSystem() {
|
|
3786
|
+
return createTestingSystem();
|
|
3787
|
+
}, exports.mockConfig = mockConfig, exports.mockDocument = function mockDocument(e = null) {
|
|
3777
3788
|
return new index_cjs.MockWindow(e).document;
|
|
3778
3789
|
}, exports.mockFetch = mockFetch, exports.mockLogger = function mockLogger() {
|
|
3779
3790
|
return new TestingLogger;
|
|
3780
|
-
}, exports.
|
|
3781
|
-
|
|
3782
|
-
|
|
3791
|
+
}, exports.mockModule = (e = {}) => ({
|
|
3792
|
+
cmps: [],
|
|
3793
|
+
coreRuntimeApis: [],
|
|
3794
|
+
collectionName: "",
|
|
3795
|
+
dtsFilePath: "",
|
|
3796
|
+
excludeFromCollection: !1,
|
|
3797
|
+
externalImports: [],
|
|
3798
|
+
htmlAttrNames: [],
|
|
3799
|
+
htmlTagNames: [],
|
|
3800
|
+
htmlParts: [],
|
|
3801
|
+
isCollectionDependency: !1,
|
|
3802
|
+
isLegacy: !1,
|
|
3803
|
+
jsFilePath: "",
|
|
3804
|
+
localImports: [],
|
|
3805
|
+
originalImports: [],
|
|
3806
|
+
originalCollectionComponentPath: "",
|
|
3807
|
+
potentialCmpRefs: [],
|
|
3808
|
+
sourceFilePath: "",
|
|
3809
|
+
staticSourceFile: "",
|
|
3810
|
+
staticSourceFileText: "",
|
|
3811
|
+
sourceMapPath: "",
|
|
3812
|
+
sourceMapFileText: "",
|
|
3813
|
+
hasVdomAttribute: !1,
|
|
3814
|
+
hasVdomClass: !1,
|
|
3815
|
+
hasVdomFunctional: !1,
|
|
3816
|
+
hasVdomKey: !1,
|
|
3817
|
+
hasVdomListener: !1,
|
|
3818
|
+
hasVdomPropOrAttr: !1,
|
|
3819
|
+
hasVdomRef: !1,
|
|
3820
|
+
hasVdomRender: !1,
|
|
3821
|
+
hasVdomStyle: !1,
|
|
3822
|
+
hasVdomText: !1,
|
|
3823
|
+
hasVdomXlink: !1,
|
|
3824
|
+
...e
|
|
3825
|
+
}), exports.mockWindow = function mockWindow(e = null) {
|
|
3783
3826
|
return new index_cjs.MockWindow(e);
|
|
3784
3827
|
}, exports.newE2EPage = async function newE2EPage(e = {}) {
|
|
3785
3828
|
if (!global.__NEW_TEST_PAGE__) throw new Error("newE2EPage() is only available from E2E tests, and ran with the --e2e cmd line flag.");
|
package/testing/mocks.d.ts
CHANGED
|
@@ -1,10 +1,30 @@
|
|
|
1
|
-
import type { BuildCtx, Cache, CompilerCtx, CompilerSystem, Config } from '@stencil/core/internal';
|
|
1
|
+
import type { BuildCtx, Cache, CompilerCtx, CompilerSystem, Config, Module } from '@stencil/core/internal';
|
|
2
|
+
import { TestingSystem } from './testing-sys';
|
|
2
3
|
import { TestingLogger } from './testing-logger';
|
|
3
4
|
export declare function mockConfig(sys?: CompilerSystem): Config;
|
|
4
5
|
export declare function mockCompilerCtx(config?: Config): CompilerCtx;
|
|
5
6
|
export declare function mockBuildCtx(config?: Config, compilerCtx?: CompilerCtx): BuildCtx;
|
|
6
7
|
export declare function mockCache(config?: Config, compilerCtx?: CompilerCtx): Cache;
|
|
7
8
|
export declare function mockLogger(): TestingLogger;
|
|
8
|
-
|
|
9
|
+
/**
|
|
10
|
+
* Create a {@link CompilerSystem} entity for testing the compiler.
|
|
11
|
+
*
|
|
12
|
+
* This function acts as a thin wrapper around a {@link TestingSystem} entity creation. It exists to provide a logical
|
|
13
|
+
* place in the codebase where we might expect Stencil engineers to reach for when attempting to mock a
|
|
14
|
+
* {@link CompilerSystem} base type. Should there prove to be usage of both this function and the one it wraps,
|
|
15
|
+
* reconsider if this wrapper is necessary.
|
|
16
|
+
*
|
|
17
|
+
* @returns a System instance for testing purposes.
|
|
18
|
+
*/
|
|
19
|
+
export declare function mockCompilerSystem(): TestingSystem;
|
|
9
20
|
export declare function mockDocument(html?: string): Document;
|
|
10
21
|
export declare function mockWindow(html?: string): Window;
|
|
22
|
+
/**
|
|
23
|
+
* This gives you a mock Module, an interface which is the internal compiler
|
|
24
|
+
* representation of a module. It includes a bunch of information necessary for
|
|
25
|
+
* compilation, this mock basically sets sane defaults for all those values.
|
|
26
|
+
*
|
|
27
|
+
* @param mod is an override module that you can supply to set particular values
|
|
28
|
+
* @returns a module object ready to use in tests!
|
|
29
|
+
*/
|
|
30
|
+
export declare const mockModule: (mod?: Partial<Module>) => Module;
|