@rindo/core 2.16.1 → 2.17.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rindo/core/sys/node",
3
- "version": "2.16.1",
3
+ "version": "2.17.0",
4
4
  "description": "Rindo Node System.",
5
5
  "main": "./index.js",
6
6
  "types": "./index.d.ts",
@@ -1,5 +1,5 @@
1
1
  /*!
2
- Rindo Node System Worker v2.16.1 | MIT Licensed | https://rindojs.web.app
2
+ Rindo Node System Worker v2.17.0 | MIT Licensed | https://rindojs.web.app
3
3
  */
4
4
  function _interopNamespace(e) {
5
5
  if (e && e.__esModule) return e;
@@ -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, mockRindoSystem, mockWindow, } from './mocks';
6
+ export { mockBuildCtx, mockConfig, mockCompilerCtx, mockDocument, mockLogger, mockCompilerSystem, mockWindow, mockModule, } from './mocks';
7
7
  export { MockHeaders, MockRequest, MockRequestInit, MockRequestInfo, MockResponse, MockResponseInit, mockFetch, } from './mock-fetch';
8
8
  export { newSpecPage } from './spec-page';
9
9
  export { shuffleArray } from './testing-utils';
package/testing/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- Rindo Testing v2.16.1 | MIT Licensed | https://rindojs.web.app
2
+ Rindo Testing v2.17.0 | MIT Licensed | https://rindojs.web.app
3
3
  */
4
4
  function _lazyRequire(e) {
5
5
  return new Proxy({}, {
@@ -476,7 +476,11 @@ function mockConfig(e) {
476
476
  nodeResolve: {
477
477
  customResolveOptions: {}
478
478
  },
479
- sourceMap: !0
479
+ sourceMap: !0,
480
+ rollupPlugins: {
481
+ before: [],
482
+ after: []
483
+ }
480
484
  };
481
485
  }
482
486
 
@@ -499,7 +503,7 @@ function mockCompilerCtx(e) {
499
503
  compilerOptions: null,
500
504
  cache: null,
501
505
  cssModuleImports: new Map,
502
- events: null,
506
+ events: buildEvents(),
503
507
  fs: null,
504
508
  hasSuccessfulBuild: !1,
505
509
  isActivelyBuilding: !1,
@@ -2087,7 +2091,46 @@ const MAX_FAILED = 100, ONE_DAY = 864e5, ONE_WEEK = 7 * ONE_DAY, EXP_STORAGE_KEY
2087
2091
  posix: null
2088
2092
  }).posix = posix, pathBrowserify = posix;
2089
2093
 
2090
- const IS_NODE_ENV = !("undefined" == typeof global || "function" != typeof require || !global.process || "string" != typeof __filename || global.origin && "string" == typeof global.origin);
2094
+ const buildEvents = () => {
2095
+ const e = [], t = t => {
2096
+ const r = e.findIndex((e => e.callback === t));
2097
+ return r > -1 && (e.splice(r, 1), !0);
2098
+ };
2099
+ return {
2100
+ emit: (t, r) => {
2101
+ const s = t.toLowerCase().trim(), n = e.slice();
2102
+ for (const e of n) if (null == e.eventName) try {
2103
+ e.callback(t, r);
2104
+ } catch (e) {
2105
+ console.error(e);
2106
+ } else if (e.eventName === s) try {
2107
+ e.callback(r);
2108
+ } catch (e) {
2109
+ console.error(e);
2110
+ }
2111
+ },
2112
+ on: (r, s) => {
2113
+ if ("function" == typeof r) {
2114
+ const s = null, n = r;
2115
+ return e.push({
2116
+ eventName: s,
2117
+ callback: n
2118
+ }), () => t(n);
2119
+ }
2120
+ if ("string" == typeof r && "function" == typeof s) {
2121
+ const n = r.toLowerCase().trim(), o = s;
2122
+ return e.push({
2123
+ eventName: n,
2124
+ callback: o
2125
+ }), () => t(o);
2126
+ }
2127
+ return () => !1;
2128
+ },
2129
+ unsubscribeAll: () => {
2130
+ e.length = 0;
2131
+ }
2132
+ };
2133
+ }, IS_NODE_ENV = !("undefined" == typeof global || "function" != typeof require || !global.process || "string" != typeof __filename || global.origin && "string" == typeof global.origin);
2091
2134
 
2092
2135
  IS_NODE_ENV && process.platform;
2093
2136
 
@@ -2852,46 +2895,7 @@ const createSystem = e => {
2852
2895
  })(t, e)));
