@modern-js/utils 2.0.0-beta.2 → 2.0.0-beta.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,4 +1,5 @@
1
1
  /// <reference types="node" />
2
+ /// <reference types="node" />
2
3
  export = wdm;
3
4
  /** @typedef {import('../schema-utils3/declarations/validate').Schema} Schema */
4
5
  /** @typedef {import('webpack').Compiler} Compiler */
@@ -35,31 +36,31 @@ export = wdm;
35
36
  * @param {Stats | MultiStats} [stats]
36
37
  */
37
38
  /**
38
- * @template {IncomingMessage} Request
39
- * @template {ServerResponse} Response
39
+ * @template {IncomingMessage} RequestInternal
40
+ * @template {ServerResponse} ResponseInternal
40
41
  * @typedef {Object} Context
41
42
  * @property {boolean} state
42
43
  * @property {Stats | MultiStats | undefined} stats
43
44
  * @property {Callback[]} callbacks
44
- * @property {Options<Request, Response>} options
45
+ * @property {Options<RequestInternal, ResponseInternal>} options
45
46
  * @property {Compiler | MultiCompiler} compiler
46
47
  * @property {Watching | MultiWatching} watching
47
48
  * @property {Logger} logger
48
49
  * @property {OutputFileSystem} outputFileSystem
49
50
  */
50
51
  /**
51
- * @template {IncomingMessage} Request
52
- * @template {ServerResponse} Response
53
- * @typedef {Record<string, string | number> | Array<{ key: string, value: number | string }> | ((req: Request, res: Response, context: Context<Request, Response>) => void | undefined | Record<string, string | number>) | undefined} Headers
52
+ * @template {IncomingMessage} RequestInternal
53
+ * @template {ServerResponse} ResponseInternal
54
+ * @typedef {Record<string, string | number> | Array<{ key: string, value: number | string }> | ((req: RequestInternal, res: ResponseInternal, context: Context<RequestInternal, ResponseInternal>) => void | undefined | Record<string, string | number>) | undefined} Headers
54
55
  */
55
56
  /**
56
- * @template {IncomingMessage} Request
57
- * @template {ServerResponse} Response
57
+ * @template {IncomingMessage} RequestInternal
58
+ * @template {ServerResponse} ResponseInternal
58
59
  * @typedef {Object} Options
59
60
  * @property {{[key: string]: string}} [mimeTypes]
60
61
  * @property {boolean | ((targetPath: string) => boolean)} [writeToDisk]
61
62
  * @property {string} [methods]
62
- * @property {Headers<Request, Response>} [headers]
63
+ * @property {Headers<RequestInternal, ResponseInternal>} [headers]
63
64
  * @property {NonNullable<Configuration["output"]>["publicPath"]} [publicPath]
64
65
  * @property {Configuration["stats"]} [stats]
65
66
  * @property {boolean} [serverSideRender]
@@ -67,11 +68,11 @@ export = wdm;
67
68
  * @property {boolean | string} [index]
68
69
  */
69
70
  /**
70
- * @template {IncomingMessage} Request
71
- * @template {ServerResponse} Response
71
+ * @template {IncomingMessage} RequestInternal
72
+ * @template {ServerResponse} ResponseInternal
72
73
  * @callback Middleware
73
- * @param {Request} req
74
- * @param {Response} res
74
+ * @param {RequestInternal} req
75
+ * @param {ResponseInternal} res
75
76
  * @param {NextFunction} next
76
77
  * @return {Promise<void>}
77
78
  */
@@ -93,34 +94,34 @@ export = wdm;
93
94
  * @param {(err: Error | null | undefined) => void} callback
94
95
  */
95
96
  /**
96
- * @template {IncomingMessage} Request
97
- * @template {ServerResponse} Response
97
+ * @template {IncomingMessage} RequestInternal
98
+ * @template {ServerResponse} ResponseInternal
98
99
  * @typedef {Object} AdditionalMethods
99
100
  * @property {GetFilenameFromUrl} getFilenameFromUrl
100
101
  * @property {WaitUntilValid} waitUntilValid
101
102
  * @property {Invalidate} invalidate
102
103
  * @property {Close} close
103
- * @property {Context<Request, Response>} context
104
+ * @property {Context<RequestInternal, ResponseInternal>} context
104
105
  */
