Skip to content

Commit b57ada5

Browse files
authored
chore(yarn): use ignore: protocol (#2732)
1 parent 1a3eca9 commit b57ada5

7 files changed

Lines changed: 164 additions & 33 deletions

File tree

Lines changed: 153 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,153 @@
1+
/* eslint-disable */
2+
//prettier-ignore
3+
module.exports = {
4+
name: "@rnx-kit/yarn-plugin-ignore",
5+
factory: function (require) {
6+
"use strict";
7+
var plugin = (() => {
8+
var __create = Object.create;
9+
var __defProp = Object.defineProperty;
10+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
11+
var __getOwnPropNames = Object.getOwnPropertyNames;
12+
var __getProtoOf = Object.getPrototypeOf;
13+
var __hasOwnProp = Object.prototype.hasOwnProperty;
14+
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
15+
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
16+
}) : x)(function(x) {
17+
if (typeof require !== "undefined") return require.apply(this, arguments);
18+
throw Error('Dynamic require of "' + x + '" is not supported');
19+
});
20+
var __export = (target, all) => {
21+
for (var name in all)
22+
__defProp(target, name, { get: all[name], enumerable: true });
23+
};
24+
var __copyProps = (to, from, except, desc) => {
25+
if (from && typeof from === "object" || typeof from === "function") {
26+
for (let key of __getOwnPropNames(from))
27+
if (!__hasOwnProp.call(to, key) && key !== except)
28+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
29+
}
30+
return to;
31+
};
32+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
33+
// If the importer is in node compatibility mode or this is not an ESM
34+
// file that has been converted to a CommonJS file using a Babel-
35+
// compatible transform (i.e. "__esModule" has not been set), then set
36+
// "default" to the CommonJS "module.exports" for node compatibility.
37+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
38+
mod
39+
));
40+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
41+
42+
// src/index.ts
43+
var index_exports = {};
44+
__export(index_exports, {
45+
IgnoreFetcher: () => IgnoreFetcher,
46+
IgnoreResolver: () => IgnoreResolver,
47+
default: () => index_default
48+
});
49+
50+
// src/IgnoreFetcher.ts
51+
var import_fslib = __require("@yarnpkg/fslib");
52+
var fs = __toESM(__require("fs"), 1);
53+
54+
// src/constants.ts
55+
var IGNORE_PROTOCOL = "ignore:";
56+
var STUB_MODULE = `module.exports = {};
57+
`;
58+
var STUB_PACKAGE = `{
59+
"name": "@rnx-kit/yarn-plugin-ignore/stub",
60+
"version": "0.0.0",
61+
"description": "Stub package for '@rnx-kit/yarn-plugin-ignore'",
62+
"main": "index.js"
63+
}
64+
`;
65+
66+
// src/IgnoreFetcher.ts
67+
var IgnoreFetcher = class {
68+
supports(locator) {
69+
return locator.reference.startsWith(IGNORE_PROTOCOL);
70+
}
71+
getLocalPath() {
72+
return null;
73+
}
74+
async fetch(_locator, opts) {
75+
const base = opts.project.cwd;
76+
const sourceFs = new import_fslib.CwdFS(base);
77+
const localPath = import_fslib.ppath.resolve(
78+
base,
79+
"node_modules",
80+
".generated",
81+
"@rnx-kit",
82+
"yarn-plugin-ignore-stub"
83+
);
84+
const nativePath = import_fslib.npath.fromPortablePath(localPath);
85+
if (!fs.existsSync(nativePath)) {
86+
fs.mkdirSync(nativePath, { recursive: true, mode: 493 });
87+
fs.writeFileSync(import_fslib.npath.join(nativePath, "package.json"), STUB_PACKAGE);
88+
fs.writeFileSync(import_fslib.npath.join(nativePath, "index.js"), STUB_MODULE);
89+
}
90+
return {
91+
packageFs: new import_fslib.CwdFS(localPath, { baseFs: sourceFs }),
92+
prefixPath: import_fslib.PortablePath.dot,
93+
discardFromLookup: true,
94+
localPath
95+
};
96+
}
97+
};
98+
99+
// src/IgnoreResolver.ts
100+
var import_core = __require("@yarnpkg/core");
101+
var import_node_assert = __require("assert");
102+
var IgnoreResolver = class {
103+
supportsDescriptor(descriptor) {
104+
return descriptor.range.startsWith(IGNORE_PROTOCOL);
105+
}
106+
supportsLocator(locator) {
107+
return locator.reference.startsWith(IGNORE_PROTOCOL);
108+
}
109+
shouldPersistResolution() {
110+
return false;
111+
}
112+
bindDescriptor(descriptor, _fromLocator) {
113+
return descriptor;
114+
}
115+
getResolutionDependencies() {
116+
return {};
117+
}
118+
async getCandidates(descriptor, _dependencies, _opts) {
119+
return [import_core.structUtils.makeLocator(descriptor, IGNORE_PROTOCOL)];
120+
}
121+
async getSatisfying(_descriptor, _dependencies, locators, _opts) {
122+
(0, import_node_assert.equal)(locators.length, 1, "Expected a single locator candidate");
123+
return { locators, sorted: true };
124+
}
125+
async resolve(locator, opts) {
126+
const manifest = new import_core.Manifest();
127+
return {
128+
...locator,
129+
version: "0.0.0",
130+
languageName: opts.project.configuration.get("defaultLanguageName"),
131+
linkType: import_core.LinkType.SOFT,
132+
conditions: null,
133+
dependencies: manifest.dependencies,
134+
peerDependencies: manifest.peerDependencies,
135+
dependenciesMeta: manifest.dependenciesMeta,
136+
peerDependenciesMeta: manifest.peerDependenciesMeta,
137+
bin: manifest.bin
138+
};
139+
}
140+
};
141+
142+
// src/index.ts
143+
var plugin = {
144+
fetchers: [IgnoreFetcher],
145+
resolvers: [IgnoreResolver]
146+
};
147+
var index_default = plugin;
148+
return __toCommonJS(index_exports);
149+
})();
150+
return plugin;
151+
}
152+
};
153+
//# sourceMappingURL=yarn-plugin-ignore.cjs.map

