@next-core/build-next-bricks 1.13.1 → 1.13.3
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.
- package/package.json +11 -11
- package/src/isDeprecatedV2Packages.js +39 -0
- package/src/scanBricks.js +7 -5
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@next-core/build-next-bricks",
|
|
3
|
-
"version": "1.13.
|
|
3
|
+
"version": "1.13.3",
|
|
4
4
|
"description": "Build next bricks",
|
|
5
5
|
"homepage": "https://github.com/easyops-cn/next-core/tree/v3/packages/build-next-bricks",
|
|
6
6
|
"license": "GPL-3.0",
|
|
@@ -31,25 +31,25 @@
|
|
|
31
31
|
"node": ">=16"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@babel/parser": "^7.
|
|
35
|
-
"@babel/traverse": "^7.
|
|
34
|
+
"@babel/parser": "^7.22.7",
|
|
35
|
+
"@babel/traverse": "^7.22.8",
|
|
36
36
|
"@svgr/webpack": "^8.0.1",
|
|
37
|
-
"babel-loader": "^9.1.
|
|
38
|
-
"css-loader": "^6.
|
|
37
|
+
"babel-loader": "^9.1.3",
|
|
38
|
+
"css-loader": "^6.8.1",
|
|
39
39
|
"cssnano": "^6.0.1",
|
|
40
40
|
"cssnano-preset-lite": "^3.0.0",
|
|
41
41
|
"doctrine": "^3.0.0",
|
|
42
42
|
"lodash": "^4.17.21",
|
|
43
43
|
"mini-css-extract-plugin": "^2.7.6",
|
|
44
|
-
"postcss": "^8.4.
|
|
45
|
-
"postcss-loader": "^7.3.
|
|
46
|
-
"postcss-preset-env": "^8.
|
|
44
|
+
"postcss": "^8.4.26",
|
|
45
|
+
"postcss-loader": "^7.3.3",
|
|
46
|
+
"postcss-preset-env": "^8.5.1",
|
|
47
47
|
"style-loader": "^3.3.3",
|
|
48
|
-
"typescript": "^5.
|
|
49
|
-
"webpack": "^5.
|
|
48
|
+
"typescript": "^5.1.6",
|
|
49
|
+
"webpack": "^5.88.2"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
52
|
"@next-core/brick-manifest": "^0.5.0"
|
|
53
53
|
},
|
|
54
|
-
"gitHead": "
|
|
54
|
+
"gitHead": "c0d55765acc79bbc1ca232ba899b3cae3fa7a207"
|
|
55
55
|
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
// @ts-check
|
|
2
|
+
const V2_NEXT_CORE_PACKAGES = new Set([
|
|
3
|
+
"brick-dll",
|
|
4
|
+
"brick-kit",
|
|
5
|
+
"brick-utils",
|
|
6
|
+
"brick-types",
|
|
7
|
+
"brick-http",
|
|
8
|
+
"rollup-config-factory",
|
|
9
|
+
"webpack-config-factory",
|
|
10
|
+
"build-config-factory",
|
|
11
|
+
"jest-config-factory",
|
|
12
|
+
"custom-antd-styles",
|
|
13
|
+
"editor-bricks-helper",
|
|
14
|
+
"fontawesome-library",
|
|
15
|
+
]);
|
|
16
|
+
|
|
17
|
+
const V2_PREFIXES = new Set([
|
|
18
|
+
"@next-dll",
|
|
19
|
+
"@next-libs",
|
|
20
|
+
"@next-sdk",
|
|
21
|
+
"@dll",
|
|
22
|
+
"@libs",
|
|
23
|
+
"@sdk",
|
|
24
|
+
]);
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* @param {string} pkg
|
|
28
|
+
* @return {boolean}
|
|
29
|
+
*/
|
|
30
|
+
export default function isDeprecatedV2Packages(pkg) {
|
|
31
|
+
if (!pkg.startsWith("@")) {
|
|
32
|
+
return false;
|
|
33
|
+
}
|
|
34
|
+
const [prefix, name] = pkg.split("/");
|
|
35
|
+
if (prefix === "@next-core" || prefix === "@easyops") {
|
|
36
|
+
return V2_NEXT_CORE_PACKAGES.has(name);
|
|
37
|
+
}
|
|
38
|
+
return V2_PREFIXES.has(prefix);
|
|
39
|
+
}
|
package/src/scanBricks.js
CHANGED
|
@@ -14,6 +14,7 @@ import {
|
|
|
14
14
|
isImportSpecifier,
|
|
15
15
|
} from "@babel/types";
|
|
16
16
|
import getTypeDeclaration from "./getTypeDeclaration.js";
|
|
17
|
+
import isDeprecatedV2Packages from "./isDeprecatedV2Packages.js";
|
|
17
18
|
|
|
18
19
|
/**
|
|
19
20
|
*
|
|
@@ -91,10 +92,6 @@ export default async function scanBricks(packageDir) {
|
|
|
91
92
|
*/
|
|
92
93
|
async function scanByFile(filePath, overrideImport) {
|
|
93
94
|
if (processedFiles.has(filePath)) {
|
|
94
|
-
console.warn(
|
|
95
|
-
"[scan-bricks] warn: the file has already been scanned:",
|
|
96
|
-
filePath
|
|
97
|
-
);
|
|
98
95
|
return;
|
|
99
96
|
}
|
|
100
97
|
processedFiles.add(filePath);
|
|
@@ -534,7 +531,6 @@ export default async function scanBricks(packageDir) {
|
|
|
534
531
|
ImportDeclaration({ node: { source, importKind } }) {
|
|
535
532
|
// Match `import "..."`
|
|
536
533
|
if (
|
|
537
|
-
source.type === "StringLiteral" &&
|
|
538
534
|
// Ignore import from node modules.
|
|
539
535
|
(source.value.startsWith("./") || source.value.startsWith("../")) &&
|
|
540
536
|
// Ignore `import type {...} from "..."`
|
|
@@ -562,6 +558,12 @@ export default async function scanBricks(packageDir) {
|
|
|
562
558
|
addImportFile(importPath, "index");
|
|
563
559
|
}
|
|
564
560
|
}
|
|
561
|
+
|
|
562
|
+
if (isDeprecatedV2Packages(source.value)) {
|
|
563
|
+
throw new Error(
|
|
564
|
+
`Using deprecated v2 packages is prohibited in v3: "${source.value}"`
|
|
565
|
+
);
|
|
566
|
+
}
|
|
565
567
|
},
|
|
566
568
|
TSInterfaceDeclaration({ node }) {
|
|
567
569
|
const usedReferences = new Set();
|