105
106
  /**
106
- * @template {IncomingMessage} Request
107
- * @template {ServerResponse} Response
108
- * @typedef {Middleware<Request, Response> & AdditionalMethods<Request, Response>} API
107
+ * @template {IncomingMessage} RequestInternal
108
+ * @template {ServerResponse} ResponseInternal
109
+ * @typedef {Middleware<RequestInternal, ResponseInternal> & AdditionalMethods<RequestInternal, ResponseInternal>} API
109
110
  */
110
111
  /**
111
- * @template {IncomingMessage} Request
112
- * @template {ServerResponse} Response
112
+ * @template {IncomingMessage} RequestInternal
113
+ * @template {ServerResponse} ResponseInternal
113
114
  * @param {Compiler | MultiCompiler} compiler
114
- * @param {Options<Request, Response>} [options]
115
- * @returns {API<Request, Response>}
115
+ * @param {Options<RequestInternal, ResponseInternal>} [options]
116
+ * @returns {API<RequestInternal, ResponseInternal>}
116
117
  */
117
118
  declare function wdm<
118
- Request_1 extends import('http').IncomingMessage,
119
- Response_1 extends ServerResponse
119
+ RequestInternal extends import('http').IncomingMessage,
120
+ ResponseInternal extends ServerResponse
120
121
  >(
121
122
  compiler: Compiler | MultiCompiler,
122
- options?: Options<Request_1, Response_1> | undefined
123
- ): API<Request_1, Response_1>;
123
+ options?: Options<RequestInternal, ResponseInternal> | undefined
124
+ ): API<RequestInternal, ResponseInternal>;
124
125
  declare namespace wdm {
125
126
  export {
126
127
  Schema,
@@ -155,8 +156,8 @@ type ServerResponse = import('http').ServerResponse & ExtendedServerResponse;
155
156
  type Compiler = import('webpack').Compiler;
156
157
  type MultiCompiler = import('webpack').MultiCompiler;
157
158
  type Options<
158
- Request_1 extends import('http').IncomingMessage,
159
- Response_1 extends ServerResponse
159
+ RequestInternal extends import('http').IncomingMessage,
160
+ ResponseInternal extends ServerResponse
160
161
  > = {
161
162
  mimeTypes?:
162
163
  | {
@@ -165,7 +166,7 @@ type Options<
165
166
  | undefined;
166
167
  writeToDisk?: boolean | ((targetPath: string) => boolean) | undefined;
167
168
  methods?: string | undefined;
168
- headers?: Headers<Request_1, Response_1>;
169
+ headers?: Headers<RequestInternal, ResponseInternal>;
169
170
  publicPath?: NonNullable<Configuration["output"]>["publicPath"];
170
171
  stats?: Configuration["stats"];
171
172
  serverSideRender?: boolean | undefined;
@@ -173,10 +174,10 @@ type Options<
173
174
  index?: string | boolean | undefined;
174
175
  };
175
176
  type API<
176
- Request_1 extends import('http').IncomingMessage,
177
- Response_1 extends ServerResponse
178
- > = Middleware<Request_1, Response_1> &
179
- AdditionalMethods<Request_1, Response_1>;
177
+ RequestInternal extends import('http').IncomingMessage,
178
+ ResponseInternal extends ServerResponse
179
+ > = Middleware<RequestInternal, ResponseInternal> &
180
+ AdditionalMethods<RequestInternal, ResponseInternal>;
180
181
  type Schema = import('../schema-utils3/declarations/validate').Schema;
181
182
  type Configuration = import('webpack').Configuration;
182
183
  type Stats = import('webpack').Stats;
@@ -201,7 +202,7 @@ type Watching = Compiler["watching"];
201
202
  type MultiWatching = ReturnType<Compiler["watch"]>;
202
203
  type OutputFileSystem = Compiler["outputFileSystem"] & {
203
204
  createReadStream?: typeof import('fs').createReadStream;
204
- statSync?: typeof import('fs').statSync;
205
+ statSync?: import('fs').StatSyncFn;
205
206
  lstat?: typeof import('fs').lstat;
206
207
  readFileSync?: typeof import('fs').readFileSync;
207
208
  };
@@ -210,21 +211,21 @@ type Callback = (
210
211
  stats?: import('webpack').Stats | import('webpack').MultiStats | undefined
211
212
  ) => any;
212
213
  type Context<
213
- Request_1 extends import('http').IncomingMessage,
214
- Response_1 extends ServerResponse
214
+ RequestInternal extends import('http').IncomingMessage,
215
+ ResponseInternal extends ServerResponse
215
216
  > = {
216
217
  state: boolean;
217
218
  stats: Stats | MultiStats | undefined;
218
219
  callbacks: Callback[];
219
- options: Options<Request_1, Response_1>;
220
+ options: Options<RequestInternal, ResponseInternal>;
220
221
  compiler: Compiler | MultiCompiler;
221
222
  watching: Watching | MultiWatching;
222
223
  logger: Logger;
223
224
  outputFileSystem: OutputFileSystem;
224
225
  };
225
226
  type Headers<
226
- Request_1 extends import('http').IncomingMessage,
227
- Response_1 extends ServerResponse
227
+ RequestInternal extends import('http').IncomingMessage,
228
+ ResponseInternal extends ServerResponse
228
229
  > =
229
230
  | Record<string, string | number>
230
231
  | {
@@ -232,26 +233,30 @@ type Headers<
232
233
  value: number | string;
233
234
  }[]
234
235
  | ((
235
- req: Request_1,
236
- res: Response_1,
237
- context: Context<Request_1, Response_1>
236
+ req: RequestInternal,
237
+ res: ResponseInternal,
238
+ context: Context<RequestInternal, ResponseInternal>
238
239
  ) => void | undefined | Record<string, string | number>)
239
240
  | undefined;
240
241
  type Middleware<
241
- Request_1 extends import('http').IncomingMessage,
242
- Response_1 extends ServerResponse
243
- > = (req: Request_1, res: Response_1, next: NextFunction) => Promise<void>;
242
+ RequestInternal extends import('http').IncomingMessage,
243
+ ResponseInternal extends ServerResponse
244
+ > = (
245
+ req: RequestInternal,
246
+ res: ResponseInternal,
247
+ next: NextFunction
248
+ ) => Promise<void>;
244
249
  type GetFilenameFromUrl = (url: string) => string | undefined;
245
250
  type WaitUntilValid = (callback: Callback) => any;
246
251
  type Invalidate = (callback: Callback) => any;
247
252
  type Close = (callback: (err: Error | null | undefined) => void) => any;
248
253
  type AdditionalMethods<
249
- Request_1 extends import('http').IncomingMessage,
250
- Response_1 extends ServerResponse
254
+ RequestInternal extends import('http').IncomingMessage,
255
+ ResponseInternal extends ServerResponse
251
256
  > = {
252
257
  getFilenameFromUrl: GetFilenameFromUrl;
253
258
  waitUntilValid: WaitUntilValid;
254
259
  invalidate: Invalidate;
255
260
  close: Close;
256
- context: Context<Request_1, Response_1>;
261
+ context: Context<RequestInternal, ResponseInternal>;
257
262
  };
package/dist/chainId.d.ts CHANGED
@@ -56,6 +56,7 @@ export declare const CHAIN_ID: {
56
56
  readonly ASSETS: "assets";
57
57
  readonly ASSETS_URL: "assets-url";
58
58
  readonly ASSETS_INLINE: "assets-inline";
59
+ readonly IMAGE_COMPRESS: "image-compress";
59
60
  };
60
61
  /** Predefined loaders */
61
62
  readonly USE: {
@@ -99,6 +100,8 @@ export declare const CHAIN_ID: {
99
100
  readonly CSS_MODULES_TS: "css-modules-typescript";
100
101
  /** mini-css-extract-plugin.loader */
101
102
  readonly MINI_CSS_EXTRACT: "mini-css-extract";
103
+ /** builder-plugin-image-compress.loader */
104
+ readonly IMAGE_COMPRESS: "image-compress";
102
105
  };
103
106
  /** Predefined plugins */
104
107
  readonly PLUGIN: {
package/dist/chainId.js CHANGED
@@ -59,6 +59,7 @@ exports.CHAIN_ID = {
59
59
  ASSETS: 'assets',
60
60
  ASSETS_URL: 'assets-url',
61
61
  ASSETS_INLINE: 'assets-inline',
62
+ IMAGE_COMPRESS: 'image-compress',
62
63
  },
63
64
  /** Predefined loaders */
64
65
  USE: {
@@ -102,6 +103,8 @@ exports.CHAIN_ID = {
102
103
  CSS_MODULES_TS: 'css-modules-typescript',
103
104
  /** mini-css-extract-plugin.loader */
104
105
  MINI_CSS_EXTRACT: 'mini-css-extract',
106
+ /** builder-plugin-image-compress.loader */
107
+ IMAGE_COMPRESS: 'image-compress',
105
108
  },
106
109
  /** Predefined plugins */
107
110
  PLUGIN: {
@@ -58,6 +58,26 @@ export declare const ROUTE_MINIFEST_FILE = "routes-manifest.json";
58
58
  * Property mounted on window that describes route manifest
59
59
  */
60
60
  export declare const ROUTE_MANIFEST = "_MODERNJS_ROUTE_MANIFEST";
61
+ /**
62
+ * directory name for loader routes
63
+ */
64
+ export declare const LOADER_ROUTES_DIR = "loader-routes";
65
+ /**
66
+ * Internal app-tools plugins that work as soon as they are installed.
67
+ */
68
+ export declare const INTERNAL_APP_TOOLS_PLUGINS: InternalPlugins;
69
+ /**
70
+ * Internal module-tools plugins that work as soon as they are installed.
71
+ */
72
+ export declare const INTERNAL_MODULE_TOOLS_PLUGINS: InternalPlugins;
73
+ /**
74
+ * Internal module-tools plugins that work as soon as they are installed.
75
+ */
76
+ export declare const INTERNAL_MONOREPO_TOOLS_PLUGINS: InternalPlugins;
77
+ /**
78
+ * Internal module-tools plugins that work as soon as they are installed.
79
+ */
80
+ export declare const INTERNAL_DOC_TOOLS_PLUGINS: InternalPlugins;
61
81
  /**
62
82
  * Internal plugins that work as soon as they are installed.
63
83
  */
@@ -86,6 +106,12 @@ export declare const PLUGIN_SCHEMAS: {
86
106
  additionalProperties: boolean;
87
107
  };
88
108
  })[];
109
+ '@modern-js/plugin-swc': {
110
+ target: string;
111
+ schema: {
112
+ typeof: string[];
113
+ };
114
+ }[];
89
115
  '@modern-js/plugin-bff': {
90
116
  target: string;
91
117
  schema: {
package/dist/constants.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PLUGIN_SCHEMAS = exports.INTERNAL_SERVER_PLUGINS = exports.INTERNAL_CLI_PLUGINS = exports.ROUTE_MANIFEST = exports.ROUTE_MINIFEST_FILE = exports.DEFAULT_SERVER_CONFIG = exports.OUTPUT_CONFIG_FILE = exports.CONFIG_FILE_EXTENSIONS = exports.CONFIG_CACHE_DIR = exports.SHARED_DIR = exports.SERVER_DIR = exports.API_DIR = exports.LOADABLE_STATS_FILE = exports.SERVER_RENDER_FUNCTION_NAME = exports.ENTRY_NAME_PATTERN = exports.SERVER_BUNDLE_DIRECTORY = exports.LAUNCH_EDITOR_ENDPOINT = exports.MAIN_ENTRY_NAME = exports.ROUTE_SPEC_FILE = exports.HMR_SOCK_PATH = void 0;
3
+ exports.PLUGIN_SCHEMAS = exports.INTERNAL_SERVER_PLUGINS = exports.INTERNAL_CLI_PLUGINS = exports.INTERNAL_DOC_TOOLS_PLUGINS = exports.INTERNAL_MONOREPO_TOOLS_PLUGINS = exports.INTERNAL_MODULE_TOOLS_PLUGINS = exports.INTERNAL_APP_TOOLS_PLUGINS = exports.LOADER_ROUTES_DIR = exports.ROUTE_MANIFEST = exports.ROUTE_MINIFEST_FILE = exports.DEFAULT_SERVER_CONFIG = exports.OUTPUT_CONFIG_FILE = exports.CONFIG_FILE_EXTENSIONS = exports.CONFIG_CACHE_DIR = exports.SHARED_DIR = exports.SERVER_DIR = exports.API_DIR = exports.LOADABLE_STATS_FILE = exports.SERVER_RENDER_FUNCTION_NAME = exports.ENTRY_NAME_PATTERN = exports.SERVER_BUNDLE_DIRECTORY = exports.LAUNCH_EDITOR_ENDPOINT = exports.MAIN_ENTRY_NAME = exports.ROUTE_SPEC_FILE = exports.HMR_SOCK_PATH = void 0;
4
4
  /**
5
5
  * hmr socket connect path
6
6
  */
@@ -60,6 +60,61 @@ exports.ROUTE_MINIFEST_FILE = 'routes-manifest.json';
60
60
  * Property mounted on window that describes route manifest
61
61
  */
62
62
  exports.ROUTE_MANIFEST = `_MODERNJS_ROUTE_MANIFEST`;
63
+ /**
64
+ * directory name for loader routes
65
+ */
66
+ exports.LOADER_ROUTES_DIR = `loader-routes`;
67
+ /**
68
+ * Internal app-tools plugins that work as soon as they are installed.
69
+ */
70
+ exports.INTERNAL_APP_TOOLS_PLUGINS = {
71
+ '@modern-js/app-tools': '@modern-js/app-tools/cli',
72
+ '@modern-js/runtime': '@modern-js/runtime/cli',
73
+ '@modern-js/plugin-proxy': '@modern-js/plugin-proxy/cli',
74
+ '@modern-js/plugin-ssg': '@modern-js/plugin-ssg/cli',
75
+ '@modern-js/plugin-bff': '@modern-js/plugin-bff/cli',
76
+ '@modern-js/plugin-testing': '@modern-js/plugin-testing/cli',
77
+ '@modern-js/plugin-storybook': '@modern-js/plugin-storybook/cli',
78
+ '@modern-js/plugin-express': '@modern-js/plugin-express/cli',
79
+ '@modern-js/plugin-egg': '@modern-js/plugin-egg/cli',
80
+ '@modern-js/plugin-koa': '@modern-js/plugin-koa/cli',
81
+ '@modern-js/plugin-nest': '@modern-js/plugin-nest/cli',
82
+ '@modern-js/plugin-server': '@modern-js/plugin-server/cli',
83
+ '@modern-js/plugin-garfish': '@modern-js/plugin-garfish/cli',
84
+ '@modern-js/plugin-tailwindcss': '@modern-js/plugin-tailwindcss/cli',
85
+ '@modern-js/plugin-polyfill': '@modern-js/plugin-polyfill/cli',
86
+ // legacy router (inner react-router-dom v5)
87
+ '@modern-js/plugin-router-legacy': '@modern-js/plugin-router-legacy/cli',
88
+ };
89
+ /**
90
+ * Internal module-tools plugins that work as soon as they are installed.
91
+ */
92
+ exports.INTERNAL_MODULE_TOOLS_PLUGINS = {
93
+ '@modern-js/module-tools': '@modern-js/module-tools/cli',
94
+ '@modern-js/module-tools-v2': '@modern-js/module-tools-v2',
95
+ '@modern-js/doc-tools': '@modern-js/doc-tools',
96
+ '@modern-js/runtime': '@modern-js/runtime/cli',
97
+ '@modern-js/plugin-testing': '@modern-js/plugin-testing/cli',
98
+ '@modern-js/plugin-storybook': '@modern-js/plugin-storybook/cli',
99
+ '@modern-js/plugin-tailwindcss': '@modern-js/plugin-tailwindcss/cli',
100
+ // TODO: Maybe can remove it
101
+ '@modern-js/plugin-nocode': '@modern-js/plugin-nocode/cli',
102
+ };
103
+ /**
104
+ * Internal module-tools plugins that work as soon as they are installed.
105
+ */
106
+ exports.INTERNAL_MONOREPO_TOOLS_PLUGINS = {
107
+ '@modern-js/monorepo-tools': '@modern-js/monorepo-tools/cli',
108
+ '@modern-js/plugin-testing': '@modern-js/plugin-testing/cli',
109
+ };
110
+ /**
111
+ * Internal module-tools plugins that work as soon as they are installed.
112
+ */
113
+ exports.INTERNAL_DOC_TOOLS_PLUGINS = {
114
+ '@modern-js/doc-tools': '@modern-js/doc-tools',
115
+ '@modern-js/runtime': '@modern-js/runtime/cli',
116
+ '@modern-js/plugin-testing': '@modern-js/plugin-testing/cli',
117
+ };
63
118
  /**
64
119
  * Internal plugins that work as soon as they are installed.
65
120
  */
@@ -80,6 +135,7 @@ exports.INTERNAL_CLI_PLUGINS = {
80
135
  '@modern-js/plugin-koa': '@modern-js/plugin-koa/cli',
81
136
  '@modern-js/plugin-nest': '@modern-js/plugin-nest/cli',
82
137
  '@modern-js/plugin-server': '@modern-js/plugin-server/cli',
138
+ '@modern-js/plugin-swc': '@modern-js/plugin-swc',
83
139
  '@modern-js/plugin-garfish': '@modern-js/plugin-garfish/cli',
84
140
  '@modern-js/plugin-tailwindcss': '@modern-js/plugin-tailwindcss/cli',
85
141
  '@modern-js/plugin-polyfill': '@modern-js/plugin-polyfill/cli',
@@ -118,6 +174,12 @@ exports.PLUGIN_SCHEMAS = {
118
174
  },
119
175
  },
120
176
  ],
177
+ '@modern-js/plugin-swc': [
178
+ {
179
+ target: 'tools.swc',
180
+ schema: { typeof: ['object'] },
181
+ },
182
+ ],
121
183
  '@modern-js/plugin-bff': [
122
184
  {
123
185
  target: 'bff',
package/dist/index.d.ts CHANGED
@@ -38,3 +38,4 @@ export * from './chainId';
38
38
  export * from './version';
39
39
  export * from './plugin';
40
40
  export * from './routes';
41
+ export * from './test-utils';
package/dist/index.js CHANGED
@@ -54,3 +54,4 @@ __exportStar(require("./chainId"), exports);
54
54
  __exportStar(require("./version"), exports);
55
55
  __exportStar(require("./plugin"), exports);
56
56
  __exportStar(require("./routes"), exports);
57
+ __exportStar(require("./test-utils"), exports);
package/dist/routes.js CHANGED
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.getRouteId = exports.getPathWithoutExt = void 0;
7
7
  const path_1 = __importDefault(require("path"));
8
8
  const path_2 = require("./path");
9
+ const constants_1 = require("./constants");
9
10
  const getPathWithoutExt = (filename) => {
10
11
  const extname = path_1.default.extname(filename);
11
12
  return filename.slice(0, -extname.length);
@@ -14,7 +15,13 @@ exports.getPathWithoutExt = getPathWithoutExt;
14
15
  const getRouteId = (componentPath, routesDir, entryName) => {
15
16
  const relativePath = (0, path_2.normalizeToPosixPath)(path_1.default.relative(routesDir, componentPath));
16
17
  const pathWithoutExt = (0, exports.getPathWithoutExt)(relativePath);
17
- const id = `${entryName}_${pathWithoutExt}`;
18
+ let id = ``;
19
+ if (entryName === constants_1.MAIN_ENTRY_NAME) {
20
+ id = pathWithoutExt;
21
+ }
22
+ else {
23
+ id = `${entryName}_${pathWithoutExt}`;
24
+ }
18
25
  return id;
19
26
  };
20
27
  exports.getRouteId = getRouteId;
@@ -0,0 +1,5 @@
1
+ /**
2
+ *
3
+ * remove the path before "modern.js"
4
+ */
5
+ export declare const initSnapshotSerializer: (root: string) => void;
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.initSnapshotSerializer = void 0;
4
+ /**
5
+ *
6
+ * remove the path before "modern.js"
7
+ */
8
+ const initSnapshotSerializer = (root) => {
9
+ expect.addSnapshotSerializer({
10
+ test: (val) => typeof val === 'string' &&
11
+ (val.includes('modern.js') ||
12
+ val.includes('node_modules') ||
13
+ val.includes(root)),
14
+ print: (val) =>
15
+ // eslint-disable-next-line no-nested-ternary
16
+ typeof val === 'string'
17
+ ? // eslint-disable-next-line no-nested-ternary
18
+ val.includes('node_modules')
19
+ ? `"${val.replace(/.+node_modules/, ``)}"`
20
+ : val.includes('modern.js')
21
+ ? `"${val.replace(/.+modern\.js/, ``)}"`
22
+ : `"${val.replace(root, '')}"`
23
+ : val,
24
+ });
25
+ };
26
+ exports.initSnapshotSerializer = initSnapshotSerializer;
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "modern",
12
12
  "modern.js"
13
13
  ],
14
- "version": "2.0.0-beta.2",
14
+ "version": "2.0.0-beta.3",
15
15
  "jsnext:source": "./src/index.ts",
16
16
  "types": "./dist/index.d.ts",
17
17
  "main": "./dist/index.js",
@@ -133,10 +133,10 @@
133
133
  "@types/node": "^14",
134
134
  "typescript": "^4",
135
135
  "jest": "^27",
136
- "webpack": "^5.74.0",
137
- "@modern-js/types": "2.0.0-beta.2",
138
- "@scripts/build": "2.0.0-beta.2",
139
- "@scripts/jest-config": "2.0.0-beta.2"
136
+ "webpack": "^5.75.0",
137
+ "@modern-js/types": "2.0.0-beta.3",
138
+ "@scripts/build": "2.0.0-beta.3",
139
+ "@scripts/jest-config": "2.0.0-beta.3"
140
140
  },
141
141
  "sideEffects": false,
142
142
  "scripts": {
@@ -1,4 +0,0 @@
1
- export interface Options {
2
- cwd: string;
3
- }
4
- export declare const options: Options;