@modern-js/utils 3.8.3 → 3.9.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.
@@ -1,6 +1,6 @@
1
1
  import { createRequire } from "node:module";
2
2
  import { Import } from "./import.mjs";
3
- import { __webpack_require__ } from "./rslib-runtime.mjs";
3
+ import { __webpack_require__ } from "./rslib-runtime~1.mjs";
4
4
  import signale from "../compiled/signale/index.js";
5
5
  const { Signale: Signale } = signale;
6
6
  const getNodeRequire = ()=>{
@@ -1,4 +1,4 @@
1
- import debug from '../../compiled/debug';
1
+ import debug from '../../compiled/debug/index.js';
2
2
  /**
3
3
  * Create debug function with unified namespace prefix.
4
4
  * @param scope - Custom module name of your debug function.
@@ -1,5 +1,5 @@
1
1
  import type { InternalPlugins } from '@modern-js/types';
2
- export { NESTED_ROUTE_SPEC_FILE, MAIN_ENTRY_NAME, DEFAULT_ENTRY_NAME, ROUTE_SPEC_FILE, SERVER_BUNDLE_DIRECTORY, SERVER_RENDER_FUNCTION_NAME, SERVER_PLUGIN_BFF, SERVER_PLUGIN_POLYFILL, } from '../universal/constants';
2
+ export { NESTED_ROUTE_SPEC_FILE, MAIN_ENTRY_NAME, DEFAULT_ENTRY_NAME, ROUTE_SPEC_FILE, SERVER_BUNDLE_DIRECTORY, SERVER_RENDER_FUNCTION_NAME, SERVER_PLUGIN_BFF, SERVER_PLUGIN_POLYFILL, } from '../universal/constants.js';
3
3
  export declare const JS_EXTENSIONS: string[];
4
4
  /**
5
5
  * server side bundles directory, which relative to dist.
@@ -7,5 +7,5 @@ export declare const getServerConfig: (appDirectory: string, configFile: string)
7
7
  */
8
8
  export declare const getMeta: (metaName?: string) => string;
9
9
  export declare const getTargetDir: (from: string, baseDir: string, targetBaseDir: string) => string;
10
- export * from './data';
11
- export * from './config';
10
+ export * from './data.js';
11
+ export * from './config.js';
@@ -1,24 +1,24 @@
1
- export * from './constants';
2
- export * from './get';
3
- export * from './is';
4
- export * from './alias';
5
- export * from './applyOptionsChain';
6
- export * from './commands';
7
- export * from './common';
8
- export * from './ensure';
9
- export * from './fs';
10
- export * from './logger';
11
- export * from './monorepo';
12
- export * from './package';
13
- export * from './path';
14
- export * from './port';
15
- export * from './prettyInstructions';
16
- export * from './require';
17
- export * from './runtimeExports';
18
- export * from './watch';
19
- export * from './config';
20
- export * from './version';
21
- export * from './route';
22
- export * from './modulePath';
23
- export * from './routeComponentFiles';
24
- export * from './tsconfig';
1
+ export * from './constants.js';
2
+ export * from './get/index.js';
3
+ export * from './is/index.js';
4
+ export * from './alias.js';
5
+ export * from './applyOptionsChain.js';
6
+ export * from './commands.js';
7
+ export * from './common.js';
8
+ export * from './ensure.js';
9
+ export * from './fs.js';
10
+ export * from './logger.js';
11
+ export * from './monorepo.js';
12
+ export * from './package.js';
13
+ export * from './path.js';
14
+ export * from './port.js';
15
+ export * from './prettyInstructions.js';
16
+ export * from './require.js';
17
+ export * from './runtimeExports.js';
18
+ export * from './watch.js';
19
+ export * from './config.js';
20
+ export * from './version.js';
21
+ export * from './route.js';
22
+ export * from './modulePath.js';
23
+ export * from './routeComponentFiles.js';
24
+ export * from './tsconfig.js';
@@ -1,4 +1,4 @@
1
- export * from './env';
2
- export * from './type';
3
- export * from './config';
4
- export * from './project';
1
+ export * from './env.js';
2
+ export * from './type.js';
3
+ export * from './config.js';
4
+ export * from './project.js';
@@ -4,5 +4,5 @@ type RunTaskType = (option: {
4
4
  changedFilePath: string;
5
5
  changeType: WatchChangeTypeValueT;
6
6
  }) => void | Promise<void>;
7
- export declare const watch: (watchDir: string | string[], runTask: RunTaskType, ignored?: (string | RegExp)[]) => import("../../../compiled/chokidar/types").FSWatcher;
7
+ export declare const watch: (watchDir: string | string[], runTask: RunTaskType, ignored?: (string | RegExp)[]) => import("../../../compiled/chokidar/types/index.js").FSWatcher;
8
8
  export {};
@@ -1,37 +1,37 @@
1
- export { default as fs } from '../compiled/fs-extra';
2
- export { default as ora } from '../compiled/ora';
3
- export { default as glob } from '../compiled/glob';
4
- export { default as yaml } from '../compiled/js-yaml';
5
- export { default as chalk } from '../compiled/chalk';
6
- export { default as debug } from '../compiled/debug';
7
- export { default as slash } from '../compiled/slash';
8
- export { default as execa } from '../compiled/execa';
1
+ export { default as fs } from '../compiled/fs-extra/index.js';
2
+ export { default as ora } from '../compiled/ora/index.js';
3
+ export { default as glob } from '../compiled/glob/index.js';
4
+ export { default as yaml } from '../compiled/js-yaml/index.js';
5
+ export { default as chalk } from '../compiled/chalk/index.js';
6
+ export { default as debug } from '../compiled/debug/index.js';
7
+ export { default as slash } from '../compiled/slash/index.js';
8
+ export { default as execa } from '../compiled/execa/index.js';
9
9
  export { default as json5 } from '../compiled/json5';
10
10
  export { default as upath } from '../compiled/upath';
11
- export { default as pkgUp } from '../compiled/pkg-up';
12
- export { nanoid } from '../compiled/nanoid';
13
- export { default as semver } from '../compiled/semver';
11
+ export { default as pkgUp } from '../compiled/pkg-up/index.js';
12
+ export { nanoid } from '../compiled/nanoid/index.js';
13
+ export { default as semver } from '../compiled/semver/index.js';
14
14
  export { default as dotenv } from '../compiled/dotenv';
15
- export { default as lodash } from '../compiled/lodash';
16
- export { default as globby } from '../compiled/globby';
15
+ export { default as lodash } from '../compiled/lodash/index.js';
16
+ export { default as globby } from '../compiled/globby/index.js';
17
17
  export { default as address } from '../compiled/address';
18
- export { default as signale } from '../compiled/signale';
19
- export { default as urlJoin } from '../compiled/url-join';
20
- export { default as minimist } from '../compiled/minimist';
18
+ export { default as signale } from '../compiled/signale/index.js';
19
+ export { default as urlJoin } from '../compiled/url-join/index.js';
20
+ export { default as minimist } from '../compiled/minimist/index.js';
21
21
  export { default as fastGlob } from '../compiled/fast-glob';
22
22
  export { default as filesize } from '../compiled/filesize';
23
- export { default as gzipSize } from '../compiled/gzip-size';
24
- export { default as stripAnsi } from '../compiled/strip-ansi';
25
- export { default as dotenvExpand } from '../compiled/dotenv-expand';
26
- export { default as browserslist } from '../compiled/browserslist';
23
+ export { default as gzipSize } from '../compiled/gzip-size/index.js';
24
+ export { default as stripAnsi } from '../compiled/strip-ansi/index.js';
25
+ export { default as dotenvExpand } from '../compiled/dotenv-expand/index.js';
26
+ export { default as browserslist } from '../compiled/browserslist/index.js';
27
27
  export { program, Command } from '../compiled/commander';
28
- import _signale from '../compiled/signale';
28
+ import _signale from '../compiled/signale/index.js';
29
29
  export declare const Signale: _signale.SignaleConstructor;
30
- export type { SignaleOptions } from '../compiled/signale';
31
- export type { IOptions as GlobOptions } from '../compiled/glob';
32
- export type { GlobbyOptions } from '../compiled/globby';
30
+ export type { SignaleOptions } from '../compiled/signale/index.js';
31
+ export type { IOptions as GlobOptions } from '../compiled/glob/index.js';
32
+ export type { GlobbyOptions } from '../compiled/globby/index.js';
33
33
  export type { FSWatcher, WatchOptions } from '../compiled/chokidar';
34
- export type { ExecaError } from '../compiled/execa';
35
- export declare const mime: typeof import('../compiled/mime-types');
34
+ export type { ExecaError } from '../compiled/execa/index.js';
35
+ export declare const mime: typeof import('../compiled/mime-types/index.js');
36
36
  export declare const chokidar: typeof import('../compiled/chokidar');
37
- export declare const inquirer: typeof import('../compiled/inquirer');
37
+ export declare const inquirer: typeof import('../compiled/inquirer/index.js');
@@ -1,3 +1,3 @@
1
- export * from './compiled';
2
- export * from './cli';
3
- export * from './import';
1
+ export * from './compiled.js';
2
+ export * from './cli/index.js';
3
+ export * from './import.js';
@@ -1 +1 @@
1
- export { cutNameByHyphen } from './path';
1
+ export { cutNameByHyphen } from './path.js';
package/package.json CHANGED
@@ -15,7 +15,7 @@
15
15
  "modern",
16
16
  "modern.js"
17
17
  ],
