@modern-js/utils 2.23.1 → 2.24.0
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +11 -0
- package/dist/cjs/cli/get/config.js +2 -3
- package/dist/cjs/cli/index.js +0 -1
- package/dist/esm/cli/get/config.js +2 -3
- package/dist/esm/cli/index.js +0 -1
- package/dist/types/cli/get/config.d.ts +1 -1
- package/dist/types/cli/index.d.ts +0 -1
- package/package.json +5 -5
- package/dist/cjs/cli/routes.js +0 -29
- package/dist/esm/cli/routes.js +0 -18
- package/dist/types/cli/routes.d.ts +0 -1
package/CHANGELOG.md
CHANGED
@@ -1,5 +1,16 @@
|
|
1
1
|
# @modern-js/utils
|
2
2
|
|
3
|
+
## 2.24.0
|
4
|
+
|
5
|
+
### Patch Changes
|
6
|
+
|
7
|
+
- c882fbd: feat: support config main entry name
|
8
|
+
|
9
|
+
feat: 支持配置主入口名称
|
10
|
+
|
11
|
+
- 4a82c3b: fix: export `@remix-run/router` cjs instead of `react-router-dom`
|
12
|
+
fix: 暴露 `@remix-run/router` 的 cjs 导出代替 `react-router-dom`
|
13
|
+
|
3
14
|
## 2.23.1
|
4
15
|
|
5
16
|
### Patch Changes
|
@@ -9,11 +9,10 @@ Object.defineProperty(exports, "getEntryOptions", {
|
|
9
9
|
}
|
10
10
|
});
|
11
11
|
const _is = require("../is");
|
12
|
-
const
|
13
|
-
const getEntryOptions = (name, baseOptions, optionsByEntries, packageName) => {
|
12
|
+
const getEntryOptions = (name, isMainEntry, baseOptions, optionsByEntries, packageName) => {
|
14
13
|
if (optionsByEntries) {
|
15
14
|
let optionsByEntry = getOptionsByEntryName(name, optionsByEntries);
|
16
|
-
if (optionsByEntry === void 0 &&
|
15
|
+
if (optionsByEntry === void 0 && isMainEntry && packageName) {
|
17
16
|
optionsByEntry = getOptionsByEntryName(packageName, optionsByEntries);
|
18
17
|
}
|
19
18
|
return optionsByEntry !== void 0 ? (0, _is.isPlainObject)(optionsByEntry) && (0, _is.isPlainObject)(baseOptions) ? {
|
package/dist/cjs/cli/index.js
CHANGED
@@ -22,6 +22,5 @@ _export_star._(require("./port"), exports);
|
|
22
22
|
_export_star._(require("./prettyInstructions"), exports);
|
23
23
|
_export_star._(require("./print"), exports);
|
24
24
|
_export_star._(require("./require"), exports);
|
25
|
-
_export_star._(require("./routes"), exports);
|
26
25
|
_export_star._(require("./runtimeExports"), exports);
|
27
26
|
_export_star._(require("./watch"), exports);
|
@@ -1,9 +1,8 @@
|
|
1
1
|
import { isPlainObject } from "../is";
|
2
|
-
|
3
|
-
export const getEntryOptions = (name, baseOptions, optionsByEntries, packageName) => {
|
2
|
+
export const getEntryOptions = (name, isMainEntry, baseOptions, optionsByEntries, packageName) => {
|
4
3
|
if (optionsByEntries) {
|
5
4
|
let optionsByEntry = getOptionsByEntryName(name, optionsByEntries);
|
6
|
-
if (optionsByEntry === void 0 &&
|
5
|
+
if (optionsByEntry === void 0 && isMainEntry && packageName) {
|
7
6
|
optionsByEntry = getOptionsByEntryName(packageName, optionsByEntries);
|
8
7
|
}
|
9
8
|
return optionsByEntry !== void 0 ? isPlainObject(optionsByEntry) && isPlainObject(baseOptions) ? {
|
package/dist/esm/cli/index.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
export declare const getEntryOptions: <T>(name: string, baseOptions?: T | undefined, optionsByEntries?: Record<string, T> | undefined, packageName?: string) => T | undefined;
|
1
|
+
export declare const getEntryOptions: <T>(name: string, isMainEntry: boolean, baseOptions?: T | undefined, optionsByEntries?: Record<string, T> | undefined, packageName?: string) => T | undefined;
|
package/package.json
CHANGED
@@ -15,7 +15,7 @@
|
|
15
15
|
"modern",
|
16
16
|
"modern.js"
|
17
17
|
],
|
18
|
-
"version": "2.
|
18
|
+
"version": "2.24.0",
|
19
19
|
"jsnext:source": "./src/index.ts",
|
20
20
|
"types": "./dist/types/index.d.ts",
|
21
21
|
"main": "./dist/cjs/index.js",
|
@@ -36,11 +36,11 @@
|
|
36
36
|
},
|
37
37
|
"./runtime/router": {
|
38
38
|
"types": "./dist/types/runtime/router.d.ts",
|
39
|
-
"require": "./dist/cjs/runtime/router.js",
|
40
39
|
"default": "./dist/esm/runtime/router.js"
|
41
40
|
},
|
42
41
|
"./runtime/remix-router": {
|
43
42
|
"types": "./dist/types/runtime/remixRouter.d.ts",
|
43
|
+
"require": "./dist/cjs/runtime/remixRouter.js",
|
44
44
|
"default": "./dist/esm/runtime/remixRouter.js"
|
45
45
|
},
|
46
46
|
"./runtime/nested-routes": {
|
@@ -235,9 +235,9 @@
|
|
235
235
|
"typescript": "^5",
|
236
236
|
"webpack": "^5.82.1",
|
237
237
|
"@types/serialize-javascript": "^5.0.1",
|
238
|
-
"@modern-js/types": "2.
|
239
|
-
"@scripts/build": "2.
|
240
|
-
"@scripts/jest-config": "2.
|
238
|
+
"@modern-js/types": "2.24.0",
|
239
|
+
"@scripts/build": "2.24.0",
|
240
|
+
"@scripts/jest-config": "2.24.0"
|
241
241
|
},
|
242
242
|
"sideEffects": false,
|
243
243
|
"scripts": {
|
package/dist/cjs/cli/routes.js
DELETED
@@ -1,29 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
3
|
-
value: true
|
4
|
-
});
|
5
|
-
Object.defineProperty(exports, "getRouteId", {
|
6
|
-
enumerable: true,
|
7
|
-
get: function() {
|
8
|
-
return getRouteId;
|
9
|
-
}
|
10
|
-
});
|
11
|
-
const _interop_require_default = require("@swc/helpers/_/_interop_require_default");
|
12
|
-
const _path = /* @__PURE__ */ _interop_require_default._(require("path"));
|
13
|
-
const _constants = require("./constants");
|
14
|
-
const _path1 = require("./path");
|
15
|
-
const getPathWithoutExt = (filename) => {
|
16
|
-
const extname = _path.default.extname(filename);
|
17
|
-
return filename.slice(0, -extname.length);
|
18
|
-
};
|
19
|
-
const getRouteId = (componentPath, routesDir, entryName) => {
|
20
|
-
const relativePath = (0, _path1.normalizeToPosixPath)(_path.default.relative(routesDir, componentPath));
|
21
|
-
const pathWithoutExt = getPathWithoutExt(relativePath);
|
22
|
-
let id = ``;
|
23
|
-
if (entryName === _constants.MAIN_ENTRY_NAME) {
|
24
|
-
id = pathWithoutExt;
|
25
|
-
} else {
|
26
|
-
id = `${entryName}_${pathWithoutExt}`;
|
27
|
-
}
|
28
|
-
return id.replace(/\[(.*?)\]/g, "($1)");
|
29
|
-
};
|
package/dist/esm/cli/routes.js
DELETED
@@ -1,18 +0,0 @@
|
|
1
|
-
import path from "path";
|
2
|
-
import { MAIN_ENTRY_NAME } from "./constants";
|
3
|
-
import { normalizeToPosixPath } from "./path";
|
4
|
-
const getPathWithoutExt = (filename) => {
|
5
|
-
const extname = path.extname(filename);
|
6
|
-
return filename.slice(0, -extname.length);
|
7
|
-
};
|
8
|
-
export const getRouteId = (componentPath, routesDir, entryName) => {
|
9
|
-
const relativePath = normalizeToPosixPath(path.relative(routesDir, componentPath));
|
10
|
-
const pathWithoutExt = getPathWithoutExt(relativePath);
|
11
|
-
let id = ``;
|
12
|
-
if (entryName === MAIN_ENTRY_NAME) {
|
13
|
-
id = pathWithoutExt;
|
14
|
-
} else {
|
15
|
-
id = `${entryName}_${pathWithoutExt}`;
|
16
|
-
}
|
17
|
-
return id.replace(/\[(.*?)\]/g, "($1)");
|
18
|
-
};
|
@@ -1 +0,0 @@
|
|
1
|
-
export declare const getRouteId: (componentPath: string, routesDir: string, entryName: string) => string;
|