@rindo/core 2.17.0 → 2.17.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/config-flags.d.ts +102 -0
- package/cli/index.cjs +598 -219
- package/cli/index.d.ts +2 -1
- package/cli/index.js +598 -219
- package/cli/package.json +1 -1
- package/compiler/package.json +1 -1
- package/compiler/rindo.js +337 -173
- 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 +2 -2
- package/dev-server/index.js +1 -1
- package/dev-server/package.json +1 -1
- package/dev-server/server-process.js +2 -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 +11 -6
- 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 +2 -2
- package/internal/hydrate/package.json +1 -1
- package/internal/package.json +1 -1
- package/internal/rindo-private.d.ts +2 -2
- package/internal/rindo-public-compiler.d.ts +67 -48
- package/internal/testing/index.js +1 -1
- 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 +5 -3
- package/screenshot/package.json +1 -1
- package/sys/node/index.js +4 -4
- 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 +40 -24
- package/testing/jest/jest-config.d.ts +1 -1
- package/testing/jest/jest-runner.d.ts +3 -2
- package/testing/jest/jest-screenshot.d.ts +1 -1
- package/testing/mocks.d.ts +27 -2
- package/testing/package.json +1 -1
- package/testing/puppeteer/puppeteer-browser.d.ts +2 -2
- package/testing/testing-utils.d.ts +74 -2
- package/testing/testing.d.ts +2 -2
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { JsonDocs } from './rindo-public-docs';
|
|
2
2
|
import type { PrerenderUrlResults } from '../internal';
|
|
3
|
+
import type { ConfigFlags } from '../cli/config-flags';
|
|
3
4
|
export * from './rindo-public-docs';
|
|
4
5
|
/**
|
|
5
6
|
* https://rindojs.web.app/docs/config/
|
|
@@ -356,6 +357,29 @@ declare type Loose<T extends Object> = Record<string, any> & Partial<T>;
|
|
|
356
357
|
* and have type information carry though as we construct an object which is a valid `Config`.
|
|
357
358
|
*/
|
|
358
359
|
export declare type UnvalidatedConfig = Loose<Config>;
|
|
360
|
+
/**
|
|
361
|
+
* Helper type to strip optional markers from keys in a type, while preserving other type information for the key.
|
|
362
|
+
* This type takes a union of keys, K, in type T to allow for the type T to be gradually updated.
|
|
363
|
+
*
|
|
364
|
+
* ```typescript
|
|
365
|
+
* type Foo { bar?: number, baz?: string }
|
|
366
|
+
* type ReqFieldFoo = RequireFields<Foo, 'bar'>; // { bar: number, baz?: string }
|
|
367
|
+
* ```
|
|
368
|
+
*/
|
|
369
|
+
declare type RequireFields<T, K extends keyof T> = T & {
|
|
370
|
+
[P in K]-?: T[P];
|
|
371
|
+
};
|
|
372
|
+
/**
|
|
373
|
+
* Fields in {@link Config} to make required for {@link ValidatedConfig}
|
|
374
|
+
*/
|
|
375
|
+
declare type StrictConfigFields = 'flags' | 'logger';
|
|
376
|
+
/**
|
|
377
|
+
* A version of {@link Config} that makes certain fields required. This type represents a valid configuration entity.
|
|
378
|
+
* When a configuration is received by the user, it is a bag of unverified data. In order to make stricter guarantees
|
|
379
|
+
* about the data from a type-safety perspective, this type is intended to be used throughout the codebase once
|
|
380
|
+
* validations have occurred at runtime.
|
|
381
|
+
*/
|
|
382
|
+
export declare type ValidatedConfig = RequireFields<Config, StrictConfigFields>;
|
|
359
383
|
export interface HydratedFlag {
|
|
360
384
|
/**
|
|
361
385
|
* Defaults to `hydrated`.
|
|
@@ -505,51 +529,6 @@ export interface DevServerEditor {
|
|
|
505
529
|
supported?: boolean;
|
|
506
530
|
priority?: number;
|
|
507
531
|
}
|
|
508
|
-
export interface ConfigFlags {
|
|
509
|
-
task?: TaskCommand;
|
|
510
|
-
args?: string[];
|
|
511
|
-
knownArgs?: string[];
|
|
512
|
-
unknownArgs?: string[];
|
|
513
|
-
address?: string;
|
|
514
|
-
build?: boolean;
|
|
515
|
-
cache?: boolean;
|
|
516
|
-
checkVersion?: boolean;
|
|
517
|
-
ci?: boolean;
|
|
518
|
-
compare?: boolean;
|
|
519
|
-
config?: string;
|
|
520
|
-
debug?: boolean;
|
|
521
|
-
dev?: boolean;
|
|
522
|
-
docs?: boolean;
|
|
523
|
-
docsApi?: string;
|
|
524
|
-
docsJson?: string;
|
|
525
|
-
e2e?: boolean;
|
|
526
|
-
emulate?: string;
|
|
527
|
-
es5?: boolean;
|
|
528
|
-
esm?: boolean;
|
|
529
|
-
headless?: boolean;
|
|
530
|
-
help?: boolean;
|
|
531
|
-
log?: boolean;
|
|
532
|
-
logLevel?: LogLevel;
|
|
533
|
-
verbose?: boolean;
|
|
534
|
-
maxWorkers?: number;
|
|
535
|
-
open?: boolean;
|
|
536
|
-
port?: number;
|
|
537
|
-
prerender?: boolean;
|
|
538
|
-
prod?: boolean;
|
|
539
|
-
profile?: boolean;
|
|
540
|
-
root?: string;
|
|
541
|
-
screenshot?: boolean;
|
|
542
|
-
screenshotConnector?: string;
|
|
543
|
-
serve?: boolean;
|
|
544
|
-
serviceWorker?: boolean;
|
|
545
|
-
spec?: boolean;
|
|
546
|
-
ssr?: boolean;
|
|
547
|
-
stats?: boolean;
|
|
548
|
-
updateScreenshot?: boolean;
|
|
549
|
-
version?: boolean;
|
|
550
|
-
watch?: boolean;
|
|
551
|
-
devtools?: boolean;
|
|
552
|
-
}
|
|
553
532
|
export declare type TaskCommand = 'build' | 'docs' | 'generate' | 'g' | 'help' | 'info' | 'prerender' | 'serve' | 'telemetry' | 'test' | 'version';
|
|
554
533
|
export declare type PageReloadStrategy = 'hmr' | 'pageReload' | null;
|
|
555
534
|
/**
|
|
@@ -1653,7 +1632,29 @@ export interface EmulateViewport {
|
|
|
1653
1632
|
*/
|
|
1654
1633
|
isLandscape?: boolean;
|
|
1655
1634
|
}
|
|
1656
|
-
|
|
1635
|
+
/**
|
|
1636
|
+
* This sets the log level hierarchy for our terminal logger, ranging from
|
|
1637
|
+
* most to least verbose.
|
|
1638
|
+
*
|
|
1639
|
+
* Ordering the levels like this lets us easily check whether we should log a
|
|
1640
|
+
* message at a given time. For instance, if the log level is set to `'warn'`,
|
|
1641
|
+
* then anything passed to the logger with level `'warn'` or `'error'` should
|
|
1642
|
+
* be logged, but we should _not_ log anything with level `'info'` or `'debug'`.
|
|
1643
|
+
*
|
|
1644
|
+
* If we have a current log level `currentLevel` and a message with level
|
|
1645
|
+
* `msgLevel` is passed to the logger, we can determine whether or not we should
|
|
1646
|
+
* log it by checking if the log level on the message is further up or at the
|
|
1647
|
+
* same level in the hierarchy than `currentLevel`, like so:
|
|
1648
|
+
*
|
|
1649
|
+
* ```ts
|
|
1650
|
+
* LOG_LEVELS.indexOf(msgLevel) >= LOG_LEVELS.indexOf(currentLevel)
|
|
1651
|
+
* ```
|
|
1652
|
+
*
|
|
1653
|
+
* NOTE: for the reasons described above, do not change the order of the entries
|
|
1654
|
+
* in this array without good reason!
|
|
1655
|
+
*/
|
|
1656
|
+
export declare const LOG_LEVELS: readonly ["debug", "info", "warn", "error"];
|
|
1657
|
+
export declare type LogLevel = typeof LOG_LEVELS[number];
|
|
1657
1658
|
/**
|
|
1658
1659
|
* Common logger to be used by the compiler, dev-server and CLI. The CLI will use a
|
|
1659
1660
|
* NodeJS based console logging and colors, and the web will use browser based
|
|
@@ -1980,7 +1981,7 @@ export interface LoadConfigInit {
|
|
|
1980
1981
|
* operations around the codebase.
|
|
1981
1982
|
*/
|
|
1982
1983
|
export interface LoadConfigResults {
|
|
1983
|
-
config:
|
|
1984
|
+
config: ValidatedConfig;
|
|
1984
1985
|
diagnostics: Diagnostic[];
|
|
1985
1986
|
tsconfig: {
|
|
1986
1987
|
path: string;
|
|
@@ -2048,14 +2049,32 @@ export interface PrerenderResults {
|
|
|
2048
2049
|
duration: number;
|
|
2049
2050
|
average: number;
|
|
2050
2051
|
}
|
|
2052
|
+
/**
|
|
2053
|
+
* Input for CSS optimization functions, including the input CSS
|
|
2054
|
+
* string and a few boolean options which turn on or off various
|
|
2055
|
+
* optimizations.
|
|
2056
|
+
*/
|
|
2051
2057
|
export interface OptimizeCssInput {
|
|
2052
2058
|
input: string;
|
|
2053
2059
|
filePath?: string;
|
|
2054
|
-
autoprefixer?:
|
|
2060
|
+
autoprefixer?: boolean | null | AutoprefixerOptions;
|
|
2055
2061
|
minify?: boolean;
|
|
2056
2062
|
sourceMap?: boolean;
|
|
2057
2063
|
resolveUrl?: (url: string) => Promise<string> | string;
|
|
2058
2064
|
}
|
|
2065
|
+
/**
|
|
2066
|
+
* This is not a real interface describing the options which can
|
|
2067
|
+
* be passed to autoprefixer, for that see the docs, here:
|
|
2068
|
+
* https://github.com/postcss/autoprefixer#options
|
|
2069
|
+
*
|
|
2070
|
+
* Instead, this basically just serves as a label type to track
|
|
2071
|
+
* that arguments are being passed consistently.
|
|
2072
|
+
*/
|
|
2073
|
+
export declare type AutoprefixerOptions = Object;
|
|
2074
|
+
/**
|
|
2075
|
+
* Output from CSS optimization functions, wrapping up optimized
|
|
2076
|
+
* CSS and any diagnostics produced during optimization.
|
|
2077
|
+
*/
|
|
2059
2078
|
export interface OptimizeCssOutput {
|
|
2060
2079
|
output: string;
|
|
2061
2080
|
diagnostics: Diagnostic[];
|
|
@@ -1089,5 +1089,5 @@ exports.setMode = e => modeResolutionChain.push(e), exports.setPlatformHelpers =
|
|
|
1089
1089
|
}), 100));
|
|
1090
1090
|
}));
|
|
1091
1091
|
}, exports.stopAutoApplyChanges = stopAutoApplyChanges, exports.styles = styles,
|
|
1092
|
-
exports.
|
|
1092
|
+
exports.supportsConstructableStylesheets = !1, exports.supportsListenerOptions = !0,
|
|
1093
1093
|
exports.win = win, exports.writeTask = writeTask;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rindo/core/internal/testing",
|
|
3
|
-
"version": "2.17.
|
|
3
|
+
"version": "2.17.1",
|
|
4
4
|
"description": "Rindo internal testing platform to be imported by the Rindo Compiler. Breaking changes can and will happen at any time.",
|
|
5
5
|
"main": "./index.js",
|
|
6
6
|
"private": true
|
package/mock-doc/index.cjs
CHANGED
package/mock-doc/index.js
CHANGED
package/mock-doc/package.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rindo/core",
|
|
3
|
-
"version": "2.17.
|
|
3
|
+
"version": "2.17.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "./internal/rindo-core/index.cjs",
|
|
6
6
|
"module": "./internal/rindo-core/index.js",
|
|
@@ -26,8 +26,8 @@
|
|
|
26
26
|
"scripts": {
|
|
27
27
|
"build": "node scripts --prepare && npm run tsc.prod && npm run rollup.prod.ci",
|
|
28
28
|
"changelog": "conventional-changelog -p angular -o -i CHANGELOG.md -s",
|
|
29
|
-
"clean": "
|
|
30
|
-
"clean-scripts": "
|
|
29
|
+
"clean": "rimraf build cli compiler dev-server internal mock-doc sys testing && npm run clean-scripts",
|
|
30
|
+
"clean-scripts": "rimraf scripts/build",
|
|
31
31
|
"license": "node scripts --license",
|
|
32
32
|
"lint": "eslint \"src/*.ts\" \"src/**/*.ts\"",
|
|
33
33
|
"prettier": "npm run prettier.base -- --write",
|
|
@@ -87,6 +87,7 @@
|
|
|
87
87
|
"dts-bundle-generator": "~5.3.0",
|
|
88
88
|
"eslint": "^8.13.0",
|
|
89
89
|
"eslint-config-prettier": "^8.5.0",
|
|
90
|
+
"eslint-plugin-jest": "^26.5.3",
|
|
90
91
|
"eslint-plugin-jsdoc": "^39.3.1",
|
|
91
92
|
"execa": "4.1.0",
|
|
92
93
|
"exit": "^0.1.2",
|
|
@@ -116,6 +117,7 @@
|
|
|
116
117
|
"puppeteer": "~10.0.0",
|
|
117
118
|
"rollup": "2.42.3",
|
|
118
119
|
"rollup-plugin-sourcemaps": "^0.6.3",
|
|
120
|
+
"rimraf": "^3.0.2",
|
|
119
121
|
"semver": "7.3.4",
|
|
120
122
|
"sizzle": "^2.3.6",
|
|
121
123
|
"terser": "5.6.1",
|
package/screenshot/package.json
CHANGED
package/sys/node/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
Rindo Node System v2.17.
|
|
2
|
+
Rindo Node System v2.17.1 | MIT Licensed | https://rindojs.web.app
|
|
3
3
|
*/
|
|
4
4
|
function _interopDefaultLegacy(e) {
|
|
5
5
|
return e && "object" == typeof e && "default" in e ? e : {
|
|
@@ -274,7 +274,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
274
274
|
value: !0
|
|
275
275
|
});
|
|
276
276
|
|
|
277
|
-
const fs = require("./graceful-fs.js"), path = require("path"), require$$1 = require("util"), glob = require("./glob.js"), require$$6 = require("os"), require$$3 = require("crypto"), require$$2 = require("fs"), require$$4 = require("stream"), require$$5 = require("assert"), require$$7 = require("events"), require$$8 = require("buffer"), require$$9 = require("tty"), cp = require("child_process"), fs__default = _interopDefaultLegacy(fs), path__default = _interopDefaultLegacy(path), require$$1__default = _interopDefaultLegacy(require$$1), glob__default = _interopDefaultLegacy(glob), require$$6__default = _interopDefaultLegacy(require$$6), require$$6__namespace = _interopNamespace(require$$6), require$$3__default = _interopDefaultLegacy(require$$3), require$$2__default = _interopDefaultLegacy(require$$2), require$$4__default = _interopDefaultLegacy(require$$4), require$$5__default = _interopDefaultLegacy(require$$5), require$$7__default = _interopDefaultLegacy(require$$7), require$$8__default = _interopDefaultLegacy(require$$8), require$$9__default = _interopDefaultLegacy(require$$9), cp__namespace = _interopNamespace(cp);
|
|
277
|
+
const fs = require("./graceful-fs.js"), path = require("path"), require$$1 = require("util"), glob = require("./glob.js"), require$$6 = require("os"), require$$3 = require("crypto"), require$$2 = require("fs"), require$$4 = require("stream"), require$$5 = require("assert"), require$$7 = require("events"), require$$8 = require("buffer"), require$$9 = require("tty"), cp = require("child_process"), fs__default = _interopDefaultLegacy(fs), path__default = _interopDefaultLegacy(path), require$$1__default = _interopDefaultLegacy(require$$1), glob__default = _interopDefaultLegacy(glob), require$$6__default = _interopDefaultLegacy(require$$6), require$$6__namespace = _interopNamespace(require$$6), require$$3__default = _interopDefaultLegacy(require$$3), require$$2__default = _interopDefaultLegacy(require$$2), require$$4__default = _interopDefaultLegacy(require$$4), require$$5__default = _interopDefaultLegacy(require$$5), require$$7__default = _interopDefaultLegacy(require$$7), require$$8__default = _interopDefaultLegacy(require$$8), require$$9__default = _interopDefaultLegacy(require$$9), cp__namespace = _interopNamespace(cp), LOG_LEVELS = [ "debug", "info", "warn", "error" ];
|
|
278
278
|
|
|
279
279
|
symbols = createCommonjsModule((function(e) {
|
|
280
280
|
const t = "Hyper" === process.env.TERM_PROGRAM, r = "win32" === process.platform, n = "linux" === process.platform, i = {
|
|
@@ -607,7 +607,7 @@ const createTerminalLogger = e => {
|
|
|
607
607
|
red: ansiColors.red,
|
|
608
608
|
yellow: ansiColors.yellow
|
|
609
609
|
};
|
|
610
|
-
},
|
|
610
|
+
}, shouldLog = (e, t) => LOG_LEVELS.indexOf(t) >= LOG_LEVELS.indexOf(e), formatPrefixTimestamp = () => {
|
|
611
611
|
const e = new Date;
|
|
612
612
|
return `[${clampTwoDigits(e.getMinutes())}:${clampTwoDigits(e.getSeconds())}.${Math.floor(e.getMilliseconds() / 1e3 * 10)}]`;
|
|
613
613
|
}, clampTwoDigits = e => ("0" + e.toString()).slice(-2), wordWrap = (e, t) => {
|
|
@@ -5632,7 +5632,7 @@ exports.createNodeLogger = e => {
|
|
|
5632
5632
|
getColumns: () => {
|
|
5633
5633
|
var t, r;
|
|
5634
5634
|
const n = null !== (r = null === (t = null == e ? void 0 : e.stdout) || void 0 === t ? void 0 : t.columns) && void 0 !== r ? r : 80;
|
|
5635
|
-
return Math.max(Math.min(
|
|
5635
|
+
return Math.max(Math.min(n, 120), 60);
|
|
5636
5636
|
},
|
|
5637
5637
|
memoryUsage: () => e.memoryUsage().rss,
|
|
5638
5638
|
relativePath: (e, t) => path__default.default.relative(e, t),
|
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, mockCompilerSystem, mockWindow, mockModule, } from './mocks';
|
|
6
|
+
export { mockBuildCtx, mockConfig, mockCompilerCtx, mockDocument, mockLoadConfigInit, mockValidatedConfig, 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.17.
|
|
2
|
+
Rindo Testing v2.17.1 | MIT Licensed | https://rindojs.web.app
|
|
3
3
|
*/
|
|
4
4
|
function _lazyRequire(e) {
|
|
5
5
|
return new Proxy({}, {
|
|
@@ -817,6 +817,10 @@ function mockCompilerCtx(e) {
|
|
|
817
817
|
}), t;
|
|
818
818
|
}
|
|
819
819
|
|
|
820
|
+
function mockLogger() {
|
|
821
|
+
return new TestingLogger;
|
|
822
|
+
}
|
|
823
|
+
|
|
820
824
|
function findRootComponent(e, t) {
|
|
821
825
|
if (null != t) {
|
|
822
826
|
const r = t.children, s = r.length;
|
|
@@ -2162,15 +2166,14 @@ const YELLOW = "#f39c12", RED = "#c0392b", BLUE = "#3498db", COMMON_DIR_MODULE_E
|
|
|
2162
2166
|
let o = s.shift();
|
|
2163
2167
|
o.startsWith("@") && (o += "/" + s.shift());
|
|
2164
2168
|
const i = s.join("/");
|
|
2165
|
-
|
|
2166
|
-
|
|
2167
|
-
|
|
2168
|
-
|
|
2169
|
-
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
}
|
|
2173
|
-
return e.getRemoteModuleUrl({
|
|
2169
|
+
return "@rindo/core" === o ? ((e, t) => {
|
|
2170
|
+
let r = (t = normalizePath(t)).split("/");
|
|
2171
|
+
const s = r.lastIndexOf("node_modules");
|
|
2172
|
+
s > -1 && s < r.length - 1 && (r = r.slice(s + 1), r = r[0].startsWith("@") ? r.slice(2) : r.slice(1),
|
|
2173
|
+
t = r.join("/"));
|
|
2174
|
+
const n = new URL("../", e).href;
|
|
2175
|
+
return new URL("./" + t, n).href;
|
|
2176
|
+
})(e.getCompilerExecutingPath(), i) : e.getRemoteModuleUrl({
|
|
2174
2177
|
moduleId: o,
|
|
2175
2178
|
version: t.get(o),
|
|
2176
2179
|
path: i
|
|
@@ -2182,7 +2185,7 @@ const YELLOW = "#f39c12", RED = "#c0392b", BLUE = "#3498db", COMMON_DIR_MODULE_E
|
|
|
2182
2185
|
const r = e.split("/"), s = r[r.length - 2], n = r[r.length - 1];
|
|
2183
2186
|
return !("node_modules" !== s || !isCommonDirModuleFile(n));
|
|
2184
2187
|
})(n) || known404Urls.has(s) || (e => knownUrlSkips.some((t => e.endsWith(t))))(s))) try {
|
|
2185
|
-
const o = await ((e, t, r) =>
|
|
2188
|
+
const o = await ((e, t, r) => e && isFunction(e.fetch) ? e.fetch(t, r) : fetch(t, r))(e, s);
|
|
2186
2189
|
if (o) {
|
|
2187
2190
|
if (o.ok) {
|
|
2188
2191
|
const i = await o.clone().text();
|
|
@@ -3041,7 +3044,7 @@ const createSystem = e => {
|
|
|
3041
3044
|
u("/");
|
|
3042
3045
|
const D = {
|
|
3043
3046
|
name: "in-memory",
|
|
3044
|
-
version: "2.17.
|
|
3047
|
+
version: "2.17.1",
|
|
3045
3048
|
events: i,
|
|
3046
3049
|
access: async e => c(e),
|
|
3047
3050
|
accessSync: c,
|
|
@@ -3798,8 +3801,8 @@ exports.createJestPuppeteerEnvironment = function createJestPuppeteerEnvironment
|
|
|
3798
3801
|
}, exports.createTesting = async e => {
|
|
3799
3802
|
e = function t(e) {
|
|
3800
3803
|
return e.buildEs5 = !1, e.devMode = !0, e.minifyCss = !1, e.minifyJs = !1, e.hashFileNames = !1,
|
|
3801
|
-
e.validateTypes = !1, e._isTesting = !0, e.buildDist = !0, e.flags = e.flags
|
|
3802
|
-
e.
|
|
3804
|
+
e.validateTypes = !1, e._isTesting = !0, e.buildDist = !0, e.flags.serve = !1, e.flags.open = !1,
|
|
3805
|
+
e.outputTargets.forEach((e => {
|
|
3803
3806
|
"www" === e.type && (e.serviceWorker = null);
|
|
3804
3807
|
})), e.flags.args.includes("--watchAll") && (e.watch = !0), e;
|
|
3805
3808
|
}(e);
|
|
@@ -3937,9 +3940,14 @@ exports.createJestPuppeteerEnvironment = function createJestPuppeteerEnvironment
|
|
|
3937
3940
|
return createTestingSystem();
|
|
3938
3941
|
}, exports.mockConfig = mockConfig, exports.mockDocument = function mockDocument(e = null) {
|
|
3939
3942
|
return new index_cjs.MockWindow(e).document;
|
|
3940
|
-
}, exports.mockFetch = mockFetch, exports.
|
|
3941
|
-
|
|
3942
|
-
|
|
3943
|
+
}, exports.mockFetch = mockFetch, exports.mockLoadConfigInit = e => ({
|
|
3944
|
+
config: {},
|
|
3945
|
+
configPath: void 0,
|
|
3946
|
+
initTsConfig: !0,
|
|
3947
|
+
logger: void 0,
|
|
3948
|
+
sys: void 0,
|
|
3949
|
+
...e
|
|
3950
|
+
}), exports.mockLogger = mockLogger, exports.mockModule = (e = {}) => ({
|
|
3943
3951
|
cmps: [],
|
|
3944
3952
|
coreRuntimeApis: [],
|
|
3945
3953
|
collectionName: "",
|
|
@@ -3973,7 +3981,13 @@ exports.createJestPuppeteerEnvironment = function createJestPuppeteerEnvironment
|
|
|
3973
3981
|
hasVdomText: !1,
|
|
3974
3982
|
hasVdomXlink: !1,
|
|
3975
3983
|
...e
|
|
3976
|
-
}), exports.
|
|
3984
|
+
}), exports.mockValidatedConfig = function mockValidatedConfig(e) {
|
|
3985
|
+
return {
|
|
3986
|
+
...mockConfig(e),
|
|
3987
|
+
flags: {},
|
|
3988
|
+
logger: mockLogger()
|
|
3989
|
+
};
|
|
3990
|
+
}, exports.mockWindow = function mockWindow(e = null) {
|
|
3977
3991
|
return new index_cjs.MockWindow(e);
|
|
3978
3992
|
}, exports.newE2EPage = async function newE2EPage(e = {}) {
|
|
3979
3993
|
if (!global.__NEW_TEST_PAGE__) throw new Error("newE2EPage() is only available from E2E tests, and ran with the --e2e cmd line flag.");
|
|
@@ -4076,26 +4090,28 @@ exports.createJestPuppeteerEnvironment = function createJestPuppeteerEnvironment
|
|
|
4076
4090
|
};
|
|
4077
4091
|
const o = !0 === e.failOnConsoleError, i = !0 === e.failOnNetworkError;
|
|
4078
4092
|
t.on("console", (e => {
|
|
4079
|
-
"error" === e.type() && (r.push({
|
|
4093
|
+
if ("error" === e.type() && (r.push({
|
|
4080
4094
|
type: "error",
|
|
4081
4095
|
message: e.text(),
|
|
4082
4096
|
location: e.location().url
|
|
4083
|
-
}), o
|
|
4097
|
+
}), o)) throw new Error(serializeConsoleMessage(e));
|
|
4098
|
+
!function t(e) {
|
|
4084
4099
|
const t = serializeConsoleMessage(e), r = e.type(), s = "warning" === r ? "warn" : r;
|
|
4085
4100
|
"debug" !== s && ("function" == typeof console[s] ? console[s](t) : console.log(r, t));
|
|
4086
4101
|
}(e);
|
|
4087
4102
|
})), t.on("pageerror", (e => {
|
|
4088
|
-
r.push({
|
|
4103
|
+
throw r.push({
|
|
4089
4104
|
type: "pageerror",
|
|
4090
4105
|
message: e.message,
|
|
4091
4106
|
location: e.stack
|
|
4092
|
-
}),
|
|
4107
|
+
}), e;
|
|
4093
4108
|
})), t.on("requestfailed", (e => {
|
|
4094
|
-
r.push({
|
|
4109
|
+
if (r.push({
|
|
4095
4110
|
type: "requestfailed",
|
|
4096
4111
|
message: e.failure().errorText,
|
|
4097
4112
|
location: e.url()
|
|
4098
|
-
}), i
|
|
4113
|
+
}), i) throw new Error(e.failure().errorText);
|
|
4114
|
+
console.error("requestfailed", e.url());
|
|
4099
4115
|
})), "string" == typeof e.html ? await e2eSetContent(t, e.html, {
|
|
4100
4116
|
waitUntil: e.waitUntil
|
|
4101
4117
|
}) : "string" == typeof e.url ? await e2eGoTo(t, e.url, {
|
|
@@ -5,7 +5,7 @@ import type { Config } from '@jest/types';
|
|
|
5
5
|
* @param config the Rindo config to use while generating Jest CLI arguments
|
|
6
6
|
* @returns the arguments to pass to the Jest CLI, wrapped in an object
|
|
7
7
|
*/
|
|
8
|
-
export declare function buildJestArgv(config: d.
|
|
8
|
+
export declare function buildJestArgv(config: d.ValidatedConfig): Config.Argv;
|
|
9
9
|
/**
|
|
10
10
|
* Generate a Jest run configuration to be used as a part of the `argv` passed to the Jest CLI when it is invoked
|
|
11
11
|
* programmatically
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import type * as d from '@rindo/core/internal';
|
|
2
|
-
|
|
2
|
+
import type { ConfigFlags } from '../../cli/config-flags';
|
|
3
|
+
export declare function runJest(config: d.ValidatedConfig, env: d.E2EProcessEnv): Promise<boolean>;
|
|
3
4
|
/**
|
|
4
5
|
* Creates a Rindo test runner
|
|
5
6
|
* @returns the test runner
|
|
6
7
|
*/
|
|
7
8
|
export declare function createTestRunner(): any;
|
|
8
9
|
export declare function includeTestFile(testPath: string, env: d.E2EProcessEnv): boolean;
|
|
9
|
-
export declare function getEmulateConfigs(testing: d.TestingConfig, flags:
|
|
10
|
+
export declare function getEmulateConfigs(testing: d.TestingConfig, flags: ConfigFlags): d.EmulateConfig[];
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type * as d from '@rindo/core/internal';
|
|
2
|
-
export declare function runJestScreenshot(config: d.
|
|
2
|
+
export declare function runJestScreenshot(config: d.ValidatedConfig, env: d.E2EProcessEnv): Promise<boolean>;
|
package/testing/mocks.d.ts
CHANGED
|
@@ -1,7 +1,32 @@
|
|
|
1
|
-
import type { BuildCtx, Cache, CompilerCtx, CompilerSystem, Config, Module } from '@rindo/core/internal';
|
|
1
|
+
import type { BuildCtx, Cache, CompilerCtx, CompilerSystem, Config, LoadConfigInit, ValidatedConfig, Module, UnvalidatedConfig } from '@rindo/core/internal';
|
|
2
2
|
import { TestingSystem } from './testing-sys';
|
|
3
3
|
import { TestingLogger } from './testing-logger';
|
|
4
|
-
|
|
4
|
+
/**
|
|
5
|
+
* Creates a mock instance of an internal, validated Rindo configuration object
|
|
6
|
+
* @param sys an optional compiler system to associate with the config. If one is not provided, one will be created for
|
|
7
|
+
* the caller
|
|
8
|
+
* @returns the mock Rindo configuration
|
|
9
|
+
*/
|
|
10
|
+
export declare function mockValidatedConfig(sys?: CompilerSystem): ValidatedConfig;
|
|
11
|
+
/**
|
|
12
|
+
* Creates a mock instance of a Rindo configuration entity. The mocked configuration has no guarantees around the
|
|
13
|
+
* types/validity of its data.
|
|
14
|
+
* @param sys an optional compiler system to associate with the config. If one is not provided, one will be created for
|
|
15
|
+
* the caller
|
|
16
|
+
* @returns the mock Rindo configuration
|
|
17
|
+
*/
|
|
18
|
+
export declare function mockConfig(sys?: CompilerSystem): UnvalidatedConfig;
|
|
19
|
+
/**
|
|
20
|
+
* Creates a configuration object used to bootstrap a Rindo task invocation
|
|
21
|
+
*
|
|
22
|
+
* Several fields are intentionally undefined for this entity. While it would be trivial to stub them out, this mock
|
|
23
|
+
* generation function operates under the assumption that entities like loggers and compiler system abstractions will
|
|
24
|
+
* be shared by multiple entities in a test suite, who should provide those entities to this function
|
|
25
|
+
*
|
|
26
|
+
* @param overrides the properties on the default entity to manually override
|
|
27
|
+
* @returns the default configuration initialization object, with any overrides applied
|
|
28
|
+
*/
|
|
29
|
+
export declare const mockLoadConfigInit: (overrides?: Partial<LoadConfigInit>) => LoadConfigInit;
|
|
5
30
|
export declare function mockCompilerCtx(config?: Config): CompilerCtx;
|
|
6
31
|
export declare function mockBuildCtx(config?: Config, compilerCtx?: CompilerCtx): BuildCtx;
|
|
7
32
|
export declare function mockCache(config?: Config, compilerCtx?: CompilerCtx): Cache;
|
package/testing/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ValidatedConfig } from '@rindo/core/internal';
|
|
2
2
|
import type * as puppeteer from 'puppeteer';
|
|
3
|
-
export declare function startPuppeteerBrowser(config:
|
|
3
|
+
export declare function startPuppeteerBrowser(config: ValidatedConfig): Promise<puppeteer.Browser>;
|
|
4
4
|
export declare function connectBrowser(): Promise<any>;
|
|
5
5
|
export declare function disconnectBrowser(browser: puppeteer.Browser): Promise<void>;
|
|
6
6
|
export declare function newBrowserPage(browser: puppeteer.Browser): Promise<puppeteer.Page>;
|
|
@@ -1,6 +1,78 @@
|
|
|
1
|
+
/// <reference types="jest" />
|
|
1
2
|
import type * as d from '@rindo/core/internal';
|
|
2
3
|
export declare function shuffleArray(array: any[]): any[];
|
|
3
|
-
|
|
4
|
-
|
|
4
|
+
/**
|
|
5
|
+
* Testing utility to validate the existence of some provided file paths using a specific file system
|
|
6
|
+
*
|
|
7
|
+
* @param fs the file system to use to validate the existence of some files
|
|
8
|
+
* @param filePaths the paths to validate
|
|
9
|
+
* @throws when one or more of the provided file paths cannot be found
|
|
10
|
+
*/
|
|
11
|
+
export declare function expectFilesExist(fs: d.InMemoryFileSystem, filePaths: string[]): void;
|
|
12
|
+
/**
|
|
13
|
+
* Testing utility to validate the non-existence of some provided file paths using a specific file system
|
|
14
|
+
*
|
|
15
|
+
* @param fs the file system to use to validate the non-existence of some files
|
|
16
|
+
* @param filePaths the paths to validate
|
|
17
|
+
* @throws when one or more of the provided file paths is found
|
|
18
|
+
*/
|
|
19
|
+
export declare function expectFilesDoNotExist(fs: d.InMemoryFileSystem, filePaths: string[]): void;
|
|
5
20
|
export declare function getAppScriptUrl(config: d.Config, browserUrl: string): string;
|
|
6
21
|
export declare function getAppStyleUrl(config: d.Config, browserUrl: string): string;
|
|
22
|
+
/**
|
|
23
|
+
* Utility for silencing `console` functions in tests.
|
|
24
|
+
*
|
|
25
|
+
* When this function is first called it grabs a reference to the `log`,
|
|
26
|
+
* `error`, and `warn` functions on `console` and then returns a per-test setup
|
|
27
|
+
* function which sets up a fresh set of mocks (via `jest.fn()`) and then
|
|
28
|
+
* assigns them to each of these functions. This setup function will return a
|
|
29
|
+
* reference to each of the three mock functions so tests can make assertions
|
|
30
|
+
* about their calls and so on.
|
|
31
|
+
*
|
|
32
|
+
* Because references to the original `.log`, `.error`, and `.warn` functions
|
|
33
|
+
* exist in closure within the function, it can use an `afterAll` call to clean
|
|
34
|
+
* up after itself and ensure that the original implementations are restored
|
|
35
|
+
* after the test suite finishes.
|
|
36
|
+
*
|
|
37
|
+
* An example of using this to silence log statements in a single test could look
|
|
38
|
+
* like this:
|
|
39
|
+
*
|
|
40
|
+
* ```ts
|
|
41
|
+
* describe("my-test-suite", () => {
|
|
42
|
+
* const setupConsoleMocks = setupConsoleMocker()
|
|
43
|
+
*
|
|
44
|
+
* it("should log a message", () => {
|
|
45
|
+
* const { logMock } = setupConsoleMocks();
|
|
46
|
+
* myFunctionWhichLogs(foo, bar);
|
|
47
|
+
* expect(logMock).toBeCalledWith('my log message');
|
|
48
|
+
* })
|
|
49
|
+
* })
|
|
50
|
+
* ```
|
|
51
|
+
*
|
|
52
|
+
* @returns a per-test mock setup function
|
|
53
|
+
*/
|
|
54
|
+
export declare function setupConsoleMocker(): ConsoleMocker;
|
|
55
|
+
interface ConsoleMocker {
|
|
56
|
+
(): {
|
|
57
|
+
logMock: jest.Mock<typeof console.log>;
|
|
58
|
+
warnMock: jest.Mock<typeof console.warn>;
|
|
59
|
+
errorMock: jest.Mock<typeof console.error>;
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* the callback that `withSilentWarn` expects to receive. Basically receives a mock
|
|
64
|
+
* as its argument and returns a `Promise`, the value of which is returns by `withSilentWarn`
|
|
65
|
+
* as well.
|
|
66
|
+
*/
|
|
67
|
+
declare type SilentWarnFunc<T> = (mock: jest.Mock<typeof console.warn>) => Promise<T>;
|
|
68
|
+
/**
|
|
69
|
+
* Wrap a single callback with a silent `console.warn`. The callback passed in
|
|
70
|
+
* receives the mocking function as an argument, so you can easily make assertions
|
|
71
|
+
* that it is called if necessary.
|
|
72
|
+
*
|
|
73
|
+
* @param cb a callback which `withSilentWarn` will call after replacing `console.warn`
|
|
74
|
+
* with a mock.
|
|
75
|
+
* @returns a Promise wrapping the return value of the callback
|
|
76
|
+
*/
|
|
77
|
+
export declare function withSilentWarn<T>(cb: SilentWarnFunc<T>): Promise<T>;
|
|
78
|
+
export {};
|
package/testing/testing.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
export declare const createTesting: (config:
|
|
1
|
+
import type { ValidatedConfig, Testing } from '@rindo/core/internal';
|
|
2
|
+
export declare const createTesting: (config: ValidatedConfig) => Promise<Testing>;
|