.yarnrc.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,8 @@ plugins:
2525
- path: .yarn/plugins/clean.cjs
2626
- path: .yarn/plugins/npm-workaround.cjs
2727
- path: .yarn/plugins/undo-bin-sorting.cjs
28+
- checksum: 8d8252c376e41a67ca509b2778f3fb92164aa91828459ae8a6aa0e13f1b6f9843586d0983ba9a200f6d813d37efc171474c8dbc85b0dff01df56c0d476c238ce
29+
path: .yarn/plugins/@rnx-kit/yarn-plugin-ignore.cjs
30+
spec: "https://raw.githubusercontent.com/microsoft/rnx-kit/main/incubator/yarn-plugin-ignore/dist/yarn-plugin-ignore.cjs"
2831
tsEnableAutoTypes: false
2932
yarnPath: .yarn/releases/yarn-4.13.0.cjs

nx.json

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"$schema": "./node_modules/nx/schemas/nx-schema.json",
3+
"extends": "nx/presets/npm.json",
34
"defaultBase": "trunk",
45
"targetDefaults": {
56
"format:js": {
@@ -36,9 +37,5 @@
3637
"tui": {
3738
"enabled": false
3839
},
39-
"pluginsConfig": {
40-
"@nx/js": {
41-
"analyzeSourceFiles": false
42-
}
43-
}
40+
"analytics": false
4441
}

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
"@appium/base-driver/axios": "^1.13.6",
4848
"@appium/base-driver/lodash": "^4.17.23",
4949
"@appium/base-driver/lru-cache": "^11.2.6",
50-
"@appium/docutils": "link:./packages/null",
50+
"@appium/docutils": "ignore:",
5151
"@appium/logger/lodash": "^4.17.23",
5252
"@appium/logger/lru-cache": "^11.2.6",
5353
"@appium/support/archiver": "~7.0.1",
@@ -88,7 +88,7 @@
8888
"appium/ws": "~8.19.0",
8989
"appium/yaml": "~2.8.2",
9090
"argparse/sprintf-js": "^1.0.2",
91-
"babel-jest": "link:./packages/null",
91+
"babel-jest": "ignore:",
9292
"compression/bytes": "^3.1.2",
9393
"nx/minimatch": "^10.2.4",
9494
"react-native-windows/metro-source-map": "^0.83.1",

packages/null/index.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

packages/null/package.json

Lines changed: 0 additions & 21 deletions
This file was deleted.

yarn.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,9 @@ __metadata:
4646
languageName: node
4747
linkType: hard
4848

49-
"@appium/docutils@link:./packages/null::locator=%40microsoft%2Froot%40workspace%3A.":
49+
"@appium/docutils@ignore:":
5050
version: 0.0.0-use.local
51-
resolution: "@appium/docutils@link:./packages/null::locator=%40microsoft%2Froot%40workspace%3A."
51+
resolution: "@appium/docutils@ignore:"
5252
languageName: node
5353
linkType: soft
5454

@@ -5877,9 +5877,9 @@ __metadata:
58775877
languageName: node
58785878
linkType: hard
58795879

5880-
"babel-jest@link:./packages/null::locator=%40microsoft%2Froot%40workspace%3A.":
5880+
"babel-jest@ignore:":
58815881
version: 0.0.0-use.local
5882-
resolution: "babel-jest@link:./packages/null::locator=%40microsoft%2Froot%40workspace%3A."
5882+
resolution: "babel-jest@ignore:"
58835883
languageName: node
58845884
linkType: soft
58855885

0 commit comments

Comments
 (0)