@yarnpkg/plugin-pnp 4.0.1 → 4.0.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yarnpkg/plugin-pnp",
3
- "version": "4.0.1",
3
+ "version": "4.0.3",
4
4
  "license": "BSD-2-Clause",
5
5
  "main": "./lib/index.js",
6
6
  "exports": {
@@ -8,21 +8,21 @@
8
8
  "./package.json": "./package.json"
9
9
  },
10
10
  "dependencies": {
11
- "@yarnpkg/fslib": "^3.0.1",
11
+ "@yarnpkg/fslib": "^3.0.2",
12
12
  "@yarnpkg/plugin-stage": "^4.0.0",
13
- "@yarnpkg/pnp": "^4.0.0",
13
+ "@yarnpkg/pnp": "^4.0.3",
14
14
  "clipanion": "^4.0.0-rc.2",
15
15
  "micromatch": "^4.0.2",
16
16
  "tslib": "^2.4.0"
17
17
  },
18
18
  "peerDependencies": {
19
- "@yarnpkg/cli": "^4.0.1",
20
- "@yarnpkg/core": "^4.0.1"
19
+ "@yarnpkg/cli": "^4.2.0",
20
+ "@yarnpkg/core": "^4.0.4"
21
21
  },
22
22
  "devDependencies": {
23
23
  "@types/micromatch": "^4.0.1",
24
- "@yarnpkg/cli": "^4.0.1",
25
- "@yarnpkg/core": "^4.0.1"
24
+ "@yarnpkg/cli": "^4.2.0",
25
+ "@yarnpkg/core": "^4.0.4"
26
26
  },