18
- "version": "3.8.3",
18
+ "version": "3.9.1",
19
19
  "types": "./dist/types/index.d.ts",
20
20
  "main": "./dist/cjs/index.js",
21
21
  "module": "./dist/esm/index.mjs",
@@ -142,13 +142,13 @@
142
142
  "rslog": "^1.3.2"
143
143
  },
144
144
  "devDependencies": {
145
- "@rslib/core": "0.23.2",
145
+ "@rslib/core": "1.0.0",
146
146
  "@types/node": "^20",
147
147
  "happy-dom": "^20.9.0",
148
148
  "typescript": "^5",
149
149
  "@modern-js/rslib": "2.68.10",
150
- "@scripts/rstest-config": "2.66.0",
151
- "@modern-js/types": "3.8.3"
150
+ "@modern-js/types": "3.9.1",
151
+ "@scripts/rstest-config": "2.66.0"
152
152
  },
153
153
  "peerDependencies": {
154
154
  "react": "^19.2.8",
package/rslib.config.mts CHANGED
@@ -105,7 +105,7 @@ for (const item of dependencies) {
105
105
 
106
106
  // externalize pre-bundled dependencies
107
107
  const createExternals =
108
- (type: string, noESM = false): Rspack.ExternalItem =>
108
+ (type?: string, noESM = false): Rspack.ExternalItem =>
109
109
  ({ request }, callback) => {
110
110
  const entries = Object.entries(externalsMap);
111
111
  if (request) {
@@ -117,20 +117,21 @@ const createExternals =
117
117
  }
118
118
  if (regex.test(request)) {
119
119
  const index = esm && !noESM ? 'index.mjs' : 'index.js';
120
- return callback(undefined, `${type} ${request}/${index}`);
120
+ const external = `${request}/${index}`;
121
+ return callback(undefined, type ? `${type} ${external}` : external);
121
122
  }
122
123
  }
123
124
  }
124
125
  callback();
125
126
  };
126
127
 
127
- const lib: RslibConfig['lib'] = rslibConfig.lib.map((config, index) => {
128
+ const lib: RslibConfig['lib'] = rslibConfig.lib?.map(config => {
128
129
  if (config.format === 'esm') {
129
130
  return {
130
131
  ...config,
131
132
  output: {
132
133
  ...config.output,
133
- externals: [createExternals('module-import')],
134
+ externals: [createExternals()],
134
135
  },
135
136
  };
136
137
  }