@rindo/core 3.0.1 → 3.1.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.
Files changed (111) hide show
  1. package/cli/config-flags.d.ts +122 -122
  2. package/cli/index.cjs +2301 -2432
  3. package/cli/index.d.ts +19 -19
  4. package/cli/index.js +2302 -2433
  5. package/cli/package.json +1 -1
  6. package/compiler/package.json +1 -1
  7. package/compiler/rindo.d.ts +73 -73
  8. package/compiler/rindo.js +66137 -62907
  9. package/compiler/rindo.min.js +2 -2
  10. package/compiler/sys/in-memory-fs.d.ts +218 -218
  11. package/compiler/transpile.d.ts +32 -32
  12. package/dev-server/client/app-error.d.ts +18 -18
  13. package/dev-server/client/events.d.ts +6 -6
  14. package/dev-server/client/hmr-components.d.ts +1 -1
  15. package/dev-server/client/hmr-external-styles.d.ts +1 -1
  16. package/dev-server/client/hmr-images.d.ts +1 -1
  17. package/dev-server/client/hmr-inline-styles.d.ts +1 -1
  18. package/dev-server/client/hmr-util.d.ts +9 -9
  19. package/dev-server/client/hmr-window.d.ts +10 -10
  20. package/dev-server/client/index.d.ts +6 -6
  21. package/dev-server/client/index.js +781 -781
  22. package/dev-server/client/logger.d.ts +5 -5
  23. package/dev-server/client/package.json +1 -1
  24. package/dev-server/client/progress.d.ts +3 -3
  25. package/dev-server/client/status.d.ts +4 -4
  26. package/dev-server/connector.html +2 -2
  27. package/dev-server/index.d.ts +3 -3
  28. package/dev-server/index.js +228 -228
  29. package/dev-server/open-in-editor-api.js +1 -1
  30. package/dev-server/package.json +1 -1
  31. package/dev-server/server-process.js +1300 -1281
  32. package/dev-server/ws.js +1 -1
  33. package/dev-server/xdg-open +0 -0
  34. package/internal/app-data/index.cjs +88 -88
  35. package/internal/app-data/index.d.ts +4 -4
  36. package/internal/app-data/index.js +88 -88
  37. package/internal/app-data/package.json +1 -1
  38. package/internal/client/css-shim.js +1 -1
  39. package/internal/client/dom.js +1 -1
  40. package/internal/client/index.js +3380 -3380
  41. package/internal/client/package.json +1 -1
  42. package/internal/client/patch-browser.js +155 -155
  43. package/internal/client/patch-esm.js +25 -25
  44. package/internal/client/shadow-css.js +382 -382
  45. package/internal/hydrate/package.json +1 -1
  46. package/internal/index.d.ts +2 -2
  47. package/internal/index.js +1 -1
  48. package/internal/package.json +1 -1
  49. package/internal/rindo-private.d.ts +2272 -2268
  50. package/internal/rindo-public-compiler.d.ts +2377 -2356
  51. package/internal/rindo-public-docs.d.ts +139 -139
  52. package/internal/rindo-public-runtime.d.ts +1636 -1636
  53. package/internal/testing/package.json +1 -1
  54. package/mock-doc/index.cjs +4766 -4766
  55. package/mock-doc/index.d.ts +1006 -1006
  56. package/mock-doc/index.js +4766 -4766
  57. package/mock-doc/package.json +1 -1
  58. package/package.json +9 -9
  59. package/screenshot/connector-base.d.ts +42 -42
  60. package/screenshot/connector-local.d.ts +7 -7
  61. package/screenshot/index.d.ts +3 -3
  62. package/screenshot/index.js +615 -615
  63. package/screenshot/package.json +1 -1
  64. package/screenshot/pixel-match.d.ts +1 -1
  65. package/screenshot/pixel-match.js +14 -14
  66. package/screenshot/screenshot-compare.d.ts +3 -3
  67. package/screenshot/screenshot-fs.d.ts +15 -15
  68. package/sys/node/autoprefixer.js +2 -2
  69. package/sys/node/glob.js +1 -1
  70. package/sys/node/graceful-fs.js +1 -1
  71. package/sys/node/index.d.ts +22 -22
  72. package/sys/node/index.js +6 -3
  73. package/sys/node/node-fetch.js +1 -1
  74. package/sys/node/package.json +1 -1
  75. package/sys/node/prompts.js +1 -1
  76. package/sys/node/worker.js +1 -1
  77. package/testing/index.d.ts +12 -12
  78. package/testing/index.js +7 -3
  79. package/testing/jest/jest-config.d.ts +16 -16
  80. package/testing/jest/jest-environment.d.ts +15 -15
  81. package/testing/jest/jest-preprocessor.d.ts +59 -59
  82. package/testing/jest/jest-runner.d.ts +10 -10
  83. package/testing/jest/jest-screenshot.d.ts +2 -2
  84. package/testing/jest/jest-serializer.d.ts +4 -4
  85. package/testing/jest/jest-setup-test-framework.d.ts +1 -1
  86. package/testing/matchers/attributes.d.ts +14 -14
  87. package/testing/matchers/class-list.d.ts +12 -12
  88. package/testing/matchers/events.d.ts +21 -21
  89. package/testing/matchers/html.d.ts +12 -12
  90. package/testing/matchers/index.d.ts +23 -23
  91. package/testing/matchers/screenshot.d.ts +5 -5
  92. package/testing/matchers/text.d.ts +4 -4
  93. package/testing/mock-fetch.d.ts +11 -11
  94. package/testing/mocks.d.ts +56 -56
  95. package/testing/package.json +1 -1
  96. package/testing/puppeteer/index.d.ts +2 -2
  97. package/testing/puppeteer/puppeteer-browser.d.ts +6 -6
  98. package/testing/puppeteer/puppeteer-declarations.d.ts +403 -403
  99. package/testing/puppeteer/puppeteer-element.d.ts +67 -67
  100. package/testing/puppeteer/puppeteer-emulate.d.ts +2 -2
  101. package/testing/puppeteer/puppeteer-events.d.ts +21 -21
  102. package/testing/puppeteer/puppeteer-page.d.ts +2 -2
  103. package/testing/puppeteer/puppeteer-screenshot.d.ts +4 -4
  104. package/testing/reset-build-conditionals.d.ts +2 -2
  105. package/testing/spec-page.d.ts +2 -2
  106. package/testing/test-transpile.d.ts +2 -2
  107. package/testing/testing-logger.d.ts +25 -25
  108. package/testing/testing-sys.d.ts +6 -6
  109. package/testing/testing-utils.d.ts +79 -79
  110. package/testing/testing.d.ts +2 -2
  111. package/dependencies.json +0 -120