27
27
  "repository": {
28
28
  "type": "git",
@@ -1,57 +0,0 @@
1
- import { Descriptor, LocatorHash, InstallPackageExtraApi } from '@yarnpkg/core';
2
- import { FetchResult, Locator, Package } from '@yarnpkg/core';
3
- import { Linker, LinkOptions, MinimalLinkOptions, Installer } from '@yarnpkg/core';
4
- import { PortablePath } from '@yarnpkg/fslib';
5
- import { PnpSettings } from '@yarnpkg/pnp';
6
- export declare class PnpLinker implements Linker {
7
- protected mode: string;
8
- private pnpCache;
9
- getCustomDataKey(): string;
10
- supportsPackage(pkg: Package, opts: MinimalLinkOptions): boolean;
11
- findPackageLocation(locator: Locator, opts: LinkOptions): Promise<PortablePath>;
12
- findPackageLocator(location: PortablePath, opts: LinkOptions): Promise<Locator | null>;
13
- makeInstaller(opts: LinkOptions): PnpInstaller;
14
- private isEnabled;
15
- }
16
- export declare class PnpInstaller implements Installer {
17
- protected opts: LinkOptions;
18
- protected mode: string;
19
- private readonly asyncActions;
20
- private readonly packageRegistry;
21
- private readonly virtualTemplates;
22
- private isESMLoaderRequired;
23
- constructor(opts: LinkOptions);
24
- private customData;
25
- attachCustomData(customData: any): void;
26
- installPackage(pkg: Package, fetchResult: FetchResult, api: InstallPackageExtraApi): Promise<{
27
- packageLocation: PortablePath;
28
- buildRequest: import("@yarnpkg/core").BuildRequest | null;
29
- }>;
30
- attachInternalDependencies(locator: Locator, dependencies: Array<[Descriptor, Locator]>): Promise<void>;
31
- attachExternalDependents(locator: Locator, dependentPaths: Array<PortablePath>): Promise<void>;
32
- finalizeInstall(): Promise<{
33
- customData: {
34
- store: Map<LocatorHash, {
35
- manifest: {
36
- scripts: Map<string, string>;
37
- preferUnplugged: boolean | null;
38
- type: string | null;
39
- };
40
- misc: {
41
- extractHint: boolean;
42
- hasBindingGyp: boolean;
43
- };
44
- }>;
45
- };
46
- } | undefined>;
47
- transformPnpSettings(pnpSettings: PnpSettings): Promise<void>;
48
- private isEsmEnabled;
49
- finalizeInstallWithPnp(pnpSettings: PnpSettings): Promise<void>;
50
- private locateNodeModules;
51
- private readonly unpluggedPaths;
52
- private unplugPackageIfNeeded;
53
- private shouldBeUnplugged;
54
- private unplugPackage;
55
- private getPackageInformation;
56
- private getDiskInformation;
57
- }
package/lib/PnpLinker.js DELETED
@@ -1,408 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PnpInstaller = exports.PnpLinker = void 0;
4
- const tslib_1 = require("tslib");
5
- const core_1 = require("@yarnpkg/core");
6
- const core_2 = require("@yarnpkg/core");
7
- const fslib_1 = require("@yarnpkg/fslib");
8
- const pnp_1 = require("@yarnpkg/pnp");
9
- const clipanion_1 = require("clipanion");
10
- const index_1 = require("./index");
11
- const jsInstallUtils = tslib_1.__importStar(require("./jsInstallUtils"));
12
- const pnpUtils = tslib_1.__importStar(require("./pnpUtils"));
13
- const FORCED_UNPLUG_PACKAGES = new Set([
14
- // Contains native binaries
15
- core_1.structUtils.makeIdent(null, `open`).identHash,
16
- core_1.structUtils.makeIdent(null, `opn`).identHash,
17
- ]);
18
- class PnpLinker {
19
- constructor() {
20
- this.mode = `strict`;
21
- this.pnpCache = new Map();
22
- }
23
- getCustomDataKey() {
24
- return JSON.stringify({
25
- name: `PnpLinker`,
26
- version: 2,
27
- });
28
- }
29
- supportsPackage(pkg, opts) {
30
- return this.isEnabled(opts);
31
- }
32
- async findPackageLocation(locator, opts) {
33
- if (!this.isEnabled(opts))
34
- throw new Error(`Assertion failed: Expected the PnP linker to be enabled`);
35
- const pnpPath = (0, index_1.getPnpPath)(opts.project).cjs;
36
- if (!fslib_1.xfs.existsSync(pnpPath))
37
- throw new clipanion_1.UsageError(`The project in ${core_1.formatUtils.pretty(opts.project.configuration, `${opts.project.cwd}/package.json`, core_1.formatUtils.Type.PATH)} doesn't seem to have been installed - running an install there might help`);
38
- const pnpFile = core_1.miscUtils.getFactoryWithDefault(this.pnpCache, pnpPath, () => {
39
- return core_1.miscUtils.dynamicRequire(pnpPath, { cachingStrategy: core_1.miscUtils.CachingStrategy.FsTime });
40
- });
41
- const packageLocator = { name: core_1.structUtils.stringifyIdent(locator), reference: locator.reference };
42
- const packageInformation = pnpFile.getPackageInformation(packageLocator);
43
- if (!packageInformation)
44
- throw new clipanion_1.UsageError(`Couldn't find ${core_1.structUtils.prettyLocator(opts.project.configuration, locator)} in the currently installed PnP map - running an install might help`);
45
- return fslib_1.npath.toPortablePath(packageInformation.packageLocation);
46
- }
47
- async findPackageLocator(location, opts) {
48
- if (!this.isEnabled(opts))
49
- return null;
50
- const pnpPath = (0, index_1.getPnpPath)(opts.project).cjs;
51
- if (!fslib_1.xfs.existsSync(pnpPath))
52
- return null;
53
- const pnpFile = core_1.miscUtils.getFactoryWithDefault(this.pnpCache, pnpPath, () => {
54
- return core_1.miscUtils.dynamicRequire(pnpPath, { cachingStrategy: core_1.miscUtils.CachingStrategy.FsTime });
55
- });
56
- const locator = pnpFile.findPackageLocator(fslib_1.npath.fromPortablePath(location));
57
- if (!locator)
58
- return null;
59
- return core_1.structUtils.makeLocator(core_1.structUtils.parseIdent(locator.name), locator.reference);
60
- }
61
- makeInstaller(opts) {
62
- return new PnpInstaller(opts);
63
- }
64
- isEnabled(opts) {
65
- if (opts.project.configuration.get(`nodeLinker`) !== `pnp`)
66
- return false;
67
- if (opts.project.configuration.get(`pnpMode`) !== this.mode)
68
- return false;
69
- return true;
70
- }
71
- }
72
- exports.PnpLinker = PnpLinker;
73
- class PnpInstaller {
74
- constructor(opts) {
75
- this.opts = opts;
76
- this.mode = `strict`;
77
- this.asyncActions = new core_1.miscUtils.AsyncActions(10);
78
- this.packageRegistry = new Map();
79
- this.virtualTemplates = new Map();
80
- this.isESMLoaderRequired = false;
81
- this.customData = {
82
- store: new Map(),
83
- };
84
- this.unpluggedPaths = new Set();
85
- this.opts = opts;
86
- }
87
- attachCustomData(customData) {
88
- this.customData = customData;
89
- }
90
- async installPackage(pkg, fetchResult, api) {
91
- const key1 = core_1.structUtils.stringifyIdent(pkg);
92
- const key2 = pkg.reference;
93
- const isWorkspace = !!this.opts.project.tryWorkspaceByLocator(pkg);
94
- const isVirtual = core_1.structUtils.isVirtualLocator(pkg);
95
- const hasVirtualInstances =
96
- // Only packages with peer dependencies have virtual instances
97
- pkg.peerDependencies.size > 0 &&
98
- // Only packages with peer dependencies have virtual instances
99
- !isVirtual;
100
- const mayNeedToBeBuilt =
101
- // Virtual instance templates don't need to be built, since they don't truly exist
102
- !hasVirtualInstances &&
103
- // Workspaces aren't built by the linkers; they are managed by the core itself
104
- !isWorkspace;
105
- const mayNeedToBeUnplugged =
106
- // Virtual instance templates don't need to be unplugged, since they don't truly exist
107
- !hasVirtualInstances &&
108
- // We never need to unplug soft links, since we don't control them
109
- pkg.linkType !== core_2.LinkType.SOFT;
110
- let customPackageData;
111
- let dependencyMeta;
112
- if (mayNeedToBeBuilt || mayNeedToBeUnplugged) {
113
- const devirtualizedLocator = isVirtual ? core_1.structUtils.devirtualizeLocator(pkg) : pkg;
114
- customPackageData = this.customData.store.get(devirtualizedLocator.locatorHash);
115
- if (typeof customPackageData === `undefined`) {
116
- customPackageData = await extractCustomPackageData(fetchResult);
117
- if (pkg.linkType === core_2.LinkType.HARD) {
118
- this.customData.store.set(devirtualizedLocator.locatorHash, customPackageData);
119
- }
120
- }
121
- if (customPackageData.manifest.type === `module`)
122
- this.isESMLoaderRequired = true;
123
- dependencyMeta = this.opts.project.getDependencyMeta(devirtualizedLocator, pkg.version);
124
- }
125
- const buildRequest = mayNeedToBeBuilt
126
- ? jsInstallUtils.extractBuildRequest(pkg, customPackageData, dependencyMeta, { configuration: this.opts.project.configuration })
127
- : null;
128
- const packageFs = mayNeedToBeUnplugged
129
- ? await this.unplugPackageIfNeeded(pkg, customPackageData, fetchResult, dependencyMeta, api)
130
- : fetchResult.packageFs;
131
- if (fslib_1.ppath.isAbsolute(fetchResult.prefixPath))
132
- throw new Error(`Assertion failed: Expected the prefix path (${fetchResult.prefixPath}) to be relative to the parent`);
133
- const packageRawLocation = fslib_1.ppath.resolve(packageFs.getRealPath(), fetchResult.prefixPath);
134
- const packageLocation = normalizeDirectoryPath(this.opts.project.cwd, packageRawLocation);
135
- const packageDependencies = new Map();
136
- const packagePeers = new Set();
137
- // Only virtual packages should have effective peer dependencies, but the
138
- // workspaces are a special case because the original packages are kept in
139
- // the dependency tree even after being virtualized; so in their case we
140
- // just ignore their declared peer dependencies.
141
- if (isVirtual) {
142
- for (const descriptor of pkg.peerDependencies.values()) {
143
- packageDependencies.set(core_1.structUtils.stringifyIdent(descriptor), null);
144
- packagePeers.add(core_1.structUtils.stringifyIdent(descriptor));
145
- }
146
- if (!isWorkspace) {
147
- const devirtualized = core_1.structUtils.devirtualizeLocator(pkg);
148
- this.virtualTemplates.set(devirtualized.locatorHash, {
149
- location: normalizeDirectoryPath(this.opts.project.cwd, fslib_1.VirtualFS.resolveVirtual(packageRawLocation)),
150
- locator: devirtualized,
151
- });
152
- }
153
- }
154
- core_1.miscUtils.getMapWithDefault(this.packageRegistry, key1).set(key2, {
155
- packageLocation,
156
- packageDependencies,
157
- packagePeers,
158
- linkType: pkg.linkType,
159
- discardFromLookup: fetchResult.discardFromLookup || false,
160
- });
161
- return {
162
- packageLocation: packageRawLocation,
163
- buildRequest,
164
- };
165
- }
166
- async attachInternalDependencies(locator, dependencies) {
167
- const packageInformation = this.getPackageInformation(locator);
168
- for (const [descriptor, locator] of dependencies) {
169
- const target = !core_1.structUtils.areIdentsEqual(descriptor, locator)
170
- ? [core_1.structUtils.stringifyIdent(locator), locator.reference]
171
- : locator.reference;
172
- packageInformation.packageDependencies.set(core_1.structUtils.stringifyIdent(descriptor), target);
173
- }
174
- }
175
- async attachExternalDependents(locator, dependentPaths) {
176
- for (const dependentPath of dependentPaths) {
177
- const packageInformation = this.getDiskInformation(dependentPath);
178
- packageInformation.packageDependencies.set(core_1.structUtils.stringifyIdent(locator), locator.reference);
179
- }
180
- }
181
- async finalizeInstall() {
182
- if (this.opts.project.configuration.get(`pnpMode`) !== this.mode)
183
- return undefined;
184
- const pnpPath = (0, index_1.getPnpPath)(this.opts.project);
185
- if (!this.isEsmEnabled())
186
- await fslib_1.xfs.removePromise(pnpPath.esmLoader);
187
- if (this.opts.project.configuration.get(`nodeLinker`) !== `pnp`) {
188
- await fslib_1.xfs.removePromise(pnpPath.cjs);
189
- await fslib_1.xfs.removePromise(pnpPath.data);
190
- await fslib_1.xfs.removePromise(pnpPath.esmLoader);
191
- await fslib_1.xfs.removePromise(this.opts.project.configuration.get(`pnpUnpluggedFolder`));
192
- return undefined;
193
- }
194
- for (const { locator, location } of this.virtualTemplates.values()) {
195
- core_1.miscUtils.getMapWithDefault(this.packageRegistry, core_1.structUtils.stringifyIdent(locator)).set(locator.reference, {
196
- packageLocation: location,
197
- packageDependencies: new Map(),
198
- packagePeers: new Set(),
199
- linkType: core_2.LinkType.SOFT,
200
- discardFromLookup: false,
201
- });
202
- }
203
- this.packageRegistry.set(null, new Map([
204
- [null, this.getPackageInformation(this.opts.project.topLevelWorkspace.anchoredLocator)],
205
- ]));
206
- const pnpFallbackMode = this.opts.project.configuration.get(`pnpFallbackMode`);
207
- const dependencyTreeRoots = this.opts.project.workspaces.map(({ anchoredLocator }) => ({ name: core_1.structUtils.stringifyIdent(anchoredLocator), reference: anchoredLocator.reference }));
208
- const enableTopLevelFallback = pnpFallbackMode !== `none`;
209
- const fallbackExclusionList = [];
210
- const fallbackPool = new Map();
211
- const ignorePattern = core_1.miscUtils.buildIgnorePattern([`.yarn/sdks/**`, ...this.opts.project.configuration.get(`pnpIgnorePatterns`)]);
212
- const packageRegistry = this.packageRegistry;
213
- const shebang = this.opts.project.configuration.get(`pnpShebang`);
214
- if (pnpFallbackMode === `dependencies-only`)
215
- for (const pkg of this.opts.project.storedPackages.values())
216
- if (this.opts.project.tryWorkspaceByLocator(pkg))
217
- fallbackExclusionList.push({ name: core_1.structUtils.stringifyIdent(pkg), reference: pkg.reference });
218
- await this.asyncActions.wait();
219
- await this.finalizeInstallWithPnp({
220
- dependencyTreeRoots,
221
- enableTopLevelFallback,
222
- fallbackExclusionList,
223
- fallbackPool,
224
- ignorePattern,
225
- packageRegistry,
226
- shebang,
227
- });
228
- return {
229
- customData: this.customData,
230
- };
231
- }
232
- async transformPnpSettings(pnpSettings) {
233
- // Nothing to transform
234
- }
235
- isEsmEnabled() {
236
- if (this.opts.project.configuration.sources.has(`pnpEnableEsmLoader`))
237
- return this.opts.project.configuration.get(`pnpEnableEsmLoader`);
238
- if (this.isESMLoaderRequired)
239
- return true;
240
- for (const workspace of this.opts.project.workspaces) {
241
- if (workspace.manifest.type === `module`) {
242
- return true;
243
- }
244
- }
245
- return false;
246
- }
247
- async finalizeInstallWithPnp(pnpSettings) {
248
- const pnpPath = (0, index_1.getPnpPath)(this.opts.project);
249
- const nodeModules = await this.locateNodeModules(pnpSettings.ignorePattern);
250
- if (nodeModules.length > 0) {
251
- 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.`);
252
- for (const nodeModulesPath of nodeModules) {
253
- await fslib_1.xfs.removePromise(nodeModulesPath);
254
- }
255
- }
256
- await this.transformPnpSettings(pnpSettings);
257
- if (this.opts.project.configuration.get(`pnpEnableInlining`)) {
258
- const loaderFile = (0, pnp_1.generateInlinedScript)(pnpSettings);
259
- await fslib_1.xfs.changeFilePromise(pnpPath.cjs, loaderFile, {
260
- automaticNewlines: true,
261
- mode: 0o755,
262
- });
263
- await fslib_1.xfs.removePromise(pnpPath.data);
264
- }
265
- else {
266
- const { dataFile, loaderFile } = (0, pnp_1.generateSplitScript)(pnpSettings);
267
- await fslib_1.xfs.changeFilePromise(pnpPath.cjs, loaderFile, {
268
- automaticNewlines: true,
269
- mode: 0o755,
270
- });
271
- await fslib_1.xfs.changeFilePromise(pnpPath.data, dataFile, {
272
- automaticNewlines: true,
273
- mode: 0o644,
274
- });
275
- }
276
- if (this.isEsmEnabled()) {
277
- this.opts.report.reportWarning(core_2.MessageName.UNNAMED, `ESM support for PnP uses the experimental loader API and is therefore experimental`);
278
- await fslib_1.xfs.changeFilePromise(pnpPath.esmLoader, (0, pnp_1.getESMLoaderTemplate)(), {
279
- automaticNewlines: true,
280
- mode: 0o644,
281
- });
282
- }
283
- const pnpUnpluggedFolder = this.opts.project.configuration.get(`pnpUnpluggedFolder`);
284
- if (this.unpluggedPaths.size === 0) {
285
- await fslib_1.xfs.removePromise(pnpUnpluggedFolder);
286
- }
287
- else {
288
- for (const entry of await fslib_1.xfs.readdirPromise(pnpUnpluggedFolder)) {
289
- const unpluggedPath = fslib_1.ppath.resolve(pnpUnpluggedFolder, entry);
290
- if (!this.unpluggedPaths.has(unpluggedPath)) {
291
- await fslib_1.xfs.removePromise(unpluggedPath);
292
- }
293
- }
294
- }
295
- }
296
- async locateNodeModules(ignorePattern) {
297
- const nodeModules = [];
298
- const ignoreRegExp = ignorePattern ? new RegExp(ignorePattern) : null;
299
- for (const workspace of this.opts.project.workspaces) {
300
- const nodeModulesPath = fslib_1.ppath.join(workspace.cwd, `node_modules`);
301
- if (ignoreRegExp && ignoreRegExp.test(fslib_1.ppath.relative(this.opts.project.cwd, workspace.cwd)) || !fslib_1.xfs.existsSync(nodeModulesPath))
302
- continue;
303
- const directoryListing = await fslib_1.xfs.readdirPromise(nodeModulesPath, {
304
- withFileTypes: true,
305
- });
306
- const nonCacheEntries = directoryListing.filter(entry => {
307
- return !entry.isDirectory() || entry.name === `.bin` || !entry.name.startsWith(`.`);
308
- });
309
- if (nonCacheEntries.length === directoryListing.length) {
310
- nodeModules.push(nodeModulesPath);
311
- }
312
- else {
313
- for (const entry of nonCacheEntries) {
314
- nodeModules.push(fslib_1.ppath.join(nodeModulesPath, entry.name));
315
- }
316
- }
317
- }
318
- return nodeModules;
319
- }
320
- async unplugPackageIfNeeded(pkg, customPackageData, fetchResult, dependencyMeta, api) {
321
- if (this.shouldBeUnplugged(pkg, customPackageData, dependencyMeta)) {
322
- return this.unplugPackage(pkg, fetchResult, api);
323
- }
324
- else {
325
- return fetchResult.packageFs;
326
- }
327
- }
328
- shouldBeUnplugged(pkg, customPackageData, dependencyMeta) {
329
- if (typeof dependencyMeta.unplugged !== `undefined`)
330
- return dependencyMeta.unplugged;
331
- if (FORCED_UNPLUG_PACKAGES.has(pkg.identHash))
332
- return true;
333
- if (pkg.conditions != null)
334
- return true;
335
- if (customPackageData.manifest.preferUnplugged !== null)
336
- return customPackageData.manifest.preferUnplugged;
337
- const buildRequest = jsInstallUtils.extractBuildRequest(pkg, customPackageData, dependencyMeta, { configuration: this.opts.project.configuration });
338
- if (buildRequest?.skipped === false || customPackageData.misc.extractHint)
339
- return true;
340
- return false;
341
- }
342
- async unplugPackage(locator, fetchResult, api) {
343
- const unplugPath = pnpUtils.getUnpluggedPath(locator, { configuration: this.opts.project.configuration });
344
- if (this.opts.project.disabledLocators.has(locator.locatorHash))
345
- return new fslib_1.AliasFS(unplugPath, { baseFs: fetchResult.packageFs, pathUtils: fslib_1.ppath });
346
- this.unpluggedPaths.add(unplugPath);
347
- api.holdFetchResult(this.asyncActions.set(locator.locatorHash, async () => {
348
- const readyFile = fslib_1.ppath.join(unplugPath, fetchResult.prefixPath, `.ready`);
349
- if (await fslib_1.xfs.existsPromise(readyFile))
350
- return;
351
- // Delete any build state for the locator so it can run anew, this allows users
352
- // to remove `.yarn/unplugged` and have the builds run again
353
- this.opts.project.storedBuildState.delete(locator.locatorHash);
354
- await fslib_1.xfs.mkdirPromise(unplugPath, { recursive: true });
355
- await fslib_1.xfs.copyPromise(unplugPath, fslib_1.PortablePath.dot, { baseFs: fetchResult.packageFs, overwrite: false });
356
- await fslib_1.xfs.writeFilePromise(readyFile, ``);
357
- }));
358
- return new fslib_1.CwdFS(unplugPath);
359
- }
360
- getPackageInformation(locator) {
361
- const key1 = core_1.structUtils.stringifyIdent(locator);
362
- const key2 = locator.reference;
363
- const packageInformationStore = this.packageRegistry.get(key1);
364
- if (!packageInformationStore)
365
- throw new Error(`Assertion failed: The package information store should have been available (for ${core_1.structUtils.prettyIdent(this.opts.project.configuration, locator)})`);
366
- const packageInformation = packageInformationStore.get(key2);
367
- if (!packageInformation)
368
- throw new Error(`Assertion failed: The package information should have been available (for ${core_1.structUtils.prettyLocator(this.opts.project.configuration, locator)})`);
369
- return packageInformation;
370
- }
371
- getDiskInformation(path) {
372
- const packageStore = core_1.miscUtils.getMapWithDefault(this.packageRegistry, `@@disk`);
373
- const normalizedPath = normalizeDirectoryPath(this.opts.project.cwd, path);
374
- return core_1.miscUtils.getFactoryWithDefault(packageStore, normalizedPath, () => ({
375
- packageLocation: normalizedPath,
376
- packageDependencies: new Map(),
377
- packagePeers: new Set(),
378
- linkType: core_2.LinkType.SOFT,
379
- discardFromLookup: false,
380
- }));
381
- }
382
- }
383
- exports.PnpInstaller = PnpInstaller;
384
- function normalizeDirectoryPath(root, folder) {
385
- let relativeFolder = fslib_1.ppath.relative(root, folder);
386
- if (!relativeFolder.match(/^\.{0,2}\//))
387
- // Don't use ppath.join here, it ignores the `.`
388
- relativeFolder = `./${relativeFolder}`;
389
- return relativeFolder.replace(/\/?$/, `/`);
390
- }
391
- async function extractCustomPackageData(fetchResult) {
392
- const manifest = await core_2.Manifest.tryFind(fetchResult.prefixPath, { baseFs: fetchResult.packageFs }) ?? new core_2.Manifest();
393
- const preservedScripts = new Set([`preinstall`, `install`, `postinstall`]);
394
- for (const scriptName of manifest.scripts.keys())
395
- if (!preservedScripts.has(scriptName))
396
- manifest.scripts.delete(scriptName);
397
- return {
398
- manifest: {
399
- scripts: manifest.scripts,
400
- preferUnplugged: manifest.preferUnplugged,
401
- type: manifest.type,
402
- },
403
- misc: {
404
- extractHint: jsInstallUtils.getExtractHint(fetchResult),
405
- hasBindingGyp: jsInstallUtils.hasBindingGyp(fetchResult),
406
- },
407
- };
408
- }
@@ -1,11 +0,0 @@
1
- import { BaseCommand } from '@yarnpkg/cli';
2
- import { Usage } from 'clipanion';
3
- export default class UnplugCommand extends BaseCommand {
4
- static paths: string[][];
5
- static usage: Usage;
6
- all: boolean;
7
- recursive: boolean;
8
- json: boolean;
9
- patterns: string[];
10
- execute(): Promise<0 | 1>;
11
- }
@@ -1,184 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- const cli_1 = require("@yarnpkg/cli");
5
- const core_1 = require("@yarnpkg/core");
6
- const core_2 = require("@yarnpkg/core");
7
- const clipanion_1 = require("clipanion");
8
- const micromatch_1 = tslib_1.__importDefault(require("micromatch"));
9
- const pnpUtils = tslib_1.__importStar(require("../pnpUtils"));
10
- // eslint-disable-next-line arca/no-default-export
11
- class UnplugCommand extends cli_1.BaseCommand {
12
- constructor() {
13
- super(...arguments);
14
- this.all = clipanion_1.Option.Boolean(`-A,--all`, false, {
15
- description: `Unplug direct dependencies from the entire project`,
16
- });
17
- this.recursive = clipanion_1.Option.Boolean(`-R,--recursive`, false, {
18
- description: `Unplug both direct and transitive dependencies`,
19
- });
20
- this.json = clipanion_1.Option.Boolean(`--json`, false, {
21
- description: `Format the output as an NDJSON stream`,
22
- });
23
- this.patterns = clipanion_1.Option.Rest();
24
- }
25
- async execute() {
26
- const configuration = await core_1.Configuration.find(this.context.cwd, this.context.plugins);
27
- const { project, workspace } = await core_1.Project.find(configuration, this.context.cwd);
28
- const cache = await core_1.Cache.find(configuration);
29
- if (!workspace)
30
- throw new cli_1.WorkspaceRequiredError(project.cwd, this.context.cwd);
31
- if (configuration.get(`nodeLinker`) !== `pnp`)
32
- throw new clipanion_1.UsageError(`This command can only be used if the \`nodeLinker\` option is set to \`pnp\``);
33
- await project.restoreInstallState();
34
- const unreferencedPatterns = new Set(this.patterns);
35
- const matchers = this.patterns.map(pattern => {
36
- const patternDescriptor = core_2.structUtils.parseDescriptor(pattern);
37
- const pseudoDescriptor = patternDescriptor.range !== `unknown`
38
- ? patternDescriptor
39
- : core_2.structUtils.makeDescriptor(patternDescriptor, `*`);
40
- if (!core_2.semverUtils.validRange(pseudoDescriptor.range))
41
- throw new clipanion_1.UsageError(`The range of the descriptor patterns must be a valid semver range (${core_2.structUtils.prettyDescriptor(configuration, pseudoDescriptor)})`);
42
- return (pkg) => {
43
- const stringifiedIdent = core_2.structUtils.stringifyIdent(pkg);
44
- if (!micromatch_1.default.isMatch(stringifiedIdent, core_2.structUtils.stringifyIdent(pseudoDescriptor)))
45
- return false;
46
- if (pkg.version && !core_2.semverUtils.satisfiesWithPrereleases(pkg.version, pseudoDescriptor.range))
47
- return false;
48
- unreferencedPatterns.delete(pattern);
49
- return true;
50
- };
51
- });
52
- const getAllMatchingPackages = () => {
53
- const selection = [];
54
- for (const pkg of project.storedPackages.values())
55
- // Note: We can safely skip virtual packages here, as the
56
- // devirtualized copy will always exist inside storedPackages.
57
- if (!project.tryWorkspaceByLocator(pkg) && !core_2.structUtils.isVirtualLocator(pkg) && matchers.some(matcher => matcher(pkg)))
58
- selection.push(pkg);
59
- return selection;
60
- };
61
- const getSelectedPackages = (roots) => {
62
- const seen = new Set();
63
- const selection = [];
64
- const traverse = (pkg, depth) => {
65
- if (seen.has(pkg.locatorHash))
66
- return;
67
- const isWorkspace = !!project.tryWorkspaceByLocator(pkg);
68
- if (depth > 0 && !this.recursive && isWorkspace)
69
- return;
70
- seen.add(pkg.locatorHash);
71
- // Note: We shouldn't skip virtual packages, as
72
- // we don't iterate over the devirtualized copies.
73
- if (!project.tryWorkspaceByLocator(pkg) && matchers.some(matcher => matcher(pkg)))
74
- selection.push(pkg);
75
- // Don't recurse unless requested
76
- if (depth > 0 && !this.recursive)
77
- return;
78
- for (const dependency of pkg.dependencies.values()) {
79
- const resolution = project.storedResolutions.get(dependency.descriptorHash);
80
- if (!resolution)
81
- throw new Error(`Assertion failed: The resolution should have been registered`);
82
- const nextPkg = project.storedPackages.get(resolution);
83
- if (!nextPkg)
84
- throw new Error(`Assertion failed: The package should have been registered`);
85
- traverse(nextPkg, depth + 1);
86
- }
87
- };
88
- for (const workspace of roots)
89
- traverse(workspace.anchoredPackage, 0);
90
- return selection;
91
- };
92
- let selection;
93
- let projectOrWorkspaces;
94
- // We can shortcut the execution if we want all the dependencies and
95
- // transitive dependencies of all the branches: it means we want everything!
96
- if (this.all && this.recursive) {
97
- selection = getAllMatchingPackages();
98
- projectOrWorkspaces = `the project`;
99
- }
100
- else if (this.all) {
101
- selection = getSelectedPackages(project.workspaces);
102
- projectOrWorkspaces = `any workspace`;
103
- }
104
- else {
105
- selection = getSelectedPackages([workspace]);
106
- projectOrWorkspaces = `this workspace`;
107
- }
108
- if (unreferencedPatterns.size > 1)
109
- throw new clipanion_1.UsageError(`Patterns ${core_1.formatUtils.prettyList(configuration, unreferencedPatterns, core_1.formatUtils.Type.CODE)} don't match any packages referenced by ${projectOrWorkspaces}`);
110
- if (unreferencedPatterns.size > 0)
111
- throw new clipanion_1.UsageError(`Pattern ${core_1.formatUtils.prettyList(configuration, unreferencedPatterns, core_1.formatUtils.Type.CODE)} doesn't match any packages referenced by ${projectOrWorkspaces}`);
112
- selection = core_1.miscUtils.sortMap(selection, pkg => {
113
- return core_2.structUtils.stringifyLocator(pkg);
114
- });
115
- const unplugReport = await core_1.StreamReport.start({
116
- configuration,
117
- stdout: this.context.stdout,
118
- json: this.json,
119
- }, async (report) => {
120
- for (const pkg of selection) {
121
- const version = pkg.version ?? `unknown`;
122
- const dependencyMeta = project.topLevelWorkspace.manifest.ensureDependencyMeta(core_2.structUtils.makeDescriptor(pkg, version));
123
- dependencyMeta.unplugged = true;
124
- report.reportInfo(core_1.MessageName.UNNAMED, `Will unpack ${core_2.structUtils.prettyLocator(configuration, pkg)} to ${core_1.formatUtils.pretty(configuration, pnpUtils.getUnpluggedPath(pkg, { configuration }), core_1.formatUtils.Type.PATH)}`);
125
- report.reportJson({
126
- locator: core_2.structUtils.stringifyLocator(pkg),
127
- version,
128
- });
129
- }
130
- await project.topLevelWorkspace.persistManifest();
131
- if (!this.json) {
132
- report.reportSeparator();
133
- }
134
- });
135
- if (unplugReport.hasErrors())
136
- return unplugReport.exitCode();
137
- return await project.installWithNewReport({
138
- json: this.json,
139
- stdout: this.context.stdout,
140
- }, {
141
- cache,
142
- });
143
- }
144
- }
145
- UnplugCommand.paths = [
146
- [`unplug`],
147
- ];
148
- UnplugCommand.usage = clipanion_1.Command.Usage({
149
- description: `force the unpacking of a list of packages`,
150
- details: `
151
- This command will add the selectors matching the specified patterns to the list of packages that must be unplugged when installed.
152
-
153
- A package being unplugged means that instead of being referenced directly through its archive, it will be unpacked at install time in the directory configured via \`pnpUnpluggedFolder\`. Note that unpacking packages this way is generally not recommended because it'll make it harder to store your packages within the repository. However, it's a good approach to quickly and safely debug some packages, and can even sometimes be required depending on the context (for example when the package contains shellscripts).
154
-
155
- Running the command will set a persistent flag inside your top-level \`package.json\`, in the \`dependenciesMeta\` field. As such, to undo its effects, you'll need to revert the changes made to the manifest and run \`yarn install\` to apply the modification.
156
-
157
- By default, only direct dependencies from the current workspace are affected. If \`-A,--all\` is set, direct dependencies from the entire project are affected. Using the \`-R,--recursive\` flag will affect transitive dependencies as well as direct ones.
158
-
159
- This command accepts glob patterns inside the scope and name components (not the range). Make sure to escape the patterns to prevent your own shell from trying to expand them.
160
- `,
161
- examples: [[
162
- `Unplug the lodash dependency from the active workspace`,
163
- `yarn unplug lodash`,
164
- ], [
165
- `Unplug all instances of lodash referenced by any workspace`,
166
- `yarn unplug lodash -A`,
167
- ], [
168
- `Unplug all instances of lodash referenced by the active workspace and its dependencies`,
169
- `yarn unplug lodash -R`,
170
- ], [
171
- `Unplug all instances of lodash, anywhere`,
172
- `yarn unplug lodash -AR`,
173
- ], [
174
- `Unplug one specific version of lodash`,
175
- `yarn unplug lodash@1.2.3`,
176
- ], [
177
- `Unplug all packages with the \`@babel\` scope`,
178
- `yarn unplug '@babel/*'`,
179
- ], [
180
- `Unplug all packages (only for testing, not recommended)`,
181
- `yarn unplug -R '*'`,
182
- ]],
183
- });
184
- exports.default = UnplugCommand;
package/lib/index.d.ts DELETED
@@ -1,31 +0,0 @@
1
- import { Hooks as CoreHooks, Plugin, Project } from '@yarnpkg/core';
2
- import { PortablePath } from '@yarnpkg/fslib';
3
- import { Hooks as StageHooks } from '@yarnpkg/plugin-stage';
4
- import UnplugCommand from './commands/unplug';
5
- import * as jsInstallUtils from './jsInstallUtils';
6
- import * as pnpUtils from './pnpUtils';
7
- export { UnplugCommand };
8
- export { jsInstallUtils };
9
- export { pnpUtils };
10
- export declare const getPnpPath: (project: Project) => {
11
- cjs: PortablePath;
12
- data: PortablePath;
13
- esmLoader: PortablePath;
14
- };
15
- export declare const quotePathIfNeeded: (path: string) => string;
16
- declare module '@yarnpkg/core' {
17
- interface ConfigurationValueMap {
18
- nodeLinker: string;
19
- winLinkType: string;
20
- pnpMode: string;
21
- pnpShebang: string;
22
- pnpIgnorePatterns: Array<string>;
23
- pnpEnableEsmLoader: boolean;
24
- pnpEnableInlining: boolean;
25
- pnpFallbackMode: string;
26
- pnpUnpluggedFolder: PortablePath;
27
- }
28
- }
29
- declare const plugin: Plugin<CoreHooks & StageHooks>;
30
- export { PnpInstaller, PnpLinker } from './PnpLinker';
31
- export default plugin;
package/lib/index.js DELETED
@@ -1,126 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PnpLinker = exports.PnpInstaller = exports.quotePathIfNeeded = exports.getPnpPath = exports.pnpUtils = exports.jsInstallUtils = exports.UnplugCommand = void 0;
4
- const tslib_1 = require("tslib");
5
- const core_1 = require("@yarnpkg/core");
6
- const fslib_1 = require("@yarnpkg/fslib");
7
- const url_1 = require("url");
8
- const PnpLinker_1 = require("./PnpLinker");
9
- const unplug_1 = tslib_1.__importDefault(require("./commands/unplug"));
10
- exports.UnplugCommand = unplug_1.default;
11
- const jsInstallUtils = tslib_1.__importStar(require("./jsInstallUtils"));
12
- exports.jsInstallUtils = jsInstallUtils;
13
- const pnpUtils = tslib_1.__importStar(require("./pnpUtils"));
14
- exports.pnpUtils = pnpUtils;
15
- const getPnpPath = (project) => {
16
- return {
17
- cjs: fslib_1.ppath.join(project.cwd, fslib_1.Filename.pnpCjs),
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
- };
21
- };
22
- exports.getPnpPath = getPnpPath;
23
- const quotePathIfNeeded = (path) => {
24
- return /\s/.test(path) ? JSON.stringify(path) : path;
25
- };
26
- exports.quotePathIfNeeded = quotePathIfNeeded;
27
- async function setupScriptEnvironment(project, env, makePathWrapper) {
28
- // We still support .pnp.js files to improve multi-project compatibility.
29
- // TODO: Drop the question mark in the RegExp after .pnp.js files stop being used.
30
- // TODO: Support `-r` as an alias for `--require` (in all packages)
31
- const pnpRegularExpression = /\s*--require\s+\S*\.pnp\.c?js\s*/g;
32
- const esmLoaderExpression = /\s*--experimental-loader\s+\S*\.pnp\.loader\.mjs\s*/;
33
- const nodeOptions = (env.NODE_OPTIONS ?? ``)
34
- .replace(pnpRegularExpression, ` `)
35
- .replace(esmLoaderExpression, ` `)
36
- .trim();
37
- // We remove the PnP hook from NODE_OPTIONS because the process can have
38
- // NODE_OPTIONS set while changing linkers, which affects build scripts.
39
- if (project.configuration.get(`nodeLinker`) !== `pnp`) {
40
- env.NODE_OPTIONS = nodeOptions;
41
- return;
42
- }
43
- const pnpPath = (0, exports.getPnpPath)(project);
44
- let pnpRequire = `--require ${(0, exports.quotePathIfNeeded)(fslib_1.npath.fromPortablePath(pnpPath.cjs))}`;
45
- if (fslib_1.xfs.existsSync(pnpPath.esmLoader))
46
- pnpRequire = `${pnpRequire} --experimental-loader ${(0, url_1.pathToFileURL)(fslib_1.npath.fromPortablePath(pnpPath.esmLoader)).href}`;
47
- if (fslib_1.xfs.existsSync(pnpPath.cjs)) {
48
- env.NODE_OPTIONS = nodeOptions ? `${pnpRequire} ${nodeOptions}` : pnpRequire;
49
- }
50
- }
51
- async function populateYarnPaths(project, definePath) {
52
- const pnpPath = (0, exports.getPnpPath)(project);
53
- definePath(pnpPath.cjs);
54
- definePath(pnpPath.data);
55
- definePath(pnpPath.esmLoader);
56
- definePath(project.configuration.get(`pnpUnpluggedFolder`));
57
- }
58
- const plugin = {
59
- hooks: {
60
- populateYarnPaths,
61
- setupScriptEnvironment,
62
- },
63
- configuration: {
64
- nodeLinker: {
65
- description: `The linker used for installing Node packages, one of: "pnp", "pnpm", or "node-modules"`,
66
- type: core_1.SettingsType.STRING,
67
- default: `pnp`,
68
- },
69
- winLinkType: {
70
- description: `Whether Yarn should use Windows Junctions or symlinks when creating links on Windows.`,
71
- type: core_1.SettingsType.STRING,
72
- values: [
73
- core_1.WindowsLinkType.JUNCTIONS,
74
- core_1.WindowsLinkType.SYMLINKS,
75
- ],
76
- default: core_1.WindowsLinkType.JUNCTIONS,
77
- },
78
- pnpMode: {
79
- description: `If 'strict', generates standard PnP maps. If 'loose', merges them with the n_m resolution.`,
80
- type: core_1.SettingsType.STRING,
81
- default: `strict`,
82
- },
83
- pnpShebang: {
84
- description: `String to prepend to the generated PnP script`,
85
- type: core_1.SettingsType.STRING,
86
- default: `#!/usr/bin/env node`,
87
- },
88
- pnpIgnorePatterns: {
89
- description: `Array of glob patterns; files matching them will use the classic resolution`,
90
- type: core_1.SettingsType.STRING,
91
- default: [],
92
- isArray: true,
93
- },
94
- pnpEnableEsmLoader: {
95
- description: `If true, Yarn will generate an ESM loader (\`.pnp.loader.mjs\`). If this is not explicitly set Yarn tries to automatically detect whether ESM support is required.`,
96
- type: core_1.SettingsType.BOOLEAN,
97
- default: false,
98
- },
99
- pnpEnableInlining: {
100
- description: `If true, the PnP data will be inlined along with the generated loader`,
101
- type: core_1.SettingsType.BOOLEAN,
102
- default: true,
103
- },
104
- pnpFallbackMode: {
105
- description: `If true, the generated PnP loader will follow the top-level fallback rule`,
106
- type: core_1.SettingsType.STRING,
107
- default: `dependencies-only`,
108
- },
109
- pnpUnpluggedFolder: {
110
- description: `Folder where the unplugged packages must be stored`,
111
- type: core_1.SettingsType.ABSOLUTE_PATH,
112
- default: `./.yarn/unplugged`,
113
- },
114
- },
115
- linkers: [
116
- PnpLinker_1.PnpLinker,
117
- ],
118
- commands: [
119
- unplug_1.default,
120
- ],
121
- };
122
- var PnpLinker_2 = require("./PnpLinker");
123
- Object.defineProperty(exports, "PnpInstaller", { enumerable: true, get: function () { return PnpLinker_2.PnpInstaller; } });
124
- Object.defineProperty(exports, "PnpLinker", { enumerable: true, get: function () { return PnpLinker_2.PnpLinker; } });
125
- // eslint-disable-next-line arca/no-default-export
126
- exports.default = plugin;
@@ -1,13 +0,0 @@
1
- import { Configuration, DependencyMeta, FetchResult, Manifest, Package, BuildRequest } from '@yarnpkg/core';
2
- export declare function checkManifestCompatibility(pkg: Package): boolean;
3
- export type ExtractBuildScriptDataRequirements = {
4
- manifest: Pick<Manifest, 'scripts'>;
5
- misc: {
6
- hasBindingGyp: boolean;
7
- };
8
- };
9
- export declare function extractBuildRequest(pkg: Package, requirements: ExtractBuildScriptDataRequirements, dependencyMeta: DependencyMeta, { configuration }: {
10
- configuration: Configuration;
11
- }): BuildRequest | null;
12
- export declare function getExtractHint(fetchResult: FetchResult): boolean;
13
- export declare function hasBindingGyp(fetchResult: FetchResult): boolean;
@@ -1,51 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.hasBindingGyp = exports.getExtractHint = exports.extractBuildRequest = exports.checkManifestCompatibility = void 0;
4
- const core_1 = require("@yarnpkg/core");
5
- const fslib_1 = require("@yarnpkg/fslib");
6
- function checkManifestCompatibility(pkg) {
7
- return core_1.structUtils.isPackageCompatible(pkg, core_1.nodeUtils.getArchitectureSet());
8
- }
9
- exports.checkManifestCompatibility = checkManifestCompatibility;
10
- function extractBuildRequest(pkg, requirements, dependencyMeta, { configuration }) {
11
- const directives = [];
12
- for (const scriptName of [`preinstall`, `install`, `postinstall`])
13
- if (requirements.manifest.scripts.has(scriptName))
14
- directives.push({ type: core_1.BuildDirectiveType.SCRIPT, script: scriptName });
15
- // Detect cases where a package has a binding.gyp but no install script
16
- if (!requirements.manifest.scripts.has(`install`) && requirements.misc.hasBindingGyp)
17
- directives.push({ type: core_1.BuildDirectiveType.SHELLCODE, script: `node-gyp rebuild` });
18
- if (directives.length === 0)
19
- return null;
20
- if (pkg.linkType !== core_1.LinkType.HARD)
21
- return { skipped: true, explain: report => report.reportWarningOnce(core_1.MessageName.SOFT_LINK_BUILD, `${core_1.structUtils.prettyLocator(configuration, pkg)} lists build scripts, but is referenced through a soft link. Soft links don't support build scripts, so they'll be ignored.`) };
22
- if (dependencyMeta && dependencyMeta.built === false)
23
- return { skipped: true, explain: report => report.reportInfoOnce(core_1.MessageName.BUILD_DISABLED, `${core_1.structUtils.prettyLocator(configuration, pkg)} lists build scripts, but its build has been explicitly disabled through configuration.`) };
24
- if (!configuration.get(`enableScripts`) && !dependencyMeta.built)
25
- return { skipped: true, explain: report => report.reportWarningOnce(core_1.MessageName.DISABLED_BUILD_SCRIPTS, `${core_1.structUtils.prettyLocator(configuration, pkg)} lists build scripts, but all build scripts have been disabled.`) };
26
- if (!checkManifestCompatibility(pkg))
27
- return { skipped: true, explain: report => report.reportWarningOnce(core_1.MessageName.INCOMPATIBLE_ARCHITECTURE, `${core_1.structUtils.prettyLocator(configuration, pkg)} The ${core_1.nodeUtils.getArchitectureName()} architecture is incompatible with this package, build skipped.`) };
28
- return { skipped: false, directives };
29
- }
30
- exports.extractBuildRequest = extractBuildRequest;
31
- const FORCED_EXTRACT_FILETYPES = new Set([
32
- // Windows can't execute exe files inside zip archives
33
- `.exe`,
34
- // May be used for some binaries on Linux; https://askubuntu.com/a/174356
35
- `.bin`,
36
- // The c/c++ compiler can't read files from zip archives
37
- `.h`, `.hh`, `.hpp`, `.c`, `.cc`, `.cpp`,
38
- // The java runtime can't read files from zip archives
39
- `.java`, `.jar`,
40
- // Node opens these through dlopen
41
- `.node`,
42
- ]);
43
- function getExtractHint(fetchResult) {
44
- return fetchResult.packageFs.getExtractHint({ relevantExtensions: FORCED_EXTRACT_FILETYPES });
45
- }
46
- exports.getExtractHint = getExtractHint;
47
- function hasBindingGyp(fetchResult) {
48
- const bindingFilePath = fslib_1.ppath.join(fetchResult.prefixPath, `binding.gyp`);
49
- return fetchResult.packageFs.existsSync(bindingFilePath);
50
- }
51
- exports.hasBindingGyp = hasBindingGyp;
package/lib/pnpUtils.d.ts DELETED
@@ -1,4 +0,0 @@
1
- import { Locator, Configuration } from '@yarnpkg/core';
2
- export declare function getUnpluggedPath(locator: Locator, { configuration }: {
3
- configuration: Configuration;
4
- }): import("@yarnpkg/fslib").PortablePath;
package/lib/pnpUtils.js DELETED
@@ -1,9 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getUnpluggedPath = void 0;
4
- const core_1 = require("@yarnpkg/core");
5
- const fslib_1 = require("@yarnpkg/fslib");
6
- function getUnpluggedPath(locator, { configuration }) {
7
- return fslib_1.ppath.resolve(configuration.get(`pnpUnpluggedFolder`), core_1.structUtils.slugifyLocator(locator));
8
- }
9
- exports.getUnpluggedPath = getUnpluggedPath;