2853
2896
  }
2854
2897
  };
2855
- })(), r = new Map, s = new Set, n = e => s.add(e), o = e => s.delete(e), i = (() => {
2856
- const e = [], t = t => {
2857
- const r = e.findIndex((e => e.callback === t));
2858
- return r > -1 && (e.splice(r, 1), !0);
2859
- };
2860
- return {
2861
- emit: (t, r) => {
2862
- const s = t.toLowerCase().trim(), n = e.slice();
2863
- for (const e of n) if (null == e.eventName) try {
2864
- e.callback(t, r);
2865
- } catch (e) {
2866
- console.error(e);
2867
- } else if (e.eventName === s) try {
2868
- e.callback(r);
2869
- } catch (e) {
2870
- console.error(e);
2871
- }
2872
- },
2873
- on: (r, s) => {
2874
- if ("function" == typeof r) {
2875
- const s = null, n = r;
2876
- return e.push({
2877
- eventName: s,
2878
- callback: n
2879
- }), () => t(n);
2880
- }
2881
- if ("string" == typeof r && "function" == typeof s) {
2882
- const n = r.toLowerCase().trim(), o = s;
2883
- return e.push({
2884
- eventName: n,
2885
- callback: o
2886
- }), () => t(o);
2887
- }
2888
- return () => !1;
2889
- },
2890
- unsubscribeAll: () => {
2891
- e.length = 0;
2892
- }
2893
- };
2894
- })(), a = IS_BROWSER_ENV && navigator.hardwareConcurrency || 1, l = e => {
2898
+ })(), r = new Map, s = new Set, n = e => s.add(e), o = e => s.delete(e), i = buildEvents(), a = IS_BROWSER_ENV && navigator.hardwareConcurrency || 1, l = e => {
2895
2899
  if ("/" === e || "" === e) return "/";
2896
2900
  const t = path$2.dirname(e), r = path$2.basename(e);
2897
2901
  return t.endsWith("/") ? normalizePath(`${t}${r}`) : normalizePath(`${t}/${r}`);
@@ -3037,7 +3041,7 @@ const createSystem = e => {
3037
3041
  u("/");
3038
3042
  const D = {
3039
3043
  name: "in-memory",
3040
- version: "2.16.1",
3044
+ version: "2.17.0",
3041
3045
  events: i,
3042
3046
  access: async e => c(e),
3043
3047
  accessSync: c,
@@ -3325,7 +3329,8 @@ const createSystem = e => {
3325
3329
  r.readDirSync = s(r.readDirSync), r.stat = s(r.stat), r.statSync = s(r.statSync),
3326
3330
  r.copyFile = n(r.copyFile), r.createDir = n(r.createDir), r.createDirSync = n(r.createDirSync),
3327
3331
  r.removeFile = n(r.removeFile), r.removeFileSync = n(r.removeFileSync), r.writeFile = n(r.writeFile),
3328
- r.writeFileSync = n(r.writeFileSync), Object.defineProperties(r, {
3332
+ r.writeFileSync = n(r.writeFileSync), r.getCompilerExecutingPath = () => "bin/rindo.js",
3333
+ Object.defineProperties(r, {
3329
3334
  diskReads: {
3330
3335
  get: () => e,
3331
3336
  set(t) {
@@ -3928,13 +3933,47 @@ exports.createJestPuppeteerEnvironment = function createJestPuppeteerEnvironment
3928
3933
  }
3929
3934
  }, exports.mockBuildCtx = function mockBuildCtx(e, t) {
3930
3935
  return e || (e = mockConfig()), t || (t = mockCompilerCtx(e)), new BuildContext(e, t);
3931
- }, exports.mockCompilerCtx = mockCompilerCtx, exports.mockConfig = mockConfig, exports.mockDocument = function mockDocument(e = null) {
3936
+ }, exports.mockCompilerCtx = mockCompilerCtx, exports.mockCompilerSystem = function mockCompilerSystem() {
3937
+ return createTestingSystem();
3938
+ }, exports.mockConfig = mockConfig, exports.mockDocument = function mockDocument(e = null) {
3932
3939
  return new index_cjs.MockWindow(e).document;
3933
3940
  }, exports.mockFetch = mockFetch, exports.mockLogger = function mockLogger() {
3934
3941
  return new TestingLogger;
3935
- }, exports.mockRindoSystem = function mockRindoSystem() {
3936
- return createTestingSystem();
3937
- }, exports.mockWindow = function mockWindow(e = null) {
3942
+ }, exports.mockModule = (e = {}) => ({
3943
+ cmps: [],
3944
+ coreRuntimeApis: [],
3945
+ collectionName: "",
3946
+ dtsFilePath: "",
3947
+ excludeFromCollection: !1,
3948
+ externalImports: [],
3949
+ htmlAttrNames: [],
3950
+ htmlTagNames: [],
3951
+ htmlParts: [],
3952
+ isCollectionDependency: !1,
3953
+ isLegacy: !1,
3954
+ jsFilePath: "",
3955
+ localImports: [],
3956
+ originalImports: [],
3957
+ originalCollectionComponentPath: "",
3958
+ potentialCmpRefs: [],
3959
+ sourceFilePath: "",
3960
+ staticSourceFile: "",
3961
+ staticSourceFileText: "",
3962
+ sourceMapPath: "",
3963
+ sourceMapFileText: "",
3964
+ hasVdomAttribute: !1,
3965
+ hasVdomClass: !1,
3966
+ hasVdomFunctional: !1,
3967
+ hasVdomKey: !1,
3968
+ hasVdomListener: !1,
3969
+ hasVdomPropOrAttr: !1,
3970
+ hasVdomRef: !1,
3971
+ hasVdomRender: !1,
3972
+ hasVdomStyle: !1,
3973
+ hasVdomText: !1,
3974
+ hasVdomXlink: !1,
3975
+ ...e
3976
+ }), exports.mockWindow = function mockWindow(e = null) {
3938
3977
  return new index_cjs.MockWindow(e);
3939
3978
  }, exports.newE2EPage = async function newE2EPage(e = {}) {
3940
3979
  if (!global.__NEW_TEST_PAGE__) throw new Error("newE2EPage() is only available from E2E tests, and ran with the --e2e cmd line flag.");
@@ -1,10 +1,30 @@
1
- import type { BuildCtx, Cache, CompilerCtx, CompilerSystem, Config } from '@rindo/core/internal';
1
+ import type { BuildCtx, Cache, CompilerCtx, CompilerSystem, Config, Module } from '@rindo/core/internal';
2
+ import { TestingSystem } from './testing-sys';
2
3
  import { TestingLogger } from './testing-logger';
3
4
  export declare function mockConfig(sys?: CompilerSystem): Config;
4
5
  export declare function mockCompilerCtx(config?: Config): CompilerCtx;
5
6
  export declare function mockBuildCtx(config?: Config, compilerCtx?: CompilerCtx): BuildCtx;
6
7
  export declare function mockCache(config?: Config, compilerCtx?: CompilerCtx): Cache;
7
8
  export declare function mockLogger(): TestingLogger;
8
- export declare function mockRindoSystem(): CompilerSystem;
9
+ /**
10
+ * Create a {@link CompilerSystem} entity for testing the compiler.
11
+ *
12
+ * This function acts as a thin wrapper around a {@link TestingSystem} entity creation. It exists to provide a logical
13
+ * place in the codebase where we might expect Rindo engineers to reach for when attempting to mock a
14
+ * {@link CompilerSystem} base type. Should there prove to be usage of both this function and the one it wraps,
15
+ * reconsider if this wrapper is necessary.
16
+ *
17
+ * @returns a System instance for testing purposes.
18
+ */
19
+ export declare function mockCompilerSystem(): TestingSystem;
9
20
  export declare function mockDocument(html?: string): Document;
10
21
  export declare function mockWindow(html?: string): Window;
22
+ /**
23
+ * This gives you a mock Module, an interface which is the internal compiler
24
+ * representation of a module. It includes a bunch of information necessary for
25
+ * compilation, this mock basically sets sane defaults for all those values.
26
+ *
27
+ * @param mod is an override module that you can supply to set particular values
28
+ * @returns a module object ready to use in tests!
29
+ */
30
+ export declare const mockModule: (mod?: Partial<Module>) => Module;
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rindo/core/testing",
3
- "version": "2.16.1",
3
+ "version": "2.17.0",
4
4
  "description": "Rindo testing suite.",
5
5
  "main": "./index.js",
6
6
  "types": "./index.d.ts",