@yarnpkg/plugin-pnp 4.0.0-rc.11 → 4.0.0-rc.15
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 +8 -10
- package/lib/index.d.ts +1 -2
- package/lib/index.js +3 -8
- package/package.json +10 -10
package/lib/PnpLinker.js
CHANGED
|
@@ -18,6 +18,9 @@ const FORCED_UNPLUG_PACKAGES = new Set([
|
|
|
18
18
|
core_1.structUtils.makeIdent(null, `node-addon-api`).identHash,
|
|
19
19
|
// Those ones contain native builds (*.node), and Node loads them through dlopen
|
|
20
20
|
core_1.structUtils.makeIdent(null, `fsevents`).identHash,
|
|
21
|
+
// Contains native binaries
|
|
22
|
+
core_1.structUtils.makeIdent(null, `open`).identHash,
|
|
23
|
+
core_1.structUtils.makeIdent(null, `opn`).identHash,
|
|
21
24
|
]);
|
|
22
25
|
class PnpLinker {
|
|
23
26
|
constructor() {
|
|
@@ -186,16 +189,13 @@ class PnpInstaller {
|
|
|
186
189
|
if (this.opts.project.configuration.get(`pnpMode`) !== this.mode)
|
|
187
190
|
return undefined;
|
|
188
191
|
const pnpPath = (0, index_1.getPnpPath)(this.opts.project);
|
|
189
|
-
if (fslib_1.xfs.existsSync(pnpPath.cjsLegacy)) {
|
|
190
|
-
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)}.`);
|
|
191
|
-
await fslib_1.xfs.removePromise(pnpPath.cjsLegacy);
|
|
192
|
-
}
|
|
193
192
|
if (!this.isEsmEnabled())
|
|
194
193
|
await fslib_1.xfs.removePromise(pnpPath.esmLoader);
|
|
195
194
|
if (this.opts.project.configuration.get(`nodeLinker`) !== `pnp`) {
|
|
196
195
|
await fslib_1.xfs.removePromise(pnpPath.cjs);
|
|
197
|
-
await fslib_1.xfs.removePromise(
|
|
196
|
+
await fslib_1.xfs.removePromise(pnpPath.data);
|
|
198
197
|
await fslib_1.xfs.removePromise(pnpPath.esmLoader);
|
|
198
|
+
await fslib_1.xfs.removePromise(this.opts.project.configuration.get(`pnpUnpluggedFolder`));
|
|
199
199
|
return undefined;
|
|
200
200
|
}
|
|
201
201
|
for (const { locator, location } of this.virtualTemplates.values()) {
|
|
@@ -253,7 +253,6 @@ class PnpInstaller {
|
|
|
253
253
|
}
|
|
254
254
|
async finalizeInstallWithPnp(pnpSettings) {
|
|
255
255
|
const pnpPath = (0, index_1.getPnpPath)(this.opts.project);
|
|
256
|
-
const pnpDataPath = this.opts.project.configuration.get(`pnpDataPath`);
|
|
257
256
|
const nodeModules = await this.locateNodeModules(pnpSettings.ignorePattern);
|
|
258
257
|
if (nodeModules.length > 0) {
|
|
259
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.`);
|
|
@@ -268,16 +267,15 @@ class PnpInstaller {
|
|
|
268
267
|
automaticNewlines: true,
|
|
269
268
|
mode: 0o755,
|
|
270
269
|
});
|
|
271
|
-
await fslib_1.xfs.removePromise(
|
|
270
|
+
await fslib_1.xfs.removePromise(pnpPath.data);
|
|
272
271
|
}
|
|
273
272
|
else {
|
|
274
|
-
const
|
|
275
|
-
const { dataFile, loaderFile } = (0, pnp_1.generateSplitScript)({ ...pnpSettings, dataLocation });
|
|
273
|
+
const { dataFile, loaderFile } = (0, pnp_1.generateSplitScript)(pnpSettings);
|
|
276
274
|
await fslib_1.xfs.changeFilePromise(pnpPath.cjs, loaderFile, {
|
|
277
275
|
automaticNewlines: true,
|
|
278
276
|
mode: 0o755,
|
|
279
277
|
});
|
|
280
|
-
await fslib_1.xfs.changeFilePromise(
|
|
278
|
+
await fslib_1.xfs.changeFilePromise(pnpPath.data, dataFile, {
|
|
281
279
|
automaticNewlines: true,
|
|
282
280
|
mode: 0o644,
|
|
283
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,26 +1,27 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yarnpkg/plugin-pnp",
|
|
3
|
-
"version": "4.0.0-rc.
|
|
3
|
+
"version": "4.0.0-rc.15",
|
|
4
|
+
"stableVersion": "3.2.2",
|
|
4
5
|
"license": "BSD-2-Clause",
|
|
5
6
|
"main": "./lib/index.js",
|
|
6
7
|
"dependencies": {
|
|
7
8
|
"@types/semver": "^7.1.0",
|
|
8
|
-
"@yarnpkg/fslib": "^3.0.0-rc.
|
|
9
|
-
"@yarnpkg/plugin-stage": "^4.0.0-rc.
|
|
10
|
-
"@yarnpkg/pnp": "^4.0.0-rc.
|
|
9
|
+
"@yarnpkg/fslib": "^3.0.0-rc.15",
|
|
10
|
+
"@yarnpkg/plugin-stage": "^4.0.0-rc.15",
|
|
11
|
+
"@yarnpkg/pnp": "^4.0.0-rc.15",
|
|
11
12
|
"clipanion": "^3.2.0-rc.10",
|
|
12
13
|
"micromatch": "^4.0.2",
|
|
13
14
|
"semver": "^7.1.2",
|
|
14
|
-
"tslib": "^
|
|
15
|
+
"tslib": "^2.4.0"
|
|
15
16
|
},
|
|
16
17
|
"peerDependencies": {
|
|
17
|
-
"@yarnpkg/cli": "^4.0.0-rc.
|
|
18
|
-
"@yarnpkg/core": "^4.0.0-rc.
|
|
18
|
+
"@yarnpkg/cli": "^4.0.0-rc.15",
|
|
19
|
+
"@yarnpkg/core": "^4.0.0-rc.15"
|
|
19
20
|
},
|
|
20
21
|
"devDependencies": {
|
|
21
22
|
"@types/micromatch": "^4.0.1",
|
|
22
|
-
"@yarnpkg/cli": "^4.0.0-rc.
|
|
23
|
-
"@yarnpkg/core": "^4.0.0-rc.
|
|
23
|
+
"@yarnpkg/cli": "^4.0.0-rc.15",
|
|
24
|
+
"@yarnpkg/core": "^4.0.0-rc.15"
|
|
24
25
|
},
|
|
25
26
|
"repository": {
|
|
26
27
|
"type": "git",
|
|
@@ -41,6 +42,5 @@
|
|
|
41
42
|
"engines": {
|
|
42
43
|
"node": ">=14.15.0"
|
|
43
44
|
},
|
|
44
|
-
"stableVersion": "3.2.0",
|
|
45
45
|
"typings": "./lib/index.d.ts"
|
|
46
46
|
}
|