@@ -1,67 +1,67 @@
1
- import type { EventInitDict } from '@rindo/core/internal';
2
- import { MockHTMLElement } from '@rindo/core/mock-doc';
3
- import type * as puppeteer from 'puppeteer';
4
- import type * as pd from './puppeteer-declarations';
5
- import { EventSpy } from './puppeteer-events';
6
- export declare class E2EElement extends MockHTMLElement implements pd.E2EElementInternal {
7
- private _page;
8
- private _elmHandle;
9
- private _queuedActions;
10
- private _queueAction;
11
- constructor(_page: pd.E2EPageInternal, _elmHandle: puppeteer.ElementHandle);
12
- find(selector: string): Promise<E2EElement>;
13
- findAll(selector: string): Promise<E2EElement[]>;
14
- callMethod(methodName: string, ...methodArgs: any[]): Promise<any>;
15
- triggerEvent(eventName: string, eventInitDict?: EventInitDict): void;
16
- spyOnEvent(eventName: string): Promise<EventSpy>;
17
- click(options?: puppeteer.ClickOptions): Promise<void>;
18
- focus(): Promise<void>;
19
- hover(): Promise<void>;
20
- isVisible(): Promise<boolean>;
21
- waitForEvent(eventName: string): Promise<any>;
22
- waitForVisible(): Promise<void>;
23
- waitForNotVisible(): Promise<void>;
24
- isIntersectingViewport(): Promise<boolean>;
25
- press(key: puppeteer.KeyInput, options?: {
26
- text?: string;
27
- delay?: number;
28
- }): Promise<void>;
29
- tap(): Promise<void>;
30
- type(text: string, options?: {
31
- delay: number;
32
- }): Promise<void>;
33
- getProperty(propertyName: string): Promise<any>;
34
- setProperty(propertyName: string, value: any): void;
35
- getAttribute(name: string): any;
36
- setAttribute(name: string, value: any): void;
37
- removeAttribute(name: string): void;
38
- toggleAttribute(name: string, force?: boolean): void;
39
- get classList(): any;
40
- get className(): string;
41
- set className(value: string);
42
- get id(): string;
43
- set id(value: string);
44
- get innerHTML(): string;
45
- set innerHTML(value: string);
46
- get innerText(): string;
47
- set innerText(value: string);
48
- get nodeValue(): string;
49
- set nodeValue(value: string);
50
- get outerHTML(): any;
51
- set outerHTML(_: any);
52
- get shadowRoot(): any;
53
- set shadowRoot(value: any);
54
- get tabIndex(): number;
55
- set tabIndex(value: number);
56
- get textContent(): string;
57
- set textContent(value: string);
58
- get title(): string;
59
- set title(value: string);
60
- getComputedStyle(pseudoElt?: string | null): Promise<any>;
61
- e2eRunActions(): Promise<any>;
62
- e2eSync(): Promise<void>;
63
- private _validate;
64
- e2eDispose(): Promise<void>;
65
- }
66
- export declare function find(page: pd.E2EPageInternal, rootHandle: puppeteer.ElementHandle, selector: pd.FindSelector): Promise<E2EElement>;
67
- export declare function findAll(page: pd.E2EPageInternal, rootHandle: puppeteer.ElementHandle, selector: pd.FindSelector): Promise<E2EElement[]>;
1
+ import type { EventInitDict } from '@rindo/core/internal';
2
+ import { MockHTMLElement } from '@rindo/core/mock-doc';
3
+ import type * as puppeteer from 'puppeteer';
4
+ import type * as pd from './puppeteer-declarations';
5
+ import { EventSpy } from './puppeteer-events';
6
+ export declare class E2EElement extends MockHTMLElement implements pd.E2EElementInternal {
7
+ private _page;
8
+ private _elmHandle;
9
+ private _queuedActions;
10
+ private _queueAction;
11
+ constructor(_page: pd.E2EPageInternal, _elmHandle: puppeteer.ElementHandle);
12
+ find(selector: string): Promise<E2EElement>;
13
+ findAll(selector: string): Promise<E2EElement[]>;
14
+ callMethod(methodName: string, ...methodArgs: any[]): Promise<any>;
15
+ triggerEvent(eventName: string, eventInitDict?: EventInitDict): void;
16
+ spyOnEvent(eventName: string): Promise<EventSpy>;
17
+ click(options?: puppeteer.ClickOptions): Promise<void>;
18
+ focus(): Promise<void>;
19
+ hover(): Promise<void>;
20
+ isVisible(): Promise<boolean>;
21
+ waitForEvent(eventName: string): Promise<any>;
22
+ waitForVisible(): Promise<void>;
23
+ waitForNotVisible(): Promise<void>;
24
+ isIntersectingViewport(): Promise<boolean>;
25
+ press(key: puppeteer.KeyInput, options?: {
26
+ text?: string;
27
+ delay?: number;
28
+ }): Promise<void>;
29
+ tap(): Promise<void>;
30
+ type(text: string, options?: {
31
+ delay: number;
32
+ }): Promise<void>;
33
+ getProperty(propertyName: string): Promise<any>;
34
+ setProperty(propertyName: string, value: any): void;
35
+ getAttribute(name: string): any;
36
+ setAttribute(name: string, value: any): void;
37
+ removeAttribute(name: string): void;
38
+ toggleAttribute(name: string, force?: boolean): void;
39
+ get classList(): any;
40
+ get className(): string;
41
+ set className(value: string);
42
+ get id(): string;
43
+ set id(value: string);
44
+ get innerHTML(): string;
45
+ set innerHTML(value: string);
46
+ get innerText(): string;
47
+ set innerText(value: string);
48
+ get nodeValue(): string;
49
+ set nodeValue(value: string);
50
+ get outerHTML(): any;
51
+ set outerHTML(_: any);
52
+ get shadowRoot(): any;
53
+ set shadowRoot(value: any);
54
+ get tabIndex(): number;
55
+ set tabIndex(value: number);
56
+ get textContent(): string;
57
+ set textContent(value: string);
58
+ get title(): string;
59
+ set title(value: string);
60
+ getComputedStyle(pseudoElt?: string | null): Promise<any>;
61
+ e2eRunActions(): Promise<any>;
62
+ e2eSync(): Promise<void>;
63
+ private _validate;
64
+ e2eDispose(): Promise<void>;
65
+ }
66
+ export declare function find(page: pd.E2EPageInternal, rootHandle: puppeteer.ElementHandle, selector: pd.FindSelector): Promise<E2EElement>;
67
+ export declare function findAll(page: pd.E2EPageInternal, rootHandle: puppeteer.ElementHandle, selector: pd.FindSelector): Promise<E2EElement[]>;
@@ -1,2 +1,2 @@
1
- import type { E2EProcessEnv, EmulateConfig } from '@rindo/core/internal';
2
- export declare function setScreenshotEmulateData(userEmulateConfig: EmulateConfig, env: E2EProcessEnv): void;
1
+ import type { E2EProcessEnv, EmulateConfig } from '@rindo/core/internal';
2
+ export declare function setScreenshotEmulateData(userEmulateConfig: EmulateConfig, env: E2EProcessEnv): void;
@@ -1,21 +1,21 @@
1
- import type { SerializedEvent } from '@rindo/core/internal';
2
- import type * as puppeteer from 'puppeteer';
3
- import type * as pd from './puppeteer-declarations';
4
- export declare function initPageEvents(page: pd.E2EPageInternal): Promise<void>;
5
- export declare function waitForEvent(page: pd.E2EPageInternal, eventName: string, elementHandle: puppeteer.ElementHandle): Promise<any>;
6
- export declare class EventSpy implements EventSpy {
7
- eventName: string;
8
- events: SerializedEvent[];
9
- private cursor;
10
- private queuedHandler;
11
- constructor(eventName: string);
12
- get length(): number;
13
- get firstEvent(): SerializedEvent;
14
- get lastEvent(): SerializedEvent;
15
- next(): Promise<{
16
- done: boolean;
17
- value: SerializedEvent;
18
- }>;
19
- push(ev: SerializedEvent): void;
20
- }
21
- export declare function addE2EListener(page: pd.E2EPageInternal, elmHandle: puppeteer.JSHandle, eventName: string, callback: (ev: any) => void): Promise<void>;
1
+ import type { SerializedEvent } from '@rindo/core/internal';
2
+ import type * as puppeteer from 'puppeteer';
3
+ import type * as pd from './puppeteer-declarations';
4
+ export declare function initPageEvents(page: pd.E2EPageInternal): Promise<void>;
5
+ export declare function waitForEvent(page: pd.E2EPageInternal, eventName: string, elementHandle: puppeteer.ElementHandle): Promise<any>;
6
+ export declare class EventSpy implements EventSpy {
7
+ eventName: string;
8
+ events: SerializedEvent[];
9
+ private cursor;
10
+ private queuedHandler;
11
+ constructor(eventName: string);
12
+ get length(): number;
13
+ get firstEvent(): SerializedEvent;
14
+ get lastEvent(): SerializedEvent;
15
+ next(): Promise<{
16
+ done: boolean;
17
+ value: SerializedEvent;
18
+ }>;
19
+ push(ev: SerializedEvent): void;
20
+ }
21
+ export declare function addE2EListener(page: pd.E2EPageInternal, elmHandle: puppeteer.JSHandle, eventName: string, callback: (ev: any) => void): Promise<void>;
@@ -1,2 +1,2 @@
1
- import type { E2EPage, NewE2EPageOptions } from './puppeteer-declarations';
2
- export declare function newE2EPage(opts?: NewE2EPageOptions): Promise<E2EPage>;
1
+ import type { E2EPage, NewE2EPageOptions } from './puppeteer-declarations';
2
+ export declare function newE2EPage(opts?: NewE2EPageOptions): Promise<E2EPage>;
@@ -1,4 +1,4 @@
1
- import type { E2EProcessEnv, ScreenshotDiff, ScreenshotOptions } from '@rindo/core/internal';
2
- import type * as pd from './puppeteer-declarations';
3
- export declare function initPageScreenshot(page: pd.E2EPageInternal): void;
4
- export declare function pageCompareScreenshot(page: pd.E2EPageInternal, env: E2EProcessEnv, desc: string, testPath: string, opts: ScreenshotOptions): Promise<ScreenshotDiff>;
1
+ import type { E2EProcessEnv, ScreenshotDiff, ScreenshotOptions } from '@rindo/core/internal';
2
+ import type * as pd from './puppeteer-declarations';
3
+ export declare function initPageScreenshot(page: pd.E2EPageInternal): void;
4
+ export declare function pageCompareScreenshot(page: pd.E2EPageInternal, env: E2EProcessEnv, desc: string, testPath: string, opts: ScreenshotOptions): Promise<ScreenshotDiff>;
@@ -1,2 +1,2 @@
1
- import type * as d from '@rindo/core/internal';
2
- export declare function resetBuildConditionals(b: d.BuildConditionals): void;
1
+ import type * as d from '@rindo/core/internal';
2
+ export declare function resetBuildConditionals(b: d.BuildConditionals): void;
@@ -1,2 +1,2 @@
1
- import type { NewSpecPageOptions, SpecPage } from '@rindo/core/internal';
2
- export declare function newSpecPage(opts: NewSpecPageOptions): Promise<SpecPage>;
1
+ import type { NewSpecPageOptions, SpecPage } from '@rindo/core/internal';
2
+ export declare function newSpecPage(opts: NewSpecPageOptions): Promise<SpecPage>;
@@ -1,2 +1,2 @@
1
- import type { TranspileOptions, TranspileResults } from '@rindo/core/internal';
2
- export declare function transpile(input: string, opts?: TranspileOptions): TranspileResults;
1
+ import type { TranspileOptions, TranspileResults } from '@rindo/core/internal';
2
+ export declare function transpile(input: string, opts?: TranspileOptions): TranspileResults;
@@ -1,25 +1,25 @@
1
- import type { Diagnostic, Logger, LoggerTimeSpan, LogLevel } from '@rindo/core/internal';
2
- export declare class TestingLogger implements Logger {
3
- private isEnabled;
4
- setLevel(_level: LogLevel): void;
5
- getLevel(): LogLevel;
6
- enableColors(_useColors: boolean): void;
7
- emoji(_: string): string;
8
- info(...msg: any[]): void;
9
- warn(...msg: any[]): void;
10
- error(...msg: any[]): void;
11
- debug(...msg: any[]): void;
12
- color(_msg: string, _color: 'red' | 'green' | 'yellow' | 'blue' | 'magenta' | 'cyan' | 'gray'): void;
13
- red(msg: string): string;
14
- green(msg: string): string;
15
- yellow(msg: string): string;
16
- blue(msg: string): string;
17
- magenta(msg: string): string;
18
- cyan(msg: string): string;
19
- gray(msg: string): string;
20
- bold(msg: string): string;
21
- dim(msg: string): string;
22
- bgRed(msg: string): string;
23
- createTimeSpan(_startMsg: string, _debug?: boolean): LoggerTimeSpan;
24
- printDiagnostics(_diagnostics: Diagnostic[]): void;
25
- }
1
+ import type { Diagnostic, Logger, LoggerTimeSpan, LogLevel } from '@rindo/core/internal';
2
+ export declare class TestingLogger implements Logger {
3
+ private isEnabled;
4
+ setLevel(_level: LogLevel): void;
5
+ getLevel(): LogLevel;
6
+ enableColors(_useColors: boolean): void;
7
+ emoji(_: string): string;
8
+ info(...msg: any[]): void;
9
+ warn(...msg: any[]): void;
10
+ error(...msg: any[]): void;
11
+ debug(...msg: any[]): void;
12
+ color(_msg: string, _color: 'red' | 'green' | 'yellow' | 'blue' | 'magenta' | 'cyan' | 'gray'): void;
13
+ red(msg: string): string;
14
+ green(msg: string): string;
15
+ yellow(msg: string): string;
16
+ blue(msg: string): string;
17
+ magenta(msg: string): string;
18
+ cyan(msg: string): string;
19
+ gray(msg: string): string;
20
+ bold(msg: string): string;
21
+ dim(msg: string): string;
22
+ bgRed(msg: string): string;
23
+ createTimeSpan(_startMsg: string, _debug?: boolean): LoggerTimeSpan;
24
+ printDiagnostics(_diagnostics: Diagnostic[]): void;
25
+ }
@@ -1,6 +1,6 @@
1
- import type { CompilerSystem } from '@rindo/core/internal';
2
- export interface TestingSystem extends CompilerSystem {
3
- diskReads: number;
4
- diskWrites: number;
5
- }
6
- export declare const createTestingSystem: () => TestingSystem;
1
+ import type { CompilerSystem } from '@rindo/core/internal';
2
+ export interface TestingSystem extends CompilerSystem {
3
+ diskReads: number;
4
+ diskWrites: number;
5
+ }
6
+ export declare const createTestingSystem: () => TestingSystem;
@@ -1,79 +1,79 @@
1
- /// <reference types="jest" />
2
- import type * as d from '@rindo/core/internal';
3
- import { InMemoryFileSystem } from '../compiler/sys/in-memory-fs';
4
- export declare function shuffleArray(array: any[]): any[];
5
- /**
6
- * Testing utility to validate the existence of some provided file paths using a specific file system
7
- *
8
- * @param fs the file system to use to validate the existence of some files
9
- * @param filePaths the paths to validate
10
- * @throws when one or more of the provided file paths cannot be found
11
- */
12
- export declare function expectFilesExist(fs: InMemoryFileSystem, filePaths: string[]): void;
13
- /**
14
- * Testing utility to validate the non-existence of some provided file paths using a specific file system
15
- *
16
- * @param fs the file system to use to validate the non-existence of some files
17
- * @param filePaths the paths to validate
18
- * @throws when one or more of the provided file paths is found
19
- */
20
- export declare function expectFilesDoNotExist(fs: InMemoryFileSystem, filePaths: string[]): void;
21
- export declare function getAppScriptUrl(config: d.ValidatedConfig, browserUrl: string): string;
22
- export declare function getAppStyleUrl(config: d.ValidatedConfig, browserUrl: string): string;
23
- /**
24
- * Utility for silencing `console` functions in tests.
25
- *
26
- * When this function is first called it grabs a reference to the `log`,
27
- * `error`, and `warn` functions on `console` and then returns a per-test setup
28
- * function which sets up a fresh set of mocks (via `jest.fn()`) and then
29
- * assigns them to each of these functions. This setup function will return a
30
- * reference to each of the three mock functions so tests can make assertions
31
- * about their calls and so on.
32
- *
33
- * Because references to the original `.log`, `.error`, and `.warn` functions
34
- * exist in closure within the function, it can use an `afterAll` call to clean
35
- * up after itself and ensure that the original implementations are restored
36
- * after the test suite finishes.
37
- *
38
- * An example of using this to silence log statements in a single test could look
39
- * like this:
40
- *
41
- * ```ts
42
- * describe("my-test-suite", () => {
43
- * const setupConsoleMocks = setupConsoleMocker()
44
- *
45
- * it("should log a message", () => {
46
- * const { logMock } = setupConsoleMocks();
47
- * myFunctionWhichLogs(foo, bar);
48
- * expect(logMock).toBeCalledWith('my log message');
49
- * })
50
- * })
51
- * ```
52
- *
53
- * @returns a per-test mock setup function
54
- */
55
- export declare function setupConsoleMocker(): ConsoleMocker;
56
- interface ConsoleMocker {
57
- (): {
58
- logMock: jest.Mock<typeof console.log>;
59
- warnMock: jest.Mock<typeof console.warn>;
60
- errorMock: jest.Mock<typeof console.error>;
61
- };
62
- }
63
- /**
64
- * the callback that `withSilentWarn` expects to receive. Basically receives a mock
65
- * as its argument and returns a `Promise`, the value of which is returns by `withSilentWarn`
66
- * as well.
67
- */
68
- type SilentWarnFunc<T> = (mock: jest.Mock<typeof console.warn>) => Promise<T>;
69
- /**
70
- * Wrap a single callback with a silent `console.warn`. The callback passed in
71
- * receives the mocking function as an argument, so you can easily make assertions
72
- * that it is called if necessary.
73
- *
74
- * @param cb a callback which `withSilentWarn` will call after replacing `console.warn`
75
- * with a mock.
76
- * @returns a Promise wrapping the return value of the callback
77
- */
78
- export declare function withSilentWarn<T>(cb: SilentWarnFunc<T>): Promise<T>;
79
- export {};
1
+ /// <reference types="jest" />
2
+ import type * as d from '@rindo/core/internal';
3
+ import { InMemoryFileSystem } from '../compiler/sys/in-memory-fs';
4
+ export declare function shuffleArray(array: any[]): any[];
5
+ /**
6
+ * Testing utility to validate the existence of some provided file paths using a specific file system
7
+ *
8
+ * @param fs the file system to use to validate the existence of some files
9
+ * @param filePaths the paths to validate
10
+ * @throws when one or more of the provided file paths cannot be found
11
+ */
12
+ export declare function expectFilesExist(fs: InMemoryFileSystem, filePaths: string[]): void;
13
+ /**
14
+ * Testing utility to validate the non-existence of some provided file paths using a specific file system
15
+ *
16
+ * @param fs the file system to use to validate the non-existence of some files
17
+ * @param filePaths the paths to validate
18
+ * @throws when one or more of the provided file paths is found
19
+ */
20
+ export declare function expectFilesDoNotExist(fs: InMemoryFileSystem, filePaths: string[]): void;
21
+ export declare function getAppScriptUrl(config: d.ValidatedConfig, browserUrl: string): string;
22
+ export declare function getAppStyleUrl(config: d.ValidatedConfig, browserUrl: string): string;
23
+ /**
24
+ * Utility for silencing `console` functions in tests.
25
+ *
26
+ * When this function is first called it grabs a reference to the `log`,
27
+ * `error`, and `warn` functions on `console` and then returns a per-test setup
28
+ * function which sets up a fresh set of mocks (via `jest.fn()`) and then
29
+ * assigns them to each of these functions. This setup function will return a
30
+ * reference to each of the three mock functions so tests can make assertions
31
+ * about their calls and so on.
32
+ *
33
+ * Because references to the original `.log`, `.error`, and `.warn` functions
34
+ * exist in closure within the function, it can use an `afterAll` call to clean
35
+ * up after itself and ensure that the original implementations are restored
36
+ * after the test suite finishes.
37
+ *
38
+ * An example of using this to silence log statements in a single test could look
39
+ * like this:
40
+ *
41
+ * ```ts
42
+ * describe("my-test-suite", () => {
43
+ * const setupConsoleMocks = setupConsoleMocker()
44
+ *
45
+ * it("should log a message", () => {
46
+ * const { logMock } = setupConsoleMocks();
47
+ * myFunctionWhichLogs(foo, bar);
48
+ * expect(logMock).toBeCalledWith('my log message');
49
+ * })
50
+ * })
51
+ * ```
52
+ *
53
+ * @returns a per-test mock setup function
54
+ */
55
+ export declare function setupConsoleMocker(): ConsoleMocker;
56
+ interface ConsoleMocker {
57
+ (): {
58
+ logMock: jest.Mock<typeof console.log>;
59
+ warnMock: jest.Mock<typeof console.warn>;
60
+ errorMock: jest.Mock<typeof console.error>;
61
+ };
62
+ }
63
+ /**
64
+ * the callback that `withSilentWarn` expects to receive. Basically receives a mock
65
+ * as its argument and returns a `Promise`, the value of which is returns by `withSilentWarn`
66
+ * as well.
67
+ */
68
+ type SilentWarnFunc<T> = (mock: jest.Mock<typeof console.warn>) => Promise<T>;
69
+ /**
70
+ * Wrap a single callback with a silent `console.warn`. The callback passed in
71
+ * receives the mocking function as an argument, so you can easily make assertions
72
+ * that it is called if necessary.
73
+ *
74
+ * @param cb a callback which `withSilentWarn` will call after replacing `console.warn`
75
+ * with a mock.
76
+ * @returns a Promise wrapping the return value of the callback
77
+ */
78
+ export declare function withSilentWarn<T>(cb: SilentWarnFunc<T>): Promise<T>;
79
+ export {};
@@ -1,2 +1,2 @@
1
- import type { Testing, ValidatedConfig } from '@rindo/core/internal';
2
- export declare const createTesting: (config: ValidatedConfig) => Promise<Testing>;
1
+ import type { Testing, ValidatedConfig } from '@rindo/core/internal';
2
+ export declare const createTesting: (config: ValidatedConfig) => Promise<Testing>;
package/dependencies.json DELETED
@@ -1,120 +0,0 @@
1
- {
2
- "dependencies": [
3
- {
4
- "name": "@rindo/core",
5
- "version": "3.0.1",
6
- "main": "compiler/rindo.js",
7
- "resources": [
8
- "package.json",
9
- "compiler/lib.d.ts",
10
- "compiler/lib.dom.d.ts",
11
- "compiler/lib.dom.iterable.d.ts",
12
- "compiler/lib.es2015.collection.d.ts",
13
- "compiler/lib.es2015.core.d.ts",
14
- "compiler/lib.es2015.d.ts",
15
- "compiler/lib.es2015.generator.d.ts",
16
- "compiler/lib.es2015.iterable.d.ts",
17
- "compiler/lib.es2015.promise.d.ts",
18
- "compiler/lib.es2015.proxy.d.ts",
19
- "compiler/lib.es2015.reflect.d.ts",
20
- "compiler/lib.es2015.symbol.d.ts",
21
- "compiler/lib.es2015.symbol.wellknown.d.ts",
22
- "compiler/lib.es2016.array.include.d.ts",
23
- "compiler/lib.es2016.d.ts",
24
- "compiler/lib.es2016.full.d.ts",
25
- "compiler/lib.es2017.d.ts",
26
- "compiler/lib.es2017.full.d.ts",
27
- "compiler/lib.es2017.intl.d.ts",
28
- "compiler/lib.es2017.object.d.ts",
29
- "compiler/lib.es2017.sharedmemory.d.ts",
30
- "compiler/lib.es2017.string.d.ts",
31
- "compiler/lib.es2017.typedarrays.d.ts",
32
- "compiler/lib.es2018.asyncgenerator.d.ts",
33
- "compiler/lib.es2018.asynciterable.d.ts",
34
- "compiler/lib.es2018.d.ts",
35
- "compiler/lib.es2018.full.d.ts",
36
- "compiler/lib.es2018.intl.d.ts",
37
- "compiler/lib.es2018.promise.d.ts",
38
- "compiler/lib.es2018.regexp.d.ts",
39
- "compiler/lib.es2019.array.d.ts",
40
- "compiler/lib.es2019.d.ts",
41
- "compiler/lib.es2019.full.d.ts",
42
- "compiler/lib.es2019.intl.d.ts",
43
- "compiler/lib.es2019.object.d.ts",
44
- "compiler/lib.es2019.string.d.ts",
45
- "compiler/lib.es2019.symbol.d.ts",
46
- "compiler/lib.es2020.bigint.d.ts",
47
- "compiler/lib.es2020.d.ts",
48
- "compiler/lib.es2020.date.d.ts",
49
- "compiler/lib.es2020.full.d.ts",
50
- "compiler/lib.es2020.intl.d.ts",
51
- "compiler/lib.es2020.number.d.ts",
52
- "compiler/lib.es2020.promise.d.ts",
53
- "compiler/lib.es2020.sharedmemory.d.ts",
54
- "compiler/lib.es2020.string.d.ts",
55
- "compiler/lib.es2020.symbol.wellknown.d.ts",
56
- "compiler/lib.es2021.d.ts",
57
- "compiler/lib.es2021.full.d.ts",
58
- "compiler/lib.es2021.intl.d.ts",
59
- "compiler/lib.es2021.promise.d.ts",
60
- "compiler/lib.es2021.string.d.ts",
61
- "compiler/lib.es2021.weakref.d.ts",
62
- "compiler/lib.es2022.array.d.ts",
63
- "compiler/lib.es2022.d.ts",
64
- "compiler/lib.es2022.error.d.ts",
65
- "compiler/lib.es2022.full.d.ts",
66
- "compiler/lib.es2022.intl.d.ts",
67
- "compiler/lib.es2022.object.d.ts",
68
- "compiler/lib.es2022.sharedmemory.d.ts",
69
- "compiler/lib.es2022.string.d.ts",
70
- "compiler/lib.es5.d.ts",
71
- "compiler/lib.es6.d.ts",
72
- "compiler/lib.esnext.d.ts",
73
- "compiler/lib.esnext.full.d.ts",
74
- "compiler/lib.esnext.intl.d.ts",
75
- "compiler/lib.esnext.promise.d.ts",
76
- "compiler/lib.esnext.string.d.ts",
77
- "compiler/lib.esnext.weakref.d.ts",
78
- "compiler/lib.scripthost.d.ts",
79
- "compiler/lib.webworker.d.ts",
80
- "compiler/lib.webworker.importscripts.d.ts",
81
- "compiler/lib.webworker.iterable.d.ts",
82
- "internal/index.d.ts",
83
- "internal/index.js",
84
- "internal/package.json",
85
- "internal/rindo-ext-modules.d.ts",
86
- "internal/rindo-private.d.ts",
87
- "internal/rindo-public-compiler.d.ts",
88
- "internal/rindo-public-docs.d.ts",
89
- "internal/rindo-public-runtime.d.ts",
90
- "mock-doc/index.js",
91
- "mock-doc/package.json",
92
- "internal/client/css-shim.js",
93
- "internal/client/dom.js",
94
- "internal/client/index.js",
95
- "internal/client/package.json",
96
- "internal/client/patch-browser.js",
97
- "internal/client/patch-esm.js",
98
- "internal/client/shadow-css.js",
99
- "internal/hydrate/index.js",
100
- "internal/hydrate/package.json",
101
- "internal/hydrate/runner.js",
102
- "internal/hydrate/shadow-css.js",
103
- "internal/rindo-core/index.d.ts",
104
- "internal/rindo-core/index.js"
105
- ]
106
- },
107
- {
108
- "name": "rollup",
109
- "main": "dist/es/rollup.browser.js"
110
- },
111
- {
112
- "name": "terser",
113
- "main": "dist/bundle.min.js"
114
- },
115
- {
116
- "name": "typescript",
117
- "main": "lib/typescript.js"
118
- }
119
- ]
120
- }