@rindo/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 +122 -16
- package/cli/index.js +122 -16
- package/cli/package.json +1 -1
- package/compiler/package.json +1 -1
- package/compiler/rindo.js +728 -263
- package/compiler/rindo.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/rindo-private.d.ts +4 -0
- package/internal/rindo-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 +3 -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
|
-
Rindo Testing v2.
|
|
2
|
+
Rindo Testing v2.17.0 | MIT Licensed | https://rindojs.web.app
|
|
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
|
|
|
@@ -2848,46 +2895,7 @@ const createSystem = e => {
|
|
|
2848
2895
|
})(t, e)));
|
|
2849
2896
|
}
|
|
2850
2897
|
};
|
|
2851
|
-
})(), r = new Map, s = new Set, n = e => s.add(e), o = e => s.delete(e), i = (
|
|
2852
|
-
const e = [], t = t => {
|
|
2853
|
-
const r = e.findIndex((e => e.callback === t));
|
|
2854
|
-
return r > -1 && (e.splice(r, 1), !0);
|
|
2855
|
-
};
|
|
2856
|
-
return {
|
|
2857
|
-
emit: (t, r) => {
|
|
2858
|
-
const s = t.toLowerCase().trim(), n = e.slice();
|
|
2859
|
-
for (const e of n) if (null == e.eventName) try {
|
|
2860
|
-
e.callback(t, r);
|
|
2861
|
-
} catch (e) {
|
|
2862
|
-
console.error(e);
|
|
2863
|
-
} else if (e.eventName === s) try {
|
|
2864
|
-
e.callback(r);
|
|
2865
|
-
} catch (e) {
|
|
2866
|
-
console.error(e);
|
|
2867
|
-
}
|
|
2868
|
-
},
|
|
2869
|
-
on: (r, s) => {
|
|
2870
|
-
if ("function" == typeof r) {
|
|
2871
|
-
const s = null, n = r;
|
|
2872
|
-
return e.push({
|
|
2873
|
-
eventName: s,
|
|
2874
|
-
callback: n
|
|
2875
|
-
}), () => t(n);
|
|
2876
|
-
}
|
|
2877
|
-
if ("string" == typeof r && "function" == typeof s) {
|
|
2878
|
-
const n = r.toLowerCase().trim(), o = s;
|
|
2879
|
-
return e.push({
|
|
2880
|
-
eventName: n,
|
|
2881
|
-
callback: o
|
|
2882
|
-
}), () => t(o);
|
|
2883
|
-
}
|
|
2884
|
-
return () => !1;
|
|
2885
|
-
},
|
|
2886
|
-
unsubscribeAll: () => {
|
|
2887
|
-
e.length = 0;
|
|
2888
|
-
}
|
|
2889
|
-
};
|
|
2890
|
-
})(), a = IS_BROWSER_ENV && navigator.hardwareConcurrency || 1, l = e => {
|
|
2898
|
+
})(), 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 => {
|
|
2891
2899
|
if ("/" === e || "" === e) return "/";
|
|
2892
2900
|
const t = path$2.dirname(e), r = path$2.basename(e);
|
|
2893
2901
|
return t.endsWith("/") ? normalizePath(`${t}${r}`) : normalizePath(`${t}/${r}`);
|
|
@@ -3033,7 +3041,7 @@ const createSystem = e => {
|
|
|
3033
3041
|
u("/");
|
|
3034
3042
|
const D = {
|
|
3035
3043
|
name: "in-memory",
|
|
3036
|
-
version: "2.
|
|
3044
|
+
version: "2.17.0",
|
|
3037
3045
|
events: i,
|
|
3038
3046
|
access: async e => c(e),
|
|
3039
3047
|
accessSync: c,
|
|
@@ -3321,7 +3329,8 @@ const createSystem = e => {
|
|
|
3321
3329
|
r.readDirSync = s(r.readDirSync), r.stat = s(r.stat), r.statSync = s(r.statSync),
|
|
3322
3330
|
r.copyFile = n(r.copyFile), r.createDir = n(r.createDir), r.createDirSync = n(r.createDirSync),
|
|
3323
3331
|
r.removeFile = n(r.removeFile), r.removeFileSync = n(r.removeFileSync), r.writeFile = n(r.writeFile),
|
|
3324
|
-
r.writeFileSync = n(r.writeFileSync),
|
|
3332
|
+
r.writeFileSync = n(r.writeFileSync), r.getCompilerExecutingPath = () => "bin/rindo.js",
|
|
3333
|
+
Object.defineProperties(r, {
|
|
3325
3334
|
diskReads: {
|
|
3326
3335
|
get: () => e,
|
|
3327
3336
|
set(t) {
|
|
@@ -3353,16 +3362,16 @@ class TestingLogger {
|
|
|
3353
3362
|
return "";
|
|
3354
3363
|
}
|
|
3355
3364
|
info(...e) {
|
|
3356
|
-
this.isEnabled && console.log
|
|
3365
|
+
this.isEnabled && console.log(...e);
|
|
3357
3366
|
}
|
|
3358
3367
|
warn(...e) {
|
|
3359
|
-
this.isEnabled && console.warn
|
|
3368
|
+
this.isEnabled && console.warn(...e);
|
|
3360
3369
|
}
|
|
3361
3370
|
error(...e) {
|
|
3362
|
-
this.isEnabled && console.error
|
|
3371
|
+
this.isEnabled && console.error(...e);
|
|
3363
3372
|
}
|
|
3364
3373
|
debug(...e) {
|
|
3365
|
-
this.isEnabled && console.log
|
|
3374
|
+
this.isEnabled && console.log(...e);
|
|
3366
3375
|
}
|
|
3367
3376
|
color(e, t) {}
|
|
3368
3377
|
red(e) {
|
|
@@ -3924,13 +3933,47 @@ exports.createJestPuppeteerEnvironment = function createJestPuppeteerEnvironment
|
|
|
3924
3933
|
}
|
|
3925
3934
|
}, exports.mockBuildCtx = function mockBuildCtx(e, t) {
|
|
3926
3935
|
return e || (e = mockConfig()), t || (t = mockCompilerCtx(e)), new BuildContext(e, t);
|
|
3927
|
-
}, exports.mockCompilerCtx = mockCompilerCtx, exports.
|
|
3936
|
+
}, exports.mockCompilerCtx = mockCompilerCtx, exports.mockCompilerSystem = function mockCompilerSystem() {
|
|
3937
|
+
return createTestingSystem();
|
|
3938
|
+
}, exports.mockConfig = mockConfig, exports.mockDocument = function mockDocument(e = null) {
|
|
3928
3939
|
return new index_cjs.MockWindow(e).document;
|
|
3929
3940
|
}, exports.mockFetch = mockFetch, exports.mockLogger = function mockLogger() {
|
|
3930
3941
|
return new TestingLogger;
|
|
3931
|
-
}, exports.
|
|
3932
|
-
|
|
3933
|
-
|
|
3942
|
+
}, exports.mockModule = (e = {}) => ({
|
|
3943
|
+
cmps: [],
|
|
3944
|
+
coreRuntimeApis: [],
|
|
3945
|
+
collectionName: "",
|
|
3946
|
+
dtsFilePath: "",
|
|
3947
|
+
excludeFromCollection: !1,
|
|
3948
|
+
externalImports: [],
|
|
3949
|
+
htmlAttrNames: [],
|
|
3950
|
+
htmlTagNames: [],
|
|
3951
|
+
htmlParts: [],
|
|
3952
|
+
isCollectionDependency: !1,
|
|
3953
|
+
isLegacy: !1,
|
|
3954
|
+
jsFilePath: "",
|
|
3955
|
+
localImports: [],
|
|
3956
|
+
originalImports: [],
|
|
3957
|
+
originalCollectionComponentPath: "",
|
|
3958
|
+
potentialCmpRefs: [],
|
|
3959
|
+
sourceFilePath: "",
|
|
3960
|
+
staticSourceFile: "",
|
|
3961
|
+
staticSourceFileText: "",
|
|
3962
|
+
sourceMapPath: "",
|
|
3963
|
+
sourceMapFileText: "",
|
|
3964
|
+
hasVdomAttribute: !1,
|
|
3965
|
+
hasVdomClass: !1,
|
|
3966
|
+
hasVdomFunctional: !1,
|
|
3967
|
+
hasVdomKey: !1,
|
|
3968
|
+
hasVdomListener: !1,
|
|
3969
|
+
hasVdomPropOrAttr: !1,
|
|
3970
|
+
hasVdomRef: !1,
|
|
3971
|
+
hasVdomRender: !1,
|
|
3972
|
+
hasVdomStyle: !1,
|
|
3973
|
+
hasVdomText: !1,
|
|
3974
|
+
hasVdomXlink: !1,
|
|
3975
|
+
...e
|
|
3976
|
+
}), exports.mockWindow = function mockWindow(e = null) {
|
|
3934
3977
|
return new index_cjs.MockWindow(e);
|
|
3935
3978
|
}, exports.newE2EPage = async function newE2EPage(e = {}) {
|
|
3936
3979
|
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 '@rindo/core/internal';
|
|
1
|
+
import type { BuildCtx, Cache, CompilerCtx, CompilerSystem, Config, Module } from '@rindo/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 Rindo 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;
|