@rindo/core 2.17.4 → 2.18.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 +98 -35
- package/cli/index.js +98 -35
- package/cli/package.json +1 -1
- package/compiler/lib.dom.d.ts +620 -89
- package/compiler/lib.dom.iterable.d.ts +27 -3
- package/compiler/lib.es2015.core.d.ts +3 -3
- package/compiler/lib.es2015.iterable.d.ts +2 -1
- package/compiler/lib.es2015.reflect.d.ts +1 -1
- package/compiler/lib.es2020.bigint.d.ts +7 -5
- package/compiler/lib.es2020.d.ts +2 -0
- package/compiler/lib.es2020.date.d.ts +44 -0
- package/compiler/lib.es2020.intl.d.ts +51 -11
- package/compiler/lib.es2020.number.d.ts +30 -0
- package/compiler/lib.es2021.intl.d.ts +106 -4
- package/compiler/lib.es2022.array.d.ts +123 -0
- package/compiler/lib.es2022.d.ts +26 -0
- package/compiler/lib.es2022.error.d.ts +75 -0
- package/compiler/lib.es2022.full.d.ts +25 -0
- package/compiler/lib.es2022.intl.d.ts +111 -0
- package/compiler/lib.es2022.object.d.ts +28 -0
- package/compiler/lib.es2022.string.d.ts +27 -0
- package/compiler/lib.es5.d.ts +25 -19
- package/compiler/lib.esnext.d.ts +1 -1
- package/compiler/lib.esnext.intl.d.ts +4 -1
- package/compiler/lib.webworker.d.ts +236 -40
- package/compiler/lib.webworker.iterable.d.ts +10 -3
- package/compiler/package.json +1 -1
- package/compiler/rindo.js +805 -931
- package/compiler/rindo.min.js +2 -2
- package/compiler/sys/in-memory-fs.d.ts +218 -0
- package/dependencies.json +10 -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 +12 -12
- 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 +338 -158
- 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/package.json +1 -1
- package/internal/hydrate/runner.d.ts +1 -1
- package/internal/package.json +1 -1
- package/internal/rindo-private.d.ts +2 -106
- package/internal/rindo-public-compiler.d.ts +44 -10
- package/internal/testing/package.json +1 -1
- package/mock-doc/index.cjs +77 -62
- package/mock-doc/index.d.ts +13 -12
- package/mock-doc/index.js +77 -62
- package/mock-doc/package.json +1 -1
- package/package.json +10 -12
- package/readme.md +44 -31
- package/screenshot/compare/build/p-f4745c2f.entry.js +1 -1
- package/screenshot/index.js +10 -10
- package/screenshot/package.json +1 -1
- package/sys/node/autoprefixer.js +5 -5
- package/sys/node/glob.js +1 -1
- package/sys/node/graceful-fs.js +1 -1
- package/sys/node/index.js +2 -2
- package/sys/node/package.json +1 -1
- package/sys/node/worker.js +1 -1
- package/testing/index.js +130 -295
- package/testing/package.json +1 -1
- package/testing/testing-utils.d.ts +5 -4
package/cli/index.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
Rindo CLI (CommonJS) v2.
|
|
2
|
+
Rindo CLI (CommonJS) v2.18.1 | MIT Licensed | https://rindojs.web.app
|
|
3
3
|
*/
|
|
4
4
|
'use strict';
|
|
5
5
|
|
|
@@ -223,18 +223,18 @@ const getEncodedRootLength = (path) => {
|
|
|
223
223
|
return 0;
|
|
224
224
|
const ch0 = path.charCodeAt(0);
|
|
225
225
|
// POSIX or UNC
|
|
226
|
-
if (ch0 === 47 /* slash */ || ch0 === 92 /* backslash */) {
|
|
226
|
+
if (ch0 === 47 /* CharacterCodes.slash */ || ch0 === 92 /* CharacterCodes.backslash */) {
|
|
227
227
|
if (path.charCodeAt(1) !== ch0)
|
|
228
228
|
return 1; // POSIX: "/" (or non-normalized "\")
|
|
229
|
-
const p1 = path.indexOf(ch0 === 47 /* slash */ ? '/' : altDirectorySeparator, 2);
|
|
229
|
+
const p1 = path.indexOf(ch0 === 47 /* CharacterCodes.slash */ ? '/' : altDirectorySeparator, 2);
|
|
230
230
|
if (p1 < 0)
|
|
231
231
|
return path.length; // UNC: "//server" or "\\server"
|
|
232
232
|
return p1 + 1; // UNC: "//server/" or "\\server\"
|
|
233
233
|
}
|
|
234
234
|
// DOS
|
|
235
|
-
if (isVolumeCharacter(ch0) && path.charCodeAt(1) === 58 /* colon */) {
|
|
235
|
+
if (isVolumeCharacter(ch0) && path.charCodeAt(1) === 58 /* CharacterCodes.colon */) {
|
|
236
236
|
const ch2 = path.charCodeAt(2);
|
|
237
|
-
if (ch2 === 47 /* slash */ || ch2 === 92 /* backslash */)
|
|
237
|
+
if (ch2 === 47 /* CharacterCodes.slash */ || ch2 === 92 /* CharacterCodes.backslash */)
|
|
238
238
|
return 3; // DOS: "c:/" or "c:\"
|
|
239
239
|
if (path.length === 2)
|
|
240
240
|
return 2; // DOS: "c:" (but not "c:d")
|
|
@@ -256,7 +256,7 @@ const getEncodedRootLength = (path) => {
|
|
|
256
256
|
isVolumeCharacter(path.charCodeAt(authorityEnd + 1))) {
|
|
257
257
|
const volumeSeparatorEnd = getFileUrlVolumeSeparatorEnd(path, authorityEnd + 2);
|
|
258
258
|
if (volumeSeparatorEnd !== -1) {
|
|
259
|
-
if (path.charCodeAt(volumeSeparatorEnd) === 47 /* slash */) {
|
|
259
|
+
if (path.charCodeAt(volumeSeparatorEnd) === 47 /* CharacterCodes.slash */) {
|
|
260
260
|
// URL: "file:///c:/", "file://localhost/c:/", "file:///c%3a/", "file://localhost/c%3a/"
|
|
261
261
|
return ~(volumeSeparatorEnd + 1);
|
|
262
262
|
}
|
|
@@ -274,15 +274,15 @@ const getEncodedRootLength = (path) => {
|
|
|
274
274
|
// relative
|
|
275
275
|
return 0;
|
|
276
276
|
};
|
|
277
|
-
const isVolumeCharacter = (charCode) => (charCode >= 97 /* a */ && charCode <= 122 /* z */) ||
|
|
278
|
-
(charCode >= 65 /* A */ && charCode <= 90 /* Z */);
|
|
277
|
+
const isVolumeCharacter = (charCode) => (charCode >= 97 /* CharacterCodes.a */ && charCode <= 122 /* CharacterCodes.z */) ||
|
|
278
|
+
(charCode >= 65 /* CharacterCodes.A */ && charCode <= 90 /* CharacterCodes.Z */);
|
|
279
279
|
const getFileUrlVolumeSeparatorEnd = (url, start) => {
|
|
280
280
|
const ch0 = url.charCodeAt(start);
|
|
281
|
-
if (ch0 === 58 /* colon */)
|
|
281
|
+
if (ch0 === 58 /* CharacterCodes.colon */)
|
|
282
282
|
return start + 1;
|
|
283
|
-
if (ch0 === 37 /* percent */ && url.charCodeAt(start + 1) === 51 /* _3 */) {
|
|
283
|
+
if (ch0 === 37 /* CharacterCodes.percent */ && url.charCodeAt(start + 1) === 51 /* CharacterCodes._3 */) {
|
|
284
284
|
const ch2 = url.charCodeAt(start + 2);
|
|
285
|
-
if (ch2 === 97 /* a */ || ch2 === 65 /* A */)
|
|
285
|
+
if (ch2 === 97 /* CharacterCodes.a */ || ch2 === 65 /* CharacterCodes.A */)
|
|
286
286
|
return start + 3;
|
|
287
287
|
}
|
|
288
288
|
return -1;
|
|
@@ -829,7 +829,7 @@ LOG_LEVELS.includes(maybeLogLevel);
|
|
|
829
829
|
const dependencies = [
|
|
830
830
|
{
|
|
831
831
|
name: "@rindo/core",
|
|
832
|
-
version: "2.
|
|
832
|
+
version: "2.18.1",
|
|
833
833
|
main: "compiler/rindo.js",
|
|
834
834
|
resources: [
|
|
835
835
|
"package.json",
|
|
@@ -871,8 +871,10 @@ const dependencies = [
|
|
|
871
871
|
"compiler/lib.es2019.symbol.d.ts",
|
|
872
872
|
"compiler/lib.es2020.bigint.d.ts",
|
|
873
873
|
"compiler/lib.es2020.d.ts",
|
|
874
|
+
"compiler/lib.es2020.date.d.ts",
|
|
874
875
|
"compiler/lib.es2020.full.d.ts",
|
|
875
876
|
"compiler/lib.es2020.intl.d.ts",
|
|
877
|
+
"compiler/lib.es2020.number.d.ts",
|
|
876
878
|
"compiler/lib.es2020.promise.d.ts",
|
|
877
879
|
"compiler/lib.es2020.sharedmemory.d.ts",
|
|
878
880
|
"compiler/lib.es2020.string.d.ts",
|
|
@@ -883,6 +885,13 @@ const dependencies = [
|
|
|
883
885
|
"compiler/lib.es2021.promise.d.ts",
|
|
884
886
|
"compiler/lib.es2021.string.d.ts",
|
|
885
887
|
"compiler/lib.es2021.weakref.d.ts",
|
|
888
|
+
"compiler/lib.es2022.array.d.ts",
|
|
889
|
+
"compiler/lib.es2022.d.ts",
|
|
890
|
+
"compiler/lib.es2022.error.d.ts",
|
|
891
|
+
"compiler/lib.es2022.full.d.ts",
|
|
892
|
+
"compiler/lib.es2022.intl.d.ts",
|
|
893
|
+
"compiler/lib.es2022.object.d.ts",
|
|
894
|
+
"compiler/lib.es2022.string.d.ts",
|
|
886
895
|
"compiler/lib.es5.d.ts",
|
|
887
896
|
"compiler/lib.es6.d.ts",
|
|
888
897
|
"compiler/lib.esnext.d.ts",
|
|
@@ -932,7 +941,7 @@ const dependencies = [
|
|
|
932
941
|
},
|
|
933
942
|
{
|
|
934
943
|
name: "typescript",
|
|
935
|
-
version: "4.
|
|
944
|
+
version: "4.7.4",
|
|
936
945
|
main: "lib/typescript.js"
|
|
937
946
|
}
|
|
938
947
|
];
|
|
@@ -1168,7 +1177,7 @@ const isInteractive = (sys, flags, object) => {
|
|
|
1168
1177
|
return terminalInfo.tty && !terminalInfo.ci;
|
|
1169
1178
|
};
|
|
1170
1179
|
const UUID_REGEX = new RegExp(/^[0-9A-F]{8}-[0-9A-F]{4}-4[0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}$/i);
|
|
1171
|
-
// Plucked from https://github.com/
|
|
1180
|
+
// Plucked from https://github.com/familyjs/jigra/blob/HEAD/cli/src/util/uuid.ts
|
|
1172
1181
|
function uuidv4() {
|
|
1173
1182
|
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (c) => {
|
|
1174
1183
|
const r = (Math.random() * 16) | 0;
|
|
@@ -1215,10 +1224,10 @@ async function shouldTrack(config, sys, ci) {
|
|
|
1215
1224
|
}
|
|
1216
1225
|
|
|
1217
1226
|
const isTest$1 = () => process.env.JEST_WORKER_ID !== undefined;
|
|
1218
|
-
const defaultConfig = (sys) => sys.resolvePath(`${sys.homeDir()}/.
|
|
1219
|
-
const defaultConfigDirectory = (sys) => sys.resolvePath(`${sys.homeDir()}/.
|
|
1227
|
+
const defaultConfig = (sys) => sys.resolvePath(`${sys.homeDir()}/.family/${isTest$1() ? 'tmp-config.json' : 'config.json'}`);
|
|
1228
|
+
const defaultConfigDirectory = (sys) => sys.resolvePath(`${sys.homeDir()}/.family`);
|
|
1220
1229
|
/**
|
|
1221
|
-
* Reads an
|
|
1230
|
+
* Reads an Family configuration file from disk, parses it, and performs any necessary corrections to it if certain
|
|
1222
1231
|
* values are deemed to be malformed
|
|
1223
1232
|
* @param sys The system where the command is invoked
|
|
1224
1233
|
* @returns the config read from disk that has been potentially been updated
|
|
@@ -1240,7 +1249,7 @@ async function readConfig(sys) {
|
|
|
1240
1249
|
return config;
|
|
1241
1250
|
}
|
|
1242
1251
|
/**
|
|
1243
|
-
* Writes an
|
|
1252
|
+
* Writes an Family configuration file to disk.
|
|
1244
1253
|
* @param sys The system where the command is invoked
|
|
1245
1254
|
* @param config The config passed into the Rindo command
|
|
1246
1255
|
* @returns boolean If the command was successful
|
|
@@ -1258,7 +1267,7 @@ async function writeConfig(sys, config) {
|
|
|
1258
1267
|
return result;
|
|
1259
1268
|
}
|
|
1260
1269
|
/**
|
|
1261
|
-
* Update a subset of the
|
|
1270
|
+
* Update a subset of the Family config.
|
|
1262
1271
|
* @param sys The system where the command is invoked
|
|
1263
1272
|
* @param newOptions The new options to save
|
|
1264
1273
|
* @returns boolean If the command was successful
|
|
@@ -1474,7 +1483,7 @@ const anonymizeConfigForTelemetry = (config) => {
|
|
|
1474
1483
|
/**
|
|
1475
1484
|
* Reads package-lock.json, yarn.lock, and package.json files in order to cross-reference
|
|
1476
1485
|
* the dependencies and devDependencies properties. Pulls up the current installed version
|
|
1477
|
-
* of each package under the @rindo, @
|
|
1486
|
+
* of each package under the @rindo, @familyjs, and @jigra scopes.
|
|
1478
1487
|
*
|
|
1479
1488
|
* @param sys the system instance where telemetry is invoked
|
|
1480
1489
|
* @param config the Rindo configuration associated with the current task that triggered telemetry
|
|
@@ -1496,16 +1505,16 @@ async function getInstalledPackages(sys, config) {
|
|
|
1496
1505
|
...packageJson.devDependencies,
|
|
1497
1506
|
...packageJson.dependencies,
|
|
1498
1507
|
});
|
|
1499
|
-
// Collect packages only in the rindo,
|
|
1508
|
+
// Collect packages only in the rindo, familyjs, or jigra org's:
|
|
1500
1509
|
// https://www.npmjs.com/org/rindo
|
|
1501
|
-
const
|
|
1510
|
+
const familyPackages = rawPackages.filter(([k]) => k.startsWith('@rindo/') || k.startsWith('@familyjs/') || k.startsWith('@jigra/'));
|
|
1502
1511
|
try {
|
|
1503
|
-
packages = yarn ? await yarnPackages(sys,
|
|
1512
|
+
packages = yarn ? await yarnPackages(sys, familyPackages) : await npmPackages(sys, familyPackages);
|
|
1504
1513
|
}
|
|
1505
1514
|
catch (e) {
|
|
1506
|
-
packages =
|
|
1515
|
+
packages = familyPackages.map(([k, v]) => `${k}@${v.replace('^', '')}`);
|
|
1507
1516
|
}
|
|
1508
|
-
packagesNoVersions =
|
|
1517
|
+
packagesNoVersions = familyPackages.map(([k]) => `${k}`);
|
|
1509
1518
|
return { packages, packagesNoVersions };
|
|
1510
1519
|
}
|
|
1511
1520
|
catch (err) {
|
|
@@ -1516,13 +1525,13 @@ async function getInstalledPackages(sys, config) {
|
|
|
1516
1525
|
/**
|
|
1517
1526
|
* Visits the npm lock file to find the exact versions that are installed
|
|
1518
1527
|
* @param sys The system where the command is invoked
|
|
1519
|
-
* @param
|
|
1528
|
+
* @param familyPackages a list of the found packages matching `@rindo`, `@jigra`, or `@familyjs` from the package.json file.
|
|
1520
1529
|
* @returns an array of strings of all the packages and their versions.
|
|
1521
1530
|
*/
|
|
1522
|
-
async function npmPackages(sys,
|
|
1531
|
+
async function npmPackages(sys, familyPackages) {
|
|
1523
1532
|
const appRootDir = sys.getCurrentDirectory();
|
|
1524
1533
|
const packageLockJson = await tryFn(readJson, sys, sys.resolvePath(appRootDir + '/package-lock.json'));
|
|
1525
|
-
return
|
|
1534
|
+
return familyPackages.map(([k, v]) => {
|
|
1526
1535
|
var _a, _b, _c, _d;
|
|
1527
1536
|
let version = (_d = (_b = (_a = packageLockJson === null || packageLockJson === void 0 ? void 0 : packageLockJson.dependencies[k]) === null || _a === void 0 ? void 0 : _a.version) !== null && _b !== void 0 ? _b : (_c = packageLockJson === null || packageLockJson === void 0 ? void 0 : packageLockJson.devDependencies[k]) === null || _c === void 0 ? void 0 : _c.version) !== null && _d !== void 0 ? _d : v;
|
|
1528
1537
|
version = version.includes('file:') ? sanitizeDeclaredVersion(v) : version;
|
|
@@ -1532,14 +1541,14 @@ async function npmPackages(sys, navifyPackages) {
|
|
|
1532
1541
|
/**
|
|
1533
1542
|
* Visits the yarn lock file to find the exact versions that are installed
|
|
1534
1543
|
* @param sys The system where the command is invoked
|
|
1535
|
-
* @param
|
|
1544
|
+
* @param familyPackages a list of the found packages matching `@rindo`, `@jigra`, or `@familyjs` from the package.json file.
|
|
1536
1545
|
* @returns an array of strings of all the packages and their versions.
|
|
1537
1546
|
*/
|
|
1538
|
-
async function yarnPackages(sys,
|
|
1547
|
+
async function yarnPackages(sys, familyPackages) {
|
|
1539
1548
|
const appRootDir = sys.getCurrentDirectory();
|
|
1540
1549
|
const yarnLock = sys.readFileSync(sys.resolvePath(appRootDir + '/yarn.lock'));
|
|
1541
1550
|
const yarnLockYml = sys.parseYarnLockFile(yarnLock);
|
|
1542
|
-
return
|
|
1551
|
+
return familyPackages.map(([k, v]) => {
|
|
1543
1552
|
var _a;
|
|
1544
1553
|
const identifiedVersion = `${k}@${v}`;
|
|
1545
1554
|
let version = (_a = yarnLockYml.object[identifiedVersion]) === null || _a === void 0 ? void 0 : _a.version;
|
|
@@ -1604,7 +1613,7 @@ async function sendTelemetry(sys, config, data) {
|
|
|
1604
1613
|
sent_at: now,
|
|
1605
1614
|
};
|
|
1606
1615
|
// This request is only made if telemetry is on.
|
|
1607
|
-
const response = await sys.fetch('https://api
|
|
1616
|
+
const response = await sys.fetch('https://familyjs-api.web.app/events/metrics', {
|
|
1608
1617
|
method: 'POST',
|
|
1609
1618
|
headers: {
|
|
1610
1619
|
'Content-Type': 'application/json',
|
|
@@ -2094,6 +2103,56 @@ const taskServe = async (config) => {
|
|
|
2094
2103
|
});
|
|
2095
2104
|
};
|
|
2096
2105
|
|
|
2106
|
+
/**
|
|
2107
|
+
* Entrypoint for any Rindo tests
|
|
2108
|
+
* @param config a validated Rindo configuration entity
|
|
2109
|
+
*/
|
|
2110
|
+
const taskTest = async (config) => {
|
|
2111
|
+
if (!IS_NODE_ENV) {
|
|
2112
|
+
config.logger.error(`"test" command is currently only implemented for a NodeJS environment`);
|
|
2113
|
+
return config.sys.exit(1);
|
|
2114
|
+
}
|
|
2115
|
+
try {
|
|
2116
|
+
config.buildDocs = false;
|
|
2117
|
+
const testingRunOpts = {
|
|
2118
|
+
e2e: !!config.flags.e2e,
|
|
2119
|
+
screenshot: !!config.flags.screenshot,
|
|
2120
|
+
spec: !!config.flags.spec,
|
|
2121
|
+
updateScreenshot: !!config.flags.updateScreenshot,
|
|
2122
|
+
};
|
|
2123
|
+
// always ensure we have jest modules installed
|
|
2124
|
+
const ensureModuleIds = ['@types/jest', 'jest', 'jest-cli'];
|
|
2125
|
+
if (testingRunOpts.e2e) {
|
|
2126
|
+
// if it's an e2e test, also make sure we're got
|
|
2127
|
+
// puppeteer modules installed and if browserExecutablePath is provided don't download Chromium use only puppeteer-core instead
|
|
2128
|
+
const puppeteer = config.testing.browserExecutablePath ? 'puppeteer-core' : 'puppeteer';
|
|
2129
|
+
ensureModuleIds.push(puppeteer);
|
|
2130
|
+
if (testingRunOpts.screenshot) {
|
|
2131
|
+
// ensure we've got pixelmatch for screenshots
|
|
2132
|
+
config.logger.warn(config.logger.yellow(`EXPERIMENTAL: screenshot visual diff testing is currently under heavy development and has not reached a stable status. However, any assistance testing would be appreciated.`));
|
|
2133
|
+
}
|
|
2134
|
+
}
|
|
2135
|
+
// ensure we've got the required modules installed
|
|
2136
|
+
const diagnostics = await config.sys.lazyRequire.ensure(config.rootDir, ensureModuleIds);
|
|
2137
|
+
if (diagnostics.length > 0) {
|
|
2138
|
+
config.logger.printDiagnostics(diagnostics);
|
|
2139
|
+
return config.sys.exit(1);
|
|
2140
|
+
}
|
|
2141
|
+
// let's test!
|
|
2142
|
+
const { createTesting } = await Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require('../testing/index.js')); });
|
|
2143
|
+
const testing = await createTesting(config);
|
|
2144
|
+
const passed = await testing.run(testingRunOpts);
|
|
2145
|
+
await testing.destroy();
|
|
2146
|
+
if (!passed) {
|
|
2147
|
+
return config.sys.exit(1);
|
|
2148
|
+
}
|
|
2149
|
+
}
|
|
2150
|
+
catch (e) {
|
|
2151
|
+
config.logger.error(e);
|
|
2152
|
+
return config.sys.exit(1);
|
|
2153
|
+
}
|
|
2154
|
+
};
|
|
2155
|
+
|
|
2097
2156
|
/**
|
|
2098
2157
|
* Creates an instance of a logger
|
|
2099
2158
|
* @returns the new logger instance
|
|
@@ -2266,15 +2325,16 @@ const run = async (init) => {
|
|
|
2266
2325
|
* @public
|
|
2267
2326
|
*/
|
|
2268
2327
|
const runTask = async (coreCompiler, config, task, sys) => {
|
|
2269
|
-
var _a, _b, _c, _d, _e;
|
|
2328
|
+
var _a, _b, _c, _d, _e, _f;
|
|
2270
2329
|
const logger = (_a = config.logger) !== null && _a !== void 0 ? _a : createLogger();
|
|
2271
2330
|
const strictConfig = {
|
|
2272
2331
|
...config,
|
|
2273
2332
|
flags: createConfigFlags((_b = config.flags) !== null && _b !== void 0 ? _b : { task }),
|
|
2274
2333
|
logger,
|
|
2275
2334
|
outputTargets: (_c = config.outputTargets) !== null && _c !== void 0 ? _c : [],
|
|
2276
|
-
|
|
2277
|
-
|
|
2335
|
+
rootDir: (_d = config.rootDir) !== null && _d !== void 0 ? _d : '/',
|
|
2336
|
+
sys: (_e = sys !== null && sys !== void 0 ? sys : config.sys) !== null && _e !== void 0 ? _e : coreCompiler.createSystem({ logger }),
|
|
2337
|
+
testing: (_f = config.testing) !== null && _f !== void 0 ? _f : {},
|
|
2278
2338
|
};
|
|
2279
2339
|
switch (task) {
|
|
2280
2340
|
case 'build':
|
|
@@ -2299,6 +2359,9 @@ const runTask = async (coreCompiler, config, task, sys) => {
|
|
|
2299
2359
|
case 'telemetry':
|
|
2300
2360
|
await taskTelemetry(strictConfig.flags, sys, strictConfig.logger);
|
|
2301
2361
|
break;
|
|
2362
|
+
case 'test':
|
|
2363
|
+
await taskTest(strictConfig);
|
|
2364
|
+
break;
|
|
2302
2365
|
case 'version':
|
|
2303
2366
|
console.log(coreCompiler.version);
|
|
2304
2367
|
break;
|
package/cli/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
Rindo CLI v2.
|
|
2
|
+
Rindo CLI v2.18.1 | MIT Licensed | https://rindojs.web.app
|
|
3
3
|
*/
|
|
4
4
|
/**
|
|
5
5
|
* This sets the log level hierarchy for our terminal logger, ranging from
|
|
@@ -199,18 +199,18 @@ const getEncodedRootLength = (path) => {
|
|
|
199
199
|
return 0;
|
|
200
200
|
const ch0 = path.charCodeAt(0);
|
|
201
201
|
// POSIX or UNC
|
|
202
|
-
if (ch0 === 47 /* slash */ || ch0 === 92 /* backslash */) {
|
|
202
|
+
if (ch0 === 47 /* CharacterCodes.slash */ || ch0 === 92 /* CharacterCodes.backslash */) {
|
|
203
203
|
if (path.charCodeAt(1) !== ch0)
|
|
204
204
|
return 1; // POSIX: "/" (or non-normalized "\")
|
|
205
|
-
const p1 = path.indexOf(ch0 === 47 /* slash */ ? '/' : altDirectorySeparator, 2);
|
|
205
|
+
const p1 = path.indexOf(ch0 === 47 /* CharacterCodes.slash */ ? '/' : altDirectorySeparator, 2);
|
|
206
206
|
if (p1 < 0)
|
|
207
207
|
return path.length; // UNC: "//server" or "\\server"
|
|
208
208
|
return p1 + 1; // UNC: "//server/" or "\\server\"
|
|
209
209
|
}
|
|
210
210
|
// DOS
|
|
211
|
-
if (isVolumeCharacter(ch0) && path.charCodeAt(1) === 58 /* colon */) {
|
|
211
|
+
if (isVolumeCharacter(ch0) && path.charCodeAt(1) === 58 /* CharacterCodes.colon */) {
|
|
212
212
|
const ch2 = path.charCodeAt(2);
|
|
213
|
-
if (ch2 === 47 /* slash */ || ch2 === 92 /* backslash */)
|
|
213
|
+
if (ch2 === 47 /* CharacterCodes.slash */ || ch2 === 92 /* CharacterCodes.backslash */)
|
|
214
214
|
return 3; // DOS: "c:/" or "c:\"
|
|
215
215
|
if (path.length === 2)
|
|
216
216
|
return 2; // DOS: "c:" (but not "c:d")
|
|
@@ -232,7 +232,7 @@ const getEncodedRootLength = (path) => {
|
|
|
232
232
|
isVolumeCharacter(path.charCodeAt(authorityEnd + 1))) {
|
|
233
233
|
const volumeSeparatorEnd = getFileUrlVolumeSeparatorEnd(path, authorityEnd + 2);
|
|
234
234
|
if (volumeSeparatorEnd !== -1) {
|
|
235
|
-
if (path.charCodeAt(volumeSeparatorEnd) === 47 /* slash */) {
|
|
235
|
+
if (path.charCodeAt(volumeSeparatorEnd) === 47 /* CharacterCodes.slash */) {
|
|
236
236
|
// URL: "file:///c:/", "file://localhost/c:/", "file:///c%3a/", "file://localhost/c%3a/"
|
|
237
237
|
return ~(volumeSeparatorEnd + 1);
|
|
238
238
|
}
|
|
@@ -250,15 +250,15 @@ const getEncodedRootLength = (path) => {
|
|
|
250
250
|
// relative
|
|
251
251
|
return 0;
|
|
252
252
|
};
|
|
253
|
-
const isVolumeCharacter = (charCode) => (charCode >= 97 /* a */ && charCode <= 122 /* z */) ||
|
|
254
|
-
(charCode >= 65 /* A */ && charCode <= 90 /* Z */);
|
|
253
|
+
const isVolumeCharacter = (charCode) => (charCode >= 97 /* CharacterCodes.a */ && charCode <= 122 /* CharacterCodes.z */) ||
|
|
254
|
+
(charCode >= 65 /* CharacterCodes.A */ && charCode <= 90 /* CharacterCodes.Z */);
|
|
255
255
|
const getFileUrlVolumeSeparatorEnd = (url, start) => {
|
|
256
256
|
const ch0 = url.charCodeAt(start);
|
|
257
|
-
if (ch0 === 58 /* colon */)
|
|
257
|
+
if (ch0 === 58 /* CharacterCodes.colon */)
|
|
258
258
|
return start + 1;
|
|
259
|
-
if (ch0 === 37 /* percent */ && url.charCodeAt(start + 1) === 51 /* _3 */) {
|
|
259
|
+
if (ch0 === 37 /* CharacterCodes.percent */ && url.charCodeAt(start + 1) === 51 /* CharacterCodes._3 */) {
|
|
260
260
|
const ch2 = url.charCodeAt(start + 2);
|
|
261
|
-
if (ch2 === 97 /* a */ || ch2 === 65 /* A */)
|
|
261
|
+
if (ch2 === 97 /* CharacterCodes.a */ || ch2 === 65 /* CharacterCodes.A */)
|
|
262
262
|
return start + 3;
|
|
263
263
|
}
|
|
264
264
|
return -1;
|
|
@@ -805,7 +805,7 @@ LOG_LEVELS.includes(maybeLogLevel);
|
|
|
805
805
|
const dependencies = [
|
|
806
806
|
{
|
|
807
807
|
name: "@rindo/core",
|
|
808
|
-
version: "2.
|
|
808
|
+
version: "2.18.1",
|
|
809
809
|
main: "compiler/rindo.js",
|
|
810
810
|
resources: [
|
|
811
811
|
"package.json",
|
|
@@ -847,8 +847,10 @@ const dependencies = [
|
|
|
847
847
|
"compiler/lib.es2019.symbol.d.ts",
|
|
848
848
|
"compiler/lib.es2020.bigint.d.ts",
|
|
849
849
|
"compiler/lib.es2020.d.ts",
|
|
850
|
+
"compiler/lib.es2020.date.d.ts",
|
|
850
851
|
"compiler/lib.es2020.full.d.ts",
|
|
851
852
|
"compiler/lib.es2020.intl.d.ts",
|
|
853
|
+
"compiler/lib.es2020.number.d.ts",
|
|
852
854
|
"compiler/lib.es2020.promise.d.ts",
|
|
853
855
|
"compiler/lib.es2020.sharedmemory.d.ts",
|
|
854
856
|
"compiler/lib.es2020.string.d.ts",
|
|
@@ -859,6 +861,13 @@ const dependencies = [
|
|
|
859
861
|
"compiler/lib.es2021.promise.d.ts",
|
|
860
862
|
"compiler/lib.es2021.string.d.ts",
|
|
861
863
|
"compiler/lib.es2021.weakref.d.ts",
|
|
864
|
+
"compiler/lib.es2022.array.d.ts",
|
|
865
|
+
"compiler/lib.es2022.d.ts",
|
|
866
|
+
"compiler/lib.es2022.error.d.ts",
|
|
867
|
+
"compiler/lib.es2022.full.d.ts",
|
|
868
|
+
"compiler/lib.es2022.intl.d.ts",
|
|
869
|
+
"compiler/lib.es2022.object.d.ts",
|
|
870
|
+
"compiler/lib.es2022.string.d.ts",
|
|
862
871
|
"compiler/lib.es5.d.ts",
|
|
863
872
|
"compiler/lib.es6.d.ts",
|
|
864
873
|
"compiler/lib.esnext.d.ts",
|
|
@@ -908,7 +917,7 @@ const dependencies = [
|
|
|
908
917
|
},
|
|
909
918
|
{
|
|
910
919
|
name: "typescript",
|
|
911
|
-
version: "4.
|
|
920
|
+
version: "4.7.4",
|
|
912
921
|
main: "lib/typescript.js"
|
|
913
922
|
}
|
|
914
923
|
];
|
|
@@ -1144,7 +1153,7 @@ const isInteractive = (sys, flags, object) => {
|
|
|
1144
1153
|
return terminalInfo.tty && !terminalInfo.ci;
|
|
1145
1154
|
};
|
|
1146
1155
|
const UUID_REGEX = new RegExp(/^[0-9A-F]{8}-[0-9A-F]{4}-4[0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}$/i);
|
|
1147
|
-
// Plucked from https://github.com/
|
|
1156
|
+
// Plucked from https://github.com/familyjs/jigra/blob/HEAD/cli/src/util/uuid.ts
|
|
1148
1157
|
function uuidv4() {
|
|
1149
1158
|
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (c) => {
|
|
1150
1159
|
const r = (Math.random() * 16) | 0;
|
|
@@ -1191,10 +1200,10 @@ async function shouldTrack(config, sys, ci) {
|
|
|
1191
1200
|
}
|
|
1192
1201
|
|
|
1193
1202
|
const isTest$1 = () => process.env.JEST_WORKER_ID !== undefined;
|
|
1194
|
-
const defaultConfig = (sys) => sys.resolvePath(`${sys.homeDir()}/.
|
|
1195
|
-
const defaultConfigDirectory = (sys) => sys.resolvePath(`${sys.homeDir()}/.
|
|
1203
|
+
const defaultConfig = (sys) => sys.resolvePath(`${sys.homeDir()}/.family/${isTest$1() ? 'tmp-config.json' : 'config.json'}`);
|
|
1204
|
+
const defaultConfigDirectory = (sys) => sys.resolvePath(`${sys.homeDir()}/.family`);
|
|
1196
1205
|
/**
|
|
1197
|
-
* Reads an
|
|
1206
|
+
* Reads an Family configuration file from disk, parses it, and performs any necessary corrections to it if certain
|
|
1198
1207
|
* values are deemed to be malformed
|
|
1199
1208
|
* @param sys The system where the command is invoked
|
|
1200
1209
|
* @returns the config read from disk that has been potentially been updated
|
|
@@ -1216,7 +1225,7 @@ async function readConfig(sys) {
|
|
|
1216
1225
|
return config;
|
|
1217
1226
|
}
|
|
1218
1227
|
/**
|
|
1219
|
-
* Writes an
|
|
1228
|
+
* Writes an Family configuration file to disk.
|
|
1220
1229
|
* @param sys The system where the command is invoked
|
|
1221
1230
|
* @param config The config passed into the Rindo command
|
|
1222
1231
|
* @returns boolean If the command was successful
|
|
@@ -1234,7 +1243,7 @@ async function writeConfig(sys, config) {
|
|
|
1234
1243
|
return result;
|
|
1235
1244
|
}
|
|
1236
1245
|
/**
|
|
1237
|
-
* Update a subset of the
|
|
1246
|
+
* Update a subset of the Family config.
|
|
1238
1247
|
* @param sys The system where the command is invoked
|
|
1239
1248
|
* @param newOptions The new options to save
|
|
1240
1249
|
* @returns boolean If the command was successful
|
|
@@ -1450,7 +1459,7 @@ const anonymizeConfigForTelemetry = (config) => {
|
|
|
1450
1459
|
/**
|
|
1451
1460
|
* Reads package-lock.json, yarn.lock, and package.json files in order to cross-reference
|
|
1452
1461
|
* the dependencies and devDependencies properties. Pulls up the current installed version
|
|
1453
|
-
* of each package under the @rindo, @
|
|
1462
|
+
* of each package under the @rindo, @familyjs, and @jigra scopes.
|
|
1454
1463
|
*
|
|
1455
1464
|
* @param sys the system instance where telemetry is invoked
|
|
1456
1465
|
* @param config the Rindo configuration associated with the current task that triggered telemetry
|
|
@@ -1472,16 +1481,16 @@ async function getInstalledPackages(sys, config) {
|
|
|
1472
1481
|
...packageJson.devDependencies,
|
|
1473
1482
|
...packageJson.dependencies,
|
|
1474
1483
|
});
|
|
1475
|
-
// Collect packages only in the rindo,
|
|
1484
|
+
// Collect packages only in the rindo, familyjs, or jigra org's:
|
|
1476
1485
|
// https://www.npmjs.com/org/rindo
|
|
1477
|
-
const
|
|
1486
|
+
const familyPackages = rawPackages.filter(([k]) => k.startsWith('@rindo/') || k.startsWith('@familyjs/') || k.startsWith('@jigra/'));
|
|
1478
1487
|
try {
|
|
1479
|
-
packages = yarn ? await yarnPackages(sys,
|
|
1488
|
+
packages = yarn ? await yarnPackages(sys, familyPackages) : await npmPackages(sys, familyPackages);
|
|
1480
1489
|
}
|
|
1481
1490
|
catch (e) {
|
|
1482
|
-
packages =
|
|
1491
|
+
packages = familyPackages.map(([k, v]) => `${k}@${v.replace('^', '')}`);
|
|
1483
1492
|
}
|
|
1484
|
-
packagesNoVersions =
|
|
1493
|
+
packagesNoVersions = familyPackages.map(([k]) => `${k}`);
|
|
1485
1494
|
return { packages, packagesNoVersions };
|
|
1486
1495
|
}
|
|
1487
1496
|
catch (err) {
|
|
@@ -1492,13 +1501,13 @@ async function getInstalledPackages(sys, config) {
|
|
|
1492
1501
|
/**
|
|
1493
1502
|
* Visits the npm lock file to find the exact versions that are installed
|
|
1494
1503
|
* @param sys The system where the command is invoked
|
|
1495
|
-
* @param
|
|
1504
|
+
* @param familyPackages a list of the found packages matching `@rindo`, `@jigra`, or `@familyjs` from the package.json file.
|
|
1496
1505
|
* @returns an array of strings of all the packages and their versions.
|
|
1497
1506
|
*/
|
|
1498
|
-
async function npmPackages(sys,
|
|
1507
|
+
async function npmPackages(sys, familyPackages) {
|
|
1499
1508
|
const appRootDir = sys.getCurrentDirectory();
|
|
1500
1509
|
const packageLockJson = await tryFn(readJson, sys, sys.resolvePath(appRootDir + '/package-lock.json'));
|
|
1501
|
-
return
|
|
1510
|
+
return familyPackages.map(([k, v]) => {
|
|
1502
1511
|
var _a, _b, _c, _d;
|
|
1503
1512
|
let version = (_d = (_b = (_a = packageLockJson === null || packageLockJson === void 0 ? void 0 : packageLockJson.dependencies[k]) === null || _a === void 0 ? void 0 : _a.version) !== null && _b !== void 0 ? _b : (_c = packageLockJson === null || packageLockJson === void 0 ? void 0 : packageLockJson.devDependencies[k]) === null || _c === void 0 ? void 0 : _c.version) !== null && _d !== void 0 ? _d : v;
|
|
1504
1513
|
version = version.includes('file:') ? sanitizeDeclaredVersion(v) : version;
|
|
@@ -1508,14 +1517,14 @@ async function npmPackages(sys, navifyPackages) {
|
|
|
1508
1517
|
/**
|
|
1509
1518
|
* Visits the yarn lock file to find the exact versions that are installed
|
|
1510
1519
|
* @param sys The system where the command is invoked
|
|
1511
|
-
* @param
|
|
1520
|
+
* @param familyPackages a list of the found packages matching `@rindo`, `@jigra`, or `@familyjs` from the package.json file.
|
|
1512
1521
|
* @returns an array of strings of all the packages and their versions.
|
|
1513
1522
|
*/
|
|
1514
|
-
async function yarnPackages(sys,
|
|
1523
|
+
async function yarnPackages(sys, familyPackages) {
|
|
1515
1524
|
const appRootDir = sys.getCurrentDirectory();
|
|
1516
1525
|
const yarnLock = sys.readFileSync(sys.resolvePath(appRootDir + '/yarn.lock'));
|
|
1517
1526
|
const yarnLockYml = sys.parseYarnLockFile(yarnLock);
|
|
1518
|
-
return
|
|
1527
|
+
return familyPackages.map(([k, v]) => {
|
|
1519
1528
|
var _a;
|
|
1520
1529
|
const identifiedVersion = `${k}@${v}`;
|
|
1521
1530
|
let version = (_a = yarnLockYml.object[identifiedVersion]) === null || _a === void 0 ? void 0 : _a.version;
|
|
@@ -1580,7 +1589,7 @@ async function sendTelemetry(sys, config, data) {
|
|
|
1580
1589
|
sent_at: now,
|
|
1581
1590
|
};
|
|
1582
1591
|
// This request is only made if telemetry is on.
|
|
1583
|
-
const response = await sys.fetch('https://api
|
|
1592
|
+
const response = await sys.fetch('https://familyjs-api.web.app/events/metrics', {
|
|
1584
1593
|
method: 'POST',
|
|
1585
1594
|
headers: {
|
|
1586
1595
|
'Content-Type': 'application/json',
|
|
@@ -2070,6 +2079,56 @@ const taskServe = async (config) => {
|
|
|
2070
2079
|
});
|
|
2071
2080
|
};
|
|
2072
2081
|
|
|
2082
|
+
/**
|
|
2083
|
+
* Entrypoint for any Rindo tests
|
|
2084
|
+
* @param config a validated Rindo configuration entity
|
|
2085
|
+
*/
|
|
2086
|
+
const taskTest = async (config) => {
|
|
2087
|
+
if (!IS_NODE_ENV) {
|
|
2088
|
+
config.logger.error(`"test" command is currently only implemented for a NodeJS environment`);
|
|
2089
|
+
return config.sys.exit(1);
|
|
2090
|
+
}
|
|
2091
|
+
try {
|
|
2092
|
+
config.buildDocs = false;
|
|
2093
|
+
const testingRunOpts = {
|
|
2094
|
+
e2e: !!config.flags.e2e,
|
|
2095
|
+
screenshot: !!config.flags.screenshot,
|
|
2096
|
+
spec: !!config.flags.spec,
|
|
2097
|
+
updateScreenshot: !!config.flags.updateScreenshot,
|
|
2098
|
+
};
|
|
2099
|
+
// always ensure we have jest modules installed
|
|
2100
|
+
const ensureModuleIds = ['@types/jest', 'jest', 'jest-cli'];
|
|
2101
|
+
if (testingRunOpts.e2e) {
|
|
2102
|
+
// if it's an e2e test, also make sure we're got
|
|
2103
|
+
// puppeteer modules installed and if browserExecutablePath is provided don't download Chromium use only puppeteer-core instead
|
|
2104
|
+
const puppeteer = config.testing.browserExecutablePath ? 'puppeteer-core' : 'puppeteer';
|
|
2105
|
+
ensureModuleIds.push(puppeteer);
|
|
2106
|
+
if (testingRunOpts.screenshot) {
|
|
2107
|
+
// ensure we've got pixelmatch for screenshots
|
|
2108
|
+
config.logger.warn(config.logger.yellow(`EXPERIMENTAL: screenshot visual diff testing is currently under heavy development and has not reached a stable status. However, any assistance testing would be appreciated.`));
|
|
2109
|
+
}
|
|
2110
|
+
}
|
|
2111
|
+
// ensure we've got the required modules installed
|
|
2112
|
+
const diagnostics = await config.sys.lazyRequire.ensure(config.rootDir, ensureModuleIds);
|
|
2113
|
+
if (diagnostics.length > 0) {
|
|
2114
|
+
config.logger.printDiagnostics(diagnostics);
|
|
2115
|
+
return config.sys.exit(1);
|
|
2116
|
+
}
|
|
2117
|
+
// let's test!
|
|
2118
|
+
const { createTesting } = await import('../testing/index.js');
|
|
2119
|
+
const testing = await createTesting(config);
|
|
2120
|
+
const passed = await testing.run(testingRunOpts);
|
|
2121
|
+
await testing.destroy();
|
|
2122
|
+
if (!passed) {
|
|
2123
|
+
return config.sys.exit(1);
|
|
2124
|
+
}
|
|
2125
|
+
}
|
|
2126
|
+
catch (e) {
|
|
2127
|
+
config.logger.error(e);
|
|
2128
|
+
return config.sys.exit(1);
|
|
2129
|
+
}
|
|
2130
|
+
};
|
|
2131
|
+
|
|
2073
2132
|
/**
|
|
2074
2133
|
* Creates an instance of a logger
|
|
2075
2134
|
* @returns the new logger instance
|
|
@@ -2242,15 +2301,16 @@ const run = async (init) => {
|
|
|
2242
2301
|
* @public
|
|
2243
2302
|
*/
|
|
2244
2303
|
const runTask = async (coreCompiler, config, task, sys) => {
|
|
2245
|
-
var _a, _b, _c, _d, _e;
|
|
2304
|
+
var _a, _b, _c, _d, _e, _f;
|
|
2246
2305
|
const logger = (_a = config.logger) !== null && _a !== void 0 ? _a : createLogger();
|
|
2247
2306
|
const strictConfig = {
|
|
2248
2307
|
...config,
|
|
2249
2308
|
flags: createConfigFlags((_b = config.flags) !== null && _b !== void 0 ? _b : { task }),
|
|
2250
2309
|
logger,
|
|
2251
2310
|
outputTargets: (_c = config.outputTargets) !== null && _c !== void 0 ? _c : [],
|
|
2252
|
-
|
|
2253
|
-
|
|
2311
|
+
rootDir: (_d = config.rootDir) !== null && _d !== void 0 ? _d : '/',
|
|
2312
|
+
sys: (_e = sys !== null && sys !== void 0 ? sys : config.sys) !== null && _e !== void 0 ? _e : coreCompiler.createSystem({ logger }),
|
|
2313
|
+
testing: (_f = config.testing) !== null && _f !== void 0 ? _f : {},
|
|
2254
2314
|
};
|
|
2255
2315
|
switch (task) {
|
|
2256
2316
|
case 'build':
|
|
@@ -2275,6 +2335,9 @@ const runTask = async (coreCompiler, config, task, sys) => {
|
|
|
2275
2335
|
case 'telemetry':
|
|
2276
2336
|
await taskTelemetry(strictConfig.flags, sys, strictConfig.logger);
|
|
2277
2337
|
break;
|
|
2338
|
+
case 'test':
|
|
2339
|
+
await taskTest(strictConfig);
|
|
2340
|
+
break;
|
|
2278
2341
|
case 'version':
|
|
2279
2342
|
console.log(coreCompiler.version);
|
|
2280
2343
|
break;
|