@nx/rollup 23.2.0-beta.6 → 23.2.0-beta.8
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.
|
@@ -4,7 +4,6 @@ exports.updatePackageJson = updatePackageJson;
|
|
|
4
4
|
const path_1 = require("path");
|
|
5
5
|
const devkit_1 = require("@nx/devkit");
|
|
6
6
|
const fs_1 = require("fs");
|
|
7
|
-
const devkit_2 = require("@nx/devkit");
|
|
8
7
|
function updatePackageJson(options, packageJson) {
|
|
9
8
|
const jsFileRegex = /(\.cjs|\.mjs|\.esm\.js|\.cjs\.js|\.mjs\.js|\.js)$/;
|
|
10
9
|
const hasEsmFormat = options.format.includes('esm');
|
|
@@ -63,10 +62,10 @@ function updatePackageJson(options, packageJson) {
|
|
|
63
62
|
// Make sure both ESM and CJS point to same instance of the package because libs like React, RxJS, etc. requires it.
|
|
64
63
|
// Also need a special .cjs.default.js file that re-exports the `default` from CJS, or else
|
|
65
64
|
// default import in Node will not work.
|
|
66
|
-
(0, fs_1.writeFileSync)((0, path_1.join)(
|
|
67
|
-
(0, fs_1.writeFileSync)((0, path_1.join)(
|
|
65
|
+
(0, fs_1.writeFileSync)((0, path_1.join)(devkit_1.workspaceRoot, options.outputPath, filePath.replace(/\.cjs\.js$/, '.cjs.default.js')), `exports._default = require('./${(0, path_1.parse)(filePath).base}').default;`);
|
|
66
|
+
(0, fs_1.writeFileSync)((0, path_1.join)(devkit_1.workspaceRoot, options.outputPath, fauxEsmFilePath),
|
|
68
67
|
// Re-export from relative CJS file, and Node will synthetically export it as ESM.
|
|
69
|
-
(0,
|
|
68
|
+
(0, devkit_1.stripIndents) `
|
|
70
69
|
export * from './${relativeFile}';
|
|
71
70
|
export { _default as default } from './${relativeFile.replace(/\.cjs\.js$/, '.cjs.default.js')}';
|
|
72
71
|
`);
|
|
@@ -83,7 +82,7 @@ function updatePackageJson(options, packageJson) {
|
|
|
83
82
|
else {
|
|
84
83
|
packageJson.types ??= packageJson.main.replace(jsFileRegex, '.d.ts');
|
|
85
84
|
}
|
|
86
|
-
(0, devkit_1.writeJsonFile)((0, path_1.join)(
|
|
85
|
+
(0, devkit_1.writeJsonFile)((0, path_1.join)(devkit_1.workspaceRoot, options.outputPath, 'package.json'), packageJson);
|
|
87
86
|
}
|
|
88
87
|
function getExports(options) {
|
|
89
88
|
const exports = {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/rollup",
|
|
3
|
-
"version": "23.2.0-beta.
|
|
3
|
+
"version": "23.2.0-beta.8",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"files": [
|
|
@@ -91,8 +91,8 @@
|
|
|
91
91
|
"postcss": "^8.4.38",
|
|
92
92
|
"postcss-modules": "^6.0.1",
|
|
93
93
|
"tslib": "^2.3.0",
|
|
94
|
-
"@nx/devkit": "23.2.0-beta.
|
|
95
|
-
"@nx/js": "23.2.0-beta.
|
|
94
|
+
"@nx/devkit": "23.2.0-beta.8",
|
|
95
|
+
"@nx/js": "23.2.0-beta.8"
|
|
96
96
|
},
|
|
97
97
|
"peerDependencies": {
|
|
98
98
|
"rollup": "^3.0.0 || ^4.0.0"
|
|
@@ -104,7 +104,7 @@
|
|
|
104
104
|
},
|
|
105
105
|
"devDependencies": {
|
|
106
106
|
"source-map-js": "^1.2.0",
|
|
107
|
-
"nx": "23.2.0-beta.
|
|
107
|
+
"nx": "23.2.0-beta.8"
|
|
108
108
|
},
|
|
109
109
|
"publishConfig": {
|
|
110
110
|
"access": "public"
|