|
| 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")); |
| 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 IgnoreResolver = class { |
| 102 | + supportsDescriptor(descriptor) { |
| 103 | + return descriptor.range.startsWith(IGNORE_PROTOCOL); |
| 104 | + } |
| 105 | + supportsLocator(locator) { |
| 106 | + return locator.reference.startsWith(IGNORE_PROTOCOL); |
| 107 | + } |
| 108 | + shouldPersistResolution() { |
| 109 | + return false; |
| 110 | + } |
| 111 | + bindDescriptor(descriptor, fromLocator) { |
| 112 | + return import_core.structUtils.bindDescriptor(descriptor, { |
| 113 | + locator: import_core.structUtils.stringifyLocator(fromLocator) |
| 114 | + }); |
| 115 | + } |
| 116 | + getResolutionDependencies() { |
| 117 | + return {}; |
| 118 | + } |
| 119 | + async getCandidates(descriptor, _dependencies, _opts) { |
| 120 | + return [import_core.structUtils.makeLocator(descriptor, IGNORE_PROTOCOL)]; |
| 121 | + } |
| 122 | + async getSatisfying(descriptor, dependencies, locators, opts) { |
| 123 | + const [locator] = await this.getCandidates(descriptor, dependencies, opts); |
| 124 | + return { |
| 125 | + locators: locators.filter( |
| 126 | + (candidate) => candidate.locatorHash === locator.locatorHash |
| 127 | + ), |
| 128 | + sorted: false |
| 129 | + }; |
| 130 | + } |
| 131 | + async resolve(locator, opts) { |
| 132 | + return { |
| 133 | + ...locator, |
| 134 | + version: "0.0.0", |
| 135 | + languageName: opts.project.configuration.get("defaultLanguageName"), |
| 136 | + linkType: import_core.LinkType.SOFT, |
| 137 | + conditions: null, |
| 138 | + dependencies: /* @__PURE__ */ new Map(), |
| 139 | + peerDependencies: /* @__PURE__ */ new Map(), |
| 140 | + dependenciesMeta: /* @__PURE__ */ new Map(), |
| 141 | + peerDependenciesMeta: /* @__PURE__ */ new Map(), |
| 142 | + bin: /* @__PURE__ */ new Map() |
| 143 | + }; |
| 144 | + } |
| 145 | + }; |
| 146 | + |
| 147 | + // src/index.ts |
| 148 | + var plugin = { |
| 149 | + fetchers: [IgnoreFetcher], |
| 150 | + resolvers: [IgnoreResolver] |
| 151 | + }; |
| 152 | + var index_default = plugin; |
| 153 | + return __toCommonJS(index_exports); |
| 154 | +})(); |
| 155 | +return plugin; |
| 156 | +} |
| 157 | +}; |
| 158 | +//# sourceMappingURL=yarn-plugin-ignore.cjs.map |
0 commit comments