@yarnpkg/plugin-pnp 4.0.0-rc.14 → 4.0.0-rc.17
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/lib/PnpLinker.js +5 -10
- package/lib/index.d.ts +1 -2
- package/lib/index.js +3 -8
- package/package.json +9 -9
package/lib/PnpLinker.js
CHANGED
|
@@ -189,16 +189,13 @@ class PnpInstaller {
|
|
|
189
189
|
if (this.opts.project.configuration.get(`pnpMode`) !== this.mode)
|
|
190
190
|
return undefined;
|
|
191
191
|
const pnpPath = (0, index_1.getPnpPath)(this.opts.project);
|
|
192
|
-
if (fslib_1.xfs.existsSync(pnpPath.cjsLegacy)) {
|
|
193
|
-
this.opts.report.reportWarning(core_2.MessageName.UNNAMED, `Removing the old ${core_1.formatUtils.pretty(this.opts.project.configuration, fslib_1.Filename.pnpJs, core_1.formatUtils.Type.PATH)} file. You might need to manually update existing references to reference the new ${core_1.formatUtils.pretty(this.opts.project.configuration, fslib_1.Filename.pnpCjs, core_1.formatUtils.Type.PATH)} file. If you use Editor SDKs, you'll have to rerun ${core_1.formatUtils.pretty(this.opts.project.configuration, `yarn sdks`, core_1.formatUtils.Type.CODE)}.`);
|
|
194
|
-
await fslib_1.xfs.removePromise(pnpPath.cjsLegacy);
|
|
195
|
-
}
|
|
196
192
|
if (!this.isEsmEnabled())
|
|
197
193
|
await fslib_1.xfs.removePromise(pnpPath.esmLoader);
|
|
198
194
|
if (this.opts.project.configuration.get(`nodeLinker`) !== `pnp`) {
|
|
199
195
|
await fslib_1.xfs.removePromise(pnpPath.cjs);
|
|
200
|
-
await fslib_1.xfs.removePromise(
|
|
196
|
+
await fslib_1.xfs.removePromise(pnpPath.data);
|
|
201
197
|
await fslib_1.xfs.removePromise(pnpPath.esmLoader);
|
|
198
|
+
await fslib_1.xfs.removePromise(this.opts.project.configuration.get(`pnpUnpluggedFolder`));
|
|
202
199
|
return undefined;
|
|
203
200
|
}
|
|
204
201
|
for (const { locator, location } of this.virtualTemplates.values()) {
|
|
@@ -256,7 +253,6 @@ class PnpInstaller {
|
|
|
256
253
|
}
|
|
257
254
|
async finalizeInstallWithPnp(pnpSettings) {
|
|
258
255
|
const pnpPath = (0, index_1.getPnpPath)(this.opts.project);
|
|
259
|
-
const pnpDataPath = this.opts.project.configuration.get(`pnpDataPath`);
|
|
260
256
|
const nodeModules = await this.locateNodeModules(pnpSettings.ignorePattern);
|
|
261
257
|
if (nodeModules.length > 0) {
|
|
262
258
|
this.opts.report.reportWarning(core_2.MessageName.DANGEROUS_NODE_MODULES, `One or more node_modules have been detected and will be removed. This operation may take some time.`);
|
|
@@ -271,16 +267,15 @@ class PnpInstaller {
|
|
|
271
267
|
automaticNewlines: true,
|
|
272
268
|
mode: 0o755,
|
|
273
269
|
});
|
|
274
|
-
await fslib_1.xfs.removePromise(
|
|
270
|
+
await fslib_1.xfs.removePromise(pnpPath.data);
|
|
275
271
|
}
|
|
276
272
|
else {
|
|
277
|
-
const
|
|
278
|
-
const { dataFile, loaderFile } = (0, pnp_1.generateSplitScript)({ ...pnpSettings, dataLocation });
|
|
273
|
+
const { dataFile, loaderFile } = (0, pnp_1.generateSplitScript)(pnpSettings);
|
|
279
274
|
await fslib_1.xfs.changeFilePromise(pnpPath.cjs, loaderFile, {
|
|
280
275
|
automaticNewlines: true,
|
|
281
276
|
mode: 0o755,
|
|
282
277
|
});
|
|
283
|
-
await fslib_1.xfs.changeFilePromise(
|
|
278
|
+
await fslib_1.xfs.changeFilePromise(pnpPath.data, dataFile, {
|
|
284
279
|
automaticNewlines: true,
|
|
285
280
|
mode: 0o644,
|
|
286
281
|
});
|
package/lib/index.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ export { jsInstallUtils };
|
|
|
7
7
|
export { pnpUtils };
|
|
8
8
|
export declare const getPnpPath: (project: Project) => {
|
|
9
9
|
cjs: PortablePath;
|
|
10
|
-
|
|
10
|
+
data: PortablePath;
|
|
11
11
|
esmLoader: PortablePath;
|
|
12
12
|
};
|
|
13
13
|
export declare const quotePathIfNeeded: (path: string) => string;
|
|
@@ -21,7 +21,6 @@ declare module '@yarnpkg/core' {
|
|
|
21
21
|
pnpEnableInlining: boolean;
|
|
22
22
|
pnpFallbackMode: string;
|
|
23
23
|
pnpUnpluggedFolder: PortablePath;
|
|
24
|
-
pnpDataPath: PortablePath;
|
|
25
24
|
}
|
|
26
25
|
}
|
|
27
26
|
declare const plugin: Plugin<CoreHooks & StageHooks>;
|
package/lib/index.js
CHANGED
|
@@ -15,8 +15,8 @@ exports.pnpUtils = pnpUtils;
|
|
|
15
15
|
const getPnpPath = (project) => {
|
|
16
16
|
return {
|
|
17
17
|
cjs: fslib_1.ppath.join(project.cwd, fslib_1.Filename.pnpCjs),
|
|
18
|
-
|
|
19
|
-
esmLoader: fslib_1.ppath.join(project.cwd,
|
|
18
|
+
data: fslib_1.ppath.join(project.cwd, fslib_1.Filename.pnpData),
|
|
19
|
+
esmLoader: fslib_1.ppath.join(project.cwd, fslib_1.Filename.pnpEsmLoader),
|
|
20
20
|
};
|
|
21
21
|
};
|
|
22
22
|
exports.getPnpPath = getPnpPath;
|
|
@@ -45,8 +45,8 @@ async function setupScriptEnvironment(project, env, makePathWrapper) {
|
|
|
45
45
|
async function populateYarnPaths(project, definePath) {
|
|
46
46
|
const pnpPath = (0, exports.getPnpPath)(project);
|
|
47
47
|
definePath(pnpPath.cjs);
|
|
48
|
+
definePath(pnpPath.data);
|
|
48
49
|
definePath(pnpPath.esmLoader);
|
|
49
|
-
definePath(project.configuration.get(`pnpDataPath`));
|
|
50
50
|
definePath(project.configuration.get(`pnpUnpluggedFolder`));
|
|
51
51
|
}
|
|
52
52
|
const plugin = {
|
|
@@ -96,11 +96,6 @@ const plugin = {
|
|
|
96
96
|
type: core_1.SettingsType.ABSOLUTE_PATH,
|
|
97
97
|
default: `./.yarn/unplugged`,
|
|
98
98
|
},
|
|
99
|
-
pnpDataPath: {
|
|
100
|
-
description: `Path of the file where the PnP data (used by the loader) must be written`,
|
|
101
|
-
type: core_1.SettingsType.ABSOLUTE_PATH,
|
|
102
|
-
default: `./.pnp.data.json`,
|
|
103
|
-
},
|
|
104
99
|
},
|
|
105
100
|
linkers: [
|
|
106
101
|
PnpLinker_1.PnpLinker,
|
package/package.json
CHANGED
|
@@ -1,27 +1,27 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yarnpkg/plugin-pnp",
|
|
3
|
-
"version": "4.0.0-rc.
|
|
3
|
+
"version": "4.0.0-rc.17",
|
|
4
4
|
"stableVersion": "3.2.2",
|
|
5
5
|
"license": "BSD-2-Clause",
|
|
6
6
|
"main": "./lib/index.js",
|
|
7
7
|
"dependencies": {
|
|
8
8
|
"@types/semver": "^7.1.0",
|
|
9
|
-
"@yarnpkg/fslib": "^3.0.0-rc.
|
|
10
|
-
"@yarnpkg/plugin-stage": "^4.0.0-rc.
|
|
11
|
-
"@yarnpkg/pnp": "^4.0.0-rc.
|
|
9
|
+
"@yarnpkg/fslib": "^3.0.0-rc.17",
|
|
10
|
+
"@yarnpkg/plugin-stage": "^4.0.0-rc.17",
|
|
11
|
+
"@yarnpkg/pnp": "^4.0.0-rc.17",
|
|
12
12
|
"clipanion": "^3.2.0-rc.10",
|
|
13
13
|
"micromatch": "^4.0.2",
|
|
14
14
|
"semver": "^7.1.2",
|
|
15
|
-
"tslib": "^
|
|
15
|
+
"tslib": "^2.4.0"
|
|
16
16
|
},
|
|
17
17
|
"peerDependencies": {
|
|
18
|
-
"@yarnpkg/cli": "^4.0.0-rc.
|
|
19
|
-
"@yarnpkg/core": "^4.0.0-rc.
|
|
18
|
+
"@yarnpkg/cli": "^4.0.0-rc.17",
|
|
19
|
+
"@yarnpkg/core": "^4.0.0-rc.17"
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
22
22
|
"@types/micromatch": "^4.0.1",
|
|
23
|
-
"@yarnpkg/cli": "^4.0.0-rc.
|
|
24
|
-
"@yarnpkg/core": "^4.0.0-rc.
|
|
23
|
+
"@yarnpkg/cli": "^4.0.0-rc.17",
|
|
24
|
+
"@yarnpkg/core": "^4.0.0-rc.17"
|
|
25
25
|
},
|
|
26
26
|
"repository": {
|
|
27
27
|
"type": "git",
|