Remove vendors/ (#12377)

This commit is contained in:
fisker Cheung authored and GitHub committed 2022-02-28 19:48:14 +08:00
1 parent 23c173b9e4
commit a67a5c2f94
24 files changed
+3 -14021

No files matched your search

-1
View File
@@ -12,4 +12,3 @@
/website/build/
/website/static/playground.js
/website/static/lib/
/vendors/
@@ -1,32 +0,0 @@
name: Validate_Vendor_Versions
on:
push:
branches:
- main
- patch-release
paths:
- "package.json"
pull_request:
paths:
- "package.json"
jobs:
validate-vendor-versions:
name: Validate Vendor Versions
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2.4.0
- name: Setup Node.js
uses: actions/setup-node@v2.5.1
with:
version: "14"
cache: "yarn"
- name: Install Dependencies
run: yarn install --frozen-lockfile
- name: Validate Vendor Versions
run: yarn run vendors:validate
-1
View File
@@ -11,4 +11,3 @@ coverage/
/website/static/lib/
/website/static/playground.js
.nyc_output
/vendors/
+1 -2
View File
@@ -392,7 +392,6 @@
"website/playground/codeSamples.mjs",
"website/pages/googlefe164a33bda4034b.html",
"website/static/lib/**",
"website/static/playground.js",
"scripts/vendors/vendor-meta.json"
"website/static/playground.js"
]
}
+2 -5
View File
@@ -19,8 +19,7 @@
"index.js",
"standalone.js",
"src",
"bin",
"vendors"
"bin"
],
"dependencies": {
"@angular/compiler": "12.2.16",
@@ -165,9 +164,7 @@
"fix:eslint": "yarn lint:eslint --fix",
"fix:prettier": "yarn lint:prettier --write",
"build": "node ./scripts/build/build.mjs",
"build:website": "node ./scripts/build-website.mjs",
"vendors:bundle": "node ./scripts/vendors/bundle-vendors.mjs",
"vendors:validate": "node ./scripts/vendors/validate-vendor-versions.mjs"
"build:website": "node ./scripts/build-website.mjs"
},
"c8": {
"reporter": [
-5
View File
@@ -258,11 +258,6 @@ async function run(params) {
}
if (shouldSaveBundledPackagesLicenses) {
const vendorMeta = await readJson(
new URL("../vendors/vendor-meta.json", import.meta.url)
);
licenses.push(...vendorMeta.licenses);
await saveLicenses(licenses.filter(({ name }) => name !== "prettier"));
} else {
console.warn(
-55
View File
@@ -1,55 +0,0 @@
# `./scripts/vendors`
Scripts for bundling Pure ESM Packages to CommonJS so that Prettier can use them.
## Context
https://github.com/prettier/prettier/issues/12209#issuecomment-1028212785
Currently, Prettier is developed using CommonJS Modules. This is for historical reasons, and we are considering [migrating to ECMAScript Modules](https://github.com/prettier/prettier/issues/10157) in the future.
However, migrating to ECMAScript Modules is not an easy task.
While we are working on it, several important packages are being migrated to Pure ESM. Please see https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c from [@sindresorhus](https://github.com/sindresorhus) about Pure ESM Packages.
It would be a problem if Prettier could not use the new Pure ESM Package until we have completed that work.
So we will put the files bundled with Pure ESM Packages as CommonJS Modules under `/vendors`, and Prettier will use them.
**This will be removed during the migration to ESM.**
## Usage
### `/scripts/vendors/bundle-vendors.mjs`
```
yarn vendors:bundle
```
This script do the following 4 things:
**1. Bundle ESM Packages to CommonJS**
Bundles listed packages in `vendors.mjs` into `/vendors/*.js` as CommonJS.
**2. Lock vendor versions**
Locks versions of packages to `vendor-meta.json`. It is used to validate by `validate-vendor-versions.mjs`.
**3. Save vendors license info**
Saves vendors licenses info to `vendor-meta.json`.
**4. Generate `/vendors/*.d.ts`**
Generates a definition files that satisfies `lint:typecheck` for each vendors.
### `/scripts/vendors/validate-vendor-versions.mjs`
```
yarn vendors:validate
```
This script compares the version of packages locked in `vendor-versions.json` with the version of packages actually installed, and fails if they are different.
This is mainly run on CI to keep consistency between bundled and installed packages.
-118
View File
@@ -1,118 +0,0 @@
#!/usr/bin/env node
import fs from "node:fs/promises";
import path from "node:path";
import createEsmUtils from "esm-utils";
import esbuild from "esbuild";
import { readPackageUp } from "read-pkg-up";
import { PROJECT_ROOT } from "../utils/index.mjs";
import esbuildPluginLicense from "../build/esbuild-plugins/license.mjs";
import vendors from "./vendors.mjs";
import { saveVendorVersions, saveVendorLicenses } from "./utils.mjs";
import esbuildPluginTsNocheck from "./esbuild-plugin-ts-nocheck.mjs";
const { __dirname, require } = createEsmUtils(import.meta);
const rootDir = path.join(__dirname, "..", "..");
// prettier/vendors
const vendorsDir = path.join(rootDir, "vendors");
// prettier/vendors/*.js
const getVendorFilePath = (vendorName) =>
path.join(vendorsDir, `${vendorName}.js`);
async function lockVersions(vendors) {
const vendorVersions = {};
for (const vendor of vendors) {
const { packageJson: vendorPackage } = await readPackageUp({
cwd: path.dirname(require.resolve(vendor)),
});
const vendorVersion = vendorPackage.version;
vendorVersions[vendor] = vendorVersion;
}
await saveVendorVersions(vendorVersions);
}
async function fileExists(filePath) {
try {
return (await fs.stat(filePath)).isFile();
} catch {
return false;
}
}
async function cleanExistsBundledJS() {
for (const file of await fs.readdir(vendorsDir)) {
const filePath = path.join(vendorsDir, file);
if (path.extname(file) === ".js" && (await fileExists(filePath))) {
await fs.rm(filePath);
}
}
}
async function generateDts(vendor) {
const hasDefault = await import(vendor).then((module) =>
Boolean(module.default)
);
await fs.writeFile(
path.join(vendorsDir, `${vendor}.d.ts`),
[
"// This file is generated automatically.",
hasDefault ? `export {default} from "${vendor}";` : null,
`export * from "${vendor}";`,
"",
]
.filter((line) => line !== null)
.join("\n"),
"utf-8"
);
}
async function bundle(vendor, options) {
const outfile = getVendorFilePath(vendor);
if (await fileExists(outfile)) {
await fs.rm(outfile);
}
/** @type {import("esbuild").CommonOptions} */
const esbuildOption = {
entryPoints: [require.resolve(vendor)],
bundle: true,
target: ["node12.17.0"],
platform: "node",
plugins: [
esbuildPluginTsNocheck(),
esbuildPluginLicense({
cwd: PROJECT_ROOT,
thirdParty: {
includePrivate: true,
output: options.onLicenseFound,
},
}),
],
outfile,
};
await esbuild.build(esbuildOption);
await generateDts(vendor);
}
async function main() {
await cleanExistsBundledJS();
const licenses = [];
for (const vendor of vendors) {
await bundle(vendor, {
onLicenseFound(dependencies) {
licenses.push(...dependencies);
},
});
console.log(`Bundled: ${vendor}`);
}
await lockVersions(vendors);
console.log("Vendor versions saved");
await saveVendorLicenses(licenses);
console.log("Vendor licenses saved");
}
main();
-20
View File
@@ -1,20 +0,0 @@
import fs from "node:fs";
const tsNoCheck = "// @ts-nocheck\n// This file is generated automatically\n";
export default function esbuildPluginTsNocheck() {
return {
name: "ts-no-check",
setup(build) {
const options = build.initialOptions;
const { outfile } = options;
build.onEnd(() => {
if (!fs.existsSync(outfile)) {
throw new Error(`${outfile} not exists`);
}
const text = fs.readFileSync(outfile, "utf8");
fs.writeFileSync(outfile, tsNoCheck + text);
});
},
};
}
-23
View File
@@ -1,23 +0,0 @@
import fs from "node:fs";
import { readJson, writeJson } from "../utils/index.mjs";
const vendorMetaFile = new URL("./vendor-meta.json", import.meta.url);
const getMeta = () =>
fs.existsSync(vendorMetaFile) ? readJson(vendorMetaFile) : {};
export async function getVendorVersions() {
const meta = await getMeta();
return meta.versions;
}
export async function saveVendorVersions(versions) {
const meta = await getMeta();
meta.versions = versions;
await writeJson(vendorMetaFile, meta);
}
export async function saveVendorLicenses(licenses) {
const meta = await getMeta();
meta.licenses = licenses;
await writeJson(vendorMetaFile, meta);
}
-42
View File
@@ -1,42 +0,0 @@
#!/usr/bin/env node
import createEsmUtils from "esm-utils";
import { readPackageUp } from "read-pkg-up";
import { getVendorVersions } from "./utils.mjs";
import vendors from "./vendors.mjs";
const { require } = createEsmUtils(import.meta);
async function main() {
const errors = [];
const vendorVersions = await getVendorVersions();
for (const vendor of vendors) {
const { packageJson: vendorPackage } = await readPackageUp({
cwd: require.resolve(vendor),
});
const vendorPackageVersion = vendorPackage.version;
const lockedVersion = vendorVersions[vendor];
if (vendorPackageVersion !== lockedVersion) {
errors.push({
oldVersion: lockedVersion,
newVersion: vendorPackageVersion,
packageName: vendor,
});
}
}
if (errors.length > 0) {
for (const { packageName, oldVersion, newVersion } of errors) {
console.error(
`The version of \`${packageName}\` is "${newVersion}", expected locked "${oldVersion}"`
);
}
console.error(
"Did you forget running `./scripts/vendors/bundle-vendors.mjs`?"
);
process.exitCode = 1;
} else {
console.log("Done");
}
}
main();
-1489
View File
File diff suppressed because it is too large. Load diff
-3
View File
@@ -1,3 +0,0 @@
const vendors = ["string-width", "mem", "execa", "tempy"];
export default vendors;
-1
View File
@@ -16,7 +16,6 @@
"coverage/",
"test*.*",
"jest.config.mjs",
"vendors/*.js",
// [TBD] JavaScript sources *not* affected by src/language-*:
"src/main/ast-to-doc.js",
"src/main/core.js",
-5
View File
@@ -1,5 +0,0 @@
# `./vendors`
**JavaScript Files that included in this directory are auto generated by [`/scripts/vendor/bundle-vendors.mjs`](../scripts/vendors/bundle-vendors.mjs).**
See [`/scripts/vendors/README.md`](../scripts/vendors/README.md) for the context.
-2
View File
@@ -1,2 +0,0 @@
// This file is generated automatically.
export * from "execa";
-1908
View File
File diff suppressed because it is too large. Load diff
-3
View File
@@ -1,3 +0,0 @@
// This file is generated automatically.
export {default} from "mem";
export * from "mem";
-280
View File
@@ -1,280 +0,0 @@
// @ts-nocheck
// This file is generated automatically
var __create = Object.create;
var __defProp = Object.defineProperty;
var __defProps = Object.defineProperties;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __propIsEnum = Object.prototype.propertyIsEnumerable;
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __spreadValues = (a, b) => {
for (var prop in b || (b = {}))
if (__hasOwnProp.call(b, prop))
__defNormalProp(a, prop, b[prop]);
if (__getOwnPropSymbols)
for (var prop of __getOwnPropSymbols(b)) {
if (__propIsEnum.call(b, prop))
__defNormalProp(a, prop, b[prop]);
}
return a;
};
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
var __commonJS = (cb, mod) => function __require() {
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
};
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __reExport = (target, module2, copyDefault, desc) => {
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
for (let key of __getOwnPropNames(module2))
if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
}
return target;
};
var __toESM = (module2, isNodeMode) => {
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
};
var __toCommonJS = /* @__PURE__ */ ((cache) => {
return (module2, temp) => {
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
};
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
// node_modules/p-defer/index.js
var require_p_defer = __commonJS({
"node_modules/p-defer/index.js"(exports, module2) {
"use strict";
module2.exports = () => {
const ret = {};
ret.promise = new Promise((resolve, reject) => {
ret.resolve = resolve;
ret.reject = reject;
});
return ret;
};
}
});
// node_modules/map-age-cleaner/dist/index.js
var require_dist = __commonJS({
"node_modules/map-age-cleaner/dist/index.js"(exports, module2) {
"use strict";
var __awaiter = exports && exports.__awaiter || function(thisArg, _arguments, P, generator) {
return new (P || (P = Promise))(function(resolve, reject) {
function fulfilled(value) {
try {
step(generator.next(value));
} catch (e) {
reject(e);
}
}
function rejected(value) {
try {
step(generator["throw"](value));
} catch (e) {
reject(e);
}
}
function step(result) {
result.done ? resolve(result.value) : new P(function(resolve2) {
resolve2(result.value);
}).then(fulfilled, rejected);
}
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __importDefault = exports && exports.__importDefault || function(mod) {
return mod && mod.__esModule ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var p_defer_1 = __importDefault(require_p_defer());
function mapAgeCleaner2(map, property = "maxAge") {
let processingKey;
let processingTimer;
let processingDeferred;
const cleanup = () => __awaiter(this, void 0, void 0, function* () {
if (processingKey !== void 0) {
return;
}
const setupTimer = (item) => __awaiter(this, void 0, void 0, function* () {
processingDeferred = p_defer_1.default();
const delay = item[1][property] - Date.now();
if (delay <= 0) {
map.delete(item[0]);
processingDeferred.resolve();
return;
}
processingKey = item[0];
processingTimer = setTimeout(() => {
map.delete(item[0]);
if (processingDeferred) {
processingDeferred.resolve();
}
}, delay);
if (typeof processingTimer.unref === "function") {
processingTimer.unref();
}
return processingDeferred.promise;
});
try {
for (const entry of map) {
yield setupTimer(entry);
}
} catch (_a) {
}
processingKey = void 0;
});
const reset = () => {
processingKey = void 0;
if (processingTimer !== void 0) {
clearTimeout(processingTimer);
processingTimer = void 0;
}
if (processingDeferred !== void 0) {
processingDeferred.reject(void 0);
processingDeferred = void 0;
}
};
const originalSet = map.set.bind(map);
map.set = (key, value) => {
if (map.has(key)) {
map.delete(key);
}
const result = originalSet(key, value);
if (processingKey && processingKey === key) {
reset();
}
cleanup();
return result;
};
cleanup();
return map;
}
exports.default = mapAgeCleaner2;
module2.exports = mapAgeCleaner2;
module2.exports.default = mapAgeCleaner2;
}
});
// node_modules/mem/dist/index.js
var dist_exports = {};
__export(dist_exports, {
default: () => mem,
memClear: () => memClear,
memDecorator: () => memDecorator
});
// node_modules/mimic-fn/index.js
var copyProperty = (to, from, property, ignoreNonConfigurable) => {
if (property === "length" || property === "prototype") {
return;
}
if (property === "arguments" || property === "caller") {
return;
}
const toDescriptor = Object.getOwnPropertyDescriptor(to, property);
const fromDescriptor = Object.getOwnPropertyDescriptor(from, property);
if (!canCopyProperty(toDescriptor, fromDescriptor) && ignoreNonConfigurable) {
return;
}
Object.defineProperty(to, property, fromDescriptor);
};
var canCopyProperty = function(toDescriptor, fromDescriptor) {
return toDescriptor === void 0 || toDescriptor.configurable || toDescriptor.writable === fromDescriptor.writable && toDescriptor.enumerable === fromDescriptor.enumerable && toDescriptor.configurable === fromDescriptor.configurable && (toDescriptor.writable || toDescriptor.value === fromDescriptor.value);
};
var changePrototype = (to, from) => {
const fromPrototype = Object.getPrototypeOf(from);
if (fromPrototype === Object.getPrototypeOf(to)) {
return;
}
Object.setPrototypeOf(to, fromPrototype);
};
var wrappedToString = (withName, fromBody) => `/* Wrapped ${withName}*/
${fromBody}`;
var toStringDescriptor = Object.getOwnPropertyDescriptor(Function.prototype, "toString");
var toStringName = Object.getOwnPropertyDescriptor(Function.prototype.toString, "name");
var changeToString = (to, from, name) => {
const withName = name === "" ? "" : `with ${name.trim()}() `;
const newToString = wrappedToString.bind(null, withName, from.toString());
Object.defineProperty(newToString, "name", toStringName);
Object.defineProperty(to, "toString", __spreadProps(__spreadValues({}, toStringDescriptor), { value: newToString }));
};
function mimicFunction(to, from, { ignoreNonConfigurable = false } = {}) {
const { name } = to;
for (const property of Reflect.ownKeys(from)) {
copyProperty(to, from, property, ignoreNonConfigurable);
}
changePrototype(to, from);
changeToString(to, from, name);
return to;
}
// node_modules/mem/dist/index.js
var import_map_age_cleaner = __toESM(require_dist(), 1);
var cacheStore = /* @__PURE__ */ new WeakMap();
function mem(fn, { cacheKey, cache = /* @__PURE__ */ new Map(), maxAge } = {}) {
if (typeof maxAge === "number") {
(0, import_map_age_cleaner.default)(cache);
}
const memoized = function(...arguments_) {
const key = cacheKey ? cacheKey(arguments_) : arguments_[0];
const cacheItem = cache.get(key);
if (cacheItem) {
return cacheItem.data;
}
const result = fn.apply(this, arguments_);
cache.set(key, {
data: result,
maxAge: maxAge ? Date.now() + maxAge : Number.POSITIVE_INFINITY
});
return result;
};
mimicFunction(memoized, fn, {
ignoreNonConfigurable: true
});
cacheStore.set(memoized, cache);
return memoized;
}
function memDecorator(options = {}) {
const instanceMap = /* @__PURE__ */ new WeakMap();
return (target, propertyKey, descriptor) => {
const input = target[propertyKey];
if (typeof input !== "function") {
throw new TypeError("The decorated value must be a function");
}
delete descriptor.value;
delete descriptor.writable;
descriptor.get = function() {
if (!instanceMap.has(this)) {
const value = mem(input, options);
instanceMap.set(this, value);
return value;
}
return instanceMap.get(this);
};
};
}
function memClear(fn) {
const cache = cacheStore.get(fn);
if (!cache) {
throw new TypeError("Can't clear a function that was not memoized!");
}
if (typeof cache.clear !== "function") {
throw new TypeError("The cache Map can't be cleared!");
}
cache.clear();
}
module.exports = __toCommonJS(dist_exports);
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
memClear,
memDecorator
});
-5
View File
@@ -1,5 +0,0 @@
{
"//TODO": "Remove this file when we close #10157",
"type": "commonjs",
"description": "A package.json file to use `.js` files in this directory as CommonJS module."
}
-3
View File
@@ -1,3 +0,0 @@
// This file is generated automatically.
export {default} from "string-width";
export * from "string-width";
-104
View File
@@ -1,104 +0,0 @@
// @ts-nocheck
// This file is generated automatically
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
var __commonJS = (cb, mod) => function __require() {
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
};
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __reExport = (target, module2, copyDefault, desc) => {
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
for (let key of __getOwnPropNames(module2))
if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
}
return target;
};
var __toESM = (module2, isNodeMode) => {
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
};
var __toCommonJS = /* @__PURE__ */ ((cache) => {
return (module2, temp) => {
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
};
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
// node_modules/emoji-regex/index.js
var require_emoji_regex = __commonJS({
"node_modules/emoji-regex/index.js"(exports, module2) {
"use strict";
module2.exports = function() {
return /\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67)\uDB40\uDC7F|(?:\uD83E\uDDD1\uD83C\uDFFF\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFC-\uDFFF])|\uD83D\uDC68(?:\uD83C\uDFFB(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|[\u2695\u2696\u2708]\uFE0F|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))?|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])\uFE0F|\u200D(?:(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D[\uDC66\uDC67])|\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC)?|(?:\uD83D\uDC69(?:\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69]))|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC69(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83E\uDDD1(?:\u200D(?:\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDLine truncated
};
}
});
// node_modules/string-width/index.js
var string_width_exports = {};
__export(string_width_exports, {
default: () => stringWidth
});
// node_modules/string-width/node_modules/ansi-regex/index.js
function ansiRegex({ onlyFirst = false } = {}) {
const pattern = [
"[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)",
"(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))"
].join("|");
return new RegExp(pattern, onlyFirst ? void 0 : "g");
}
// node_modules/string-width/node_modules/strip-ansi/index.js
function stripAnsi(string) {
if (typeof string !== "string") {
throw new TypeError(`Expected a \`string\`, got \`${typeof string}\``);
}
return string.replace(ansiRegex(), "");
}
// node_modules/is-fullwidth-code-point/index.js
function isFullwidthCodePoint(codePoint) {
if (!Number.isInteger(codePoint)) {
return false;
}
return codePoint >= 4352 && (codePoint <= 4447 || codePoint === 9001 || codePoint === 9002 || 11904 <= codePoint && codePoint <= 12871 && codePoint !== 12351 || 12880 <= codePoint && codePoint <= 19903 || 19968 <= codePoint && codePoint <= 42182 || 43360 <= codePoint && codePoint <= 43388 || 44032 <= codePoint && codePoint <= 55203 || 63744 <= codePoint && codePoint <= 64255 || 65040 <= codePoint && codePoint <= 65049 || 65072 <= codePoint && codePoint <= 65131 || 65281 <= codePoint && codePoint <= 65376 || 65504 <= codePoint && codePoint <= 65510 || 110592 <= codePoint && codePoint <= 110593 || 127488 <= codePoint && codePoint <= 127569 || 131072 <= codePoint && codePoint <= 262141);
}
// node_modules/string-width/index.js
var import_emoji_regex = __toESM(require_emoji_regex(), 1);
function stringWidth(string) {
if (typeof string !== "string" || string.length === 0) {
return 0;
}
string = stripAnsi(string);
if (string.length === 0) {
return 0;
}
string = string.replace((0, import_emoji_regex.default)(), " ");
let width = 0;
for (let index = 0; index < string.length; index++) {
const codePoint = string.codePointAt(index);
if (codePoint <= 31 || codePoint >= 127 && codePoint <= 159) {
continue;
}
if (codePoint >= 768 && codePoint <= 879) {
continue;
}
if (codePoint > 65535) {
index++;
}
width += isFullwidthCodePoint(codePoint) ? 2 : 1;
}
return width;
}
module.exports = __toCommonJS(string_width_exports);
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {});
-3
View File
@@ -1,3 +0,0 @@
// This file is generated automatically.
export {default} from "tempy";
export * from "tempy";
-9911
View File
File diff suppressed because it is too large. Load diff