@backstage/cli-node 0.3.6-next.1 → 0.3.6-next.2
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/CHANGELOG.md +9 -0
- package/config/nodeTransformHooks.mjs +23 -8
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# @backstage/cli-node
|
|
2
2
|
|
|
3
|
+
## 0.3.6-next.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 8069934: Fixed the Node.js module transform loading ES module JavaScript files from packages without a `"type"` field as CommonJS, which broke named imports such as `import { DefaultGithubCredentialsProvider } from '@backstage/integration'` during local development. The format of these files is now detected by Node.js, while TypeScript files in such packages are still treated as CommonJS.
|
|
8
|
+
- Updated dependencies
|
|
9
|
+
- @backstage/errors@1.4.0-next.0
|
|
10
|
+
- @backstage/cli-common@0.3.3-next.0
|
|
11
|
+
|
|
3
12
|
## 0.3.6-next.1
|
|
4
13
|
|
|
5
14
|
### Patch Changes
|
|
@@ -112,13 +112,14 @@ function withDetectedModuleType(resolved) {
|
|
|
112
112
|
if (resolved.format) {
|
|
113
113
|
return resolved;
|
|
114
114
|
}
|
|
115
|
-
// Happens when there's a package.json without an explicit "type" field. Use the default.
|
|
116
|
-
if (resolved.format === null) {
|
|
117
|
-
return { ...resolved, format: DEFAULT_MODULE_FORMAT };
|
|
118
|
-
}
|
|
119
115
|
|
|
120
116
|
const ext = extname(resolved.url);
|
|
121
117
|
|
|
118
|
+
// Happens when there's a package.json without an explicit "type" field
|
|
119
|
+
if (resolved.format === null) {
|
|
120
|
+
return withTypelessFormat(resolved, ext);
|
|
121
|
+
}
|
|
122
|
+
|
|
122
123
|
const explicitFormat = moduleTypeTable[ext];
|
|
123
124
|
if (explicitFormat) {
|
|
124
125
|
return {
|
|
@@ -139,10 +140,24 @@ function withDetectedModuleType(resolved) {
|
|
|
139
140
|
}
|
|
140
141
|
|
|
141
142
|
const packageJson = JSON.parse(readFileSync(packageJsonPath, 'utf8'));
|
|
142
|
-
|
|
143
|
-
...resolved,
|
|
144
|
-
|
|
145
|
-
|
|
143
|
+
if (packageJson.type) {
|
|
144
|
+
return { ...resolved, format: packageJson.type };
|
|
145
|
+
}
|
|
146
|
+
return withTypelessFormat(resolved, ext);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* Leaves the format of JavaScript files in typeless packages to Node.js syntax
|
|
151
|
+
* detection, but keeps TypeScript as CommonJS so it goes through our transform.
|
|
152
|
+
*
|
|
153
|
+
* @param {import('module').ResolveFnOutput} resolved
|
|
154
|
+
* @param {string} ext
|
|
155
|
+
* @returns {import('module').ResolveFnOutput}
|
|
156
|
+
*/
|
|
157
|
+
function withTypelessFormat(resolved, ext) {
|
|
158
|
+
return TS_EXTS.includes(ext)
|
|
159
|
+
? { ...resolved, format: DEFAULT_MODULE_FORMAT }
|
|
160
|
+
: resolved;
|
|
146
161
|
}
|
|
147
162
|
|
|
148
163
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@backstage/cli-node",
|
|
3
|
-
"version": "0.3.6-next.
|
|
3
|
+
"version": "0.3.6-next.2",
|
|
4
4
|
"description": "Node.js library for Backstage CLIs",
|
|
5
5
|
"backstage": {
|
|
6
6
|
"role": "node-library"
|
|
@@ -32,8 +32,8 @@
|
|
|
32
32
|
"test": "backstage-cli package test"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@backstage/cli-common": "0.3.
|
|
36
|
-
"@backstage/errors": "1.
|
|
35
|
+
"@backstage/cli-common": "0.3.3-next.0",
|
|
36
|
+
"@backstage/errors": "1.4.0-next.0",
|
|
37
37
|
"@backstage/types": "1.2.2",
|
|
38
38
|
"@manypkg/get-packages": "^1.1.3",
|
|
39
39
|
"@yarnpkg/lockfile": "^1.1.0",
|
|
@@ -48,9 +48,9 @@
|
|
|
48
48
|
"zod": "^3.25.76 || ^4.0.0"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
|
-
"@backstage/backend-test-utils": "1.
|
|
52
|
-
"@backstage/cli": "0.36.8-next.
|
|
53
|
-
"@backstage/test-utils": "1.7.24-next.
|
|
51
|
+
"@backstage/backend-test-utils": "1.12.0-next.2",
|
|
52
|
+
"@backstage/cli": "0.36.8-next.2",
|
|
53
|
+
"@backstage/test-utils": "1.7.24-next.1",
|
|
54
54
|
"@types/proper-lockfile": "^4",
|
|
55
55
|
"@types/yarnpkg__lockfile": "^1.1.4"
|
|
56
56
|
},
|