🎉 initiate project *astro_rewrite*

This commit is contained in:
sindrekjelsrud 2023-07-19 21:31:30 +02:00
parent ffd4d5e86c
commit 2ba37bfbe3
8658 changed files with 2268794 additions and 2538 deletions

1
node_modules/@pkgr/utils/lib/browser.d.ts generated vendored Normal file
View file

@ -0,0 +1 @@
export declare function openBrowser(url: string): Promise<boolean>;

122
node_modules/@pkgr/utils/lib/browser.js generated vendored Normal file
View file

@ -0,0 +1,122 @@
import { __awaiter } from "tslib";
import { execSync } from 'node:child_process';
import path from 'node:path';
import { fileURLToPath } from 'node:url';
import spawn from 'cross-spawn';
import picocolors from 'picocolors';
const OSX_CHROME = 'google chrome';
var Action;
(function (Action) {
Action[Action["NONE"] = 0] = "NONE";
Action[Action["BROWSER"] = 1] = "BROWSER";
Action[Action["SCRIPT"] = 2] = "SCRIPT";
})(Action || (Action = {}));
function getBrowserEnv() {
const value = process.env.BROWSER;
const args = process.env.BROWSER_ARGS
? process.env.BROWSER_ARGS.split(' ')
: [];
let action;
if (!value) {
action = Action.BROWSER;
}
else if (value.toLowerCase().endsWith('.js')) {
action = Action.SCRIPT;
}
else if (value.toLowerCase() === 'none') {
action = Action.NONE;
}
else {
action = Action.BROWSER;
}
return { action, value, args };
}
function executeNodeScript(scriptPath, url) {
const extraArgs = process.argv.slice(2);
const child = spawn(process.execPath, [scriptPath, ...extraArgs, url], {
stdio: 'inherit',
});
child.on('close', code => {
if (code !== 0) {
console.log();
console.log(picocolors.red('The script specified as BROWSER environment variable failed.'));
console.log(`${picocolors.cyan(scriptPath)} exited with code ${code}`);
console.log();
}
});
return true;
}
function startBrowserProcess(browser, url, args) {
return __awaiter(this, void 0, void 0, function* () {
const shouldTryOpenChromiumWithAppleScript = process.platform === 'darwin' &&
(typeof browser !== 'string' || browser === OSX_CHROME);
if (shouldTryOpenChromiumWithAppleScript) {
const supportedChromiumBrowsers = [
'Google Chrome Canary',
'Google Chrome',
'Microsoft Edge',
'Brave Browser',
'Vivaldi',
'Chromium',
];
const _dirname = typeof __dirname === 'undefined'
? path.dirname(fileURLToPath(import.meta.url))
: __dirname;
for (const chromiumBrowser of supportedChromiumBrowsers) {
try {
execSync('ps cax | grep "' + chromiumBrowser + '"');
execSync('osascript ../openChrome.applescript "' +
encodeURI(url) +
'" "' +
chromiumBrowser +
'"', {
cwd: _dirname,
stdio: 'ignore',
});
return true;
}
catch (_a) {
}
}
}
if (process.platform === 'darwin' && browser === 'open') {
browser = undefined;
}
try {
const open = (yield import('open')).default;
open(url, {
app: browser
? {
name: browser,
arguments: args,
}
: undefined,
wait: false,
}).catch(() => { });
return true;
}
catch (_b) {
return false;
}
});
}
export function openBrowser(url) {
return __awaiter(this, void 0, void 0, function* () {
const { action, value, args } = getBrowserEnv();
switch (action) {
case Action.NONE: {
return false;
}
case Action.SCRIPT: {
return executeNodeScript(value, url);
}
case Action.BROWSER: {
return startBrowserProcess(value, url, args);
}
default: {
throw new Error('Not implemented.');
}
}
});
}
//# sourceMappingURL=browser.js.map

1
node_modules/@pkgr/utils/lib/browser.js.map generated vendored Normal file
View file

@ -0,0 +1 @@
{"version":3,"file":"browser.js","sourceRoot":"","sources":["../src/browser.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAA;AAC7C,OAAO,IAAI,MAAM,WAAW,CAAA;AAC5B,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AAExC,OAAO,KAAK,MAAM,aAAa,CAAA;AAC/B,OAAO,UAAU,MAAM,YAAY,CAAA;AAGnC,MAAM,UAAU,GAAG,eAAe,CAAA;AAElC,IAAK,MAIJ;AAJD,WAAK,MAAM;IACT,mCAAI,CAAA;IACJ,yCAAO,CAAA;IACP,uCAAM,CAAA;AACR,CAAC,EAJI,MAAM,KAAN,MAAM,QAIV;AAED,SAAS,aAAa;IAIpB,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,OAAO,CAAA;IACjC,MAAM,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC,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AC,CAAC,SAAS;gBACb,IAAI,EAAE,KAAK;aACZ,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAA;YAClB,OAAO,IAAI,CAAA;SACZ;QAAC,WAAM;YACN,OAAO,KAAK,CAAA;SACb;IACH,CAAC;CAAA;AAMD,MAAM,UAAgB,WAAW,CAAC,GAAW;;QAC3C,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,aAAa,EAAE,CAAA;QAC/C,QAAQ,MAAM,EAAE;YACd,KAAK,MAAM,CAAC,IAAI,CAAC,CAAC;gBAEhB,OAAO,KAAK,CAAA;aACb;YACD,KAAK,MAAM,CAAC,MAAM,CAAC,CAAC;gBAClB,OAAO,iBAAiB,CAAC,KAAM,EAAE,GAAG,CAAC,CAAA;aACtC;YACD,KAAK,MAAM,CAAC,OAAO,CAAC,CAAC;gBACnB,OAAO,mBAAmB,CAAC,KAAK,EAAE,GAAG,EAAE,IAAI,CAAC,CAAA;aAC7C;YACD,OAAO,CAAC,CAAC;gBACP,MAAM,IAAI,KAAK,CAAC,kBAAkB,CAAC,CAAA;aACpC;SACF;IACH,CAAC;CAAA"}

20
node_modules/@pkgr/utils/lib/constants.d.ts generated vendored Normal file
View file

@ -0,0 +1,20 @@
/// <reference types="node" />
export declare const DEV: "development";
export declare const PROD: "production";
export declare const NODE_ENV: string;
export declare const __DEV__: boolean;
export declare const __PROD__: boolean;
export declare const NODE_MODULES_REG: RegExp;
export declare const CWD: string;
export declare const cjsRequire: NodeRequire;
export declare const EXTENSIONS: string[];
export declare const SCRIPT_RUNNERS: {
readonly npm: "npx";
readonly pnpm: "pnpm";
readonly yarn: "yarn";
};
export declare const SCRIPT_EXECUTORS: {
readonly npm: "npx";
readonly pnpm: "pnpx";
readonly yarn: "yarn dlx";
};

22
node_modules/@pkgr/utils/lib/constants.js generated vendored Normal file
View file

@ -0,0 +1,22 @@
var _a;
import { createRequire } from 'node:module';
export const DEV = 'development';
export const PROD = 'production';
export const NODE_ENV = (_a = process.env.NODE_ENV) !== null && _a !== void 0 ? _a : DEV;
export const __DEV__ = NODE_ENV === DEV;
export const __PROD__ = NODE_ENV === PROD;
export const NODE_MODULES_REG = /[/\\]node_modules[/\\]/;
export const CWD = process.cwd();
export const cjsRequire = typeof require === 'undefined' ? createRequire(import.meta.url) : require;
export const EXTENSIONS = ['.ts', '.tsx', ...Object.keys(cjsRequire.extensions)];
export const SCRIPT_RUNNERS = {
npm: 'npx',
pnpm: 'pnpm',
yarn: 'yarn',
};
export const SCRIPT_EXECUTORS = {
npm: 'npx',
pnpm: 'pnpx',
yarn: 'yarn dlx',
};
//# sourceMappingURL=constants.js.map

1
node_modules/@pkgr/utils/lib/constants.js.map generated vendored Normal file
View file

@ -0,0 +1 @@
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAE3C,MAAM,CAAC,MAAM,GAAG,GAAG,aAAsB,CAAA;AACzC,MAAM,CAAC,MAAM,IAAI,GAAG,YAAqB,CAAA;AAEzC,MAAM,CAAC,MAAM,QAAQ,GAAG,MAAA,OAAO,CAAC,GAAG,CAAC,QAAQ,mCAAI,GAAG,CAAA;AAEnD,MAAM,CAAC,MAAM,OAAO,GAAG,QAAQ,KAAK,GAAG,CAAA;AACvC,MAAM,CAAC,MAAM,QAAQ,GAAG,QAAQ,KAAK,IAAI,CAAA;AAEzC,MAAM,CAAC,MAAM,gBAAgB,GAAG,wBAAwB,CAAA;AAExD,MAAM,CAAC,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,EAAE,CAAA;AAEhC,MAAM,CAAC,MAAM,UAAU,GACrB,OAAO,OAAO,KAAK,WAAW,CAAC,CAAC,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAA;AAG3E,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC,CAAA;AAEhF,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,GAAG,EAAE,KAAK;IACV,IAAI,EAAE,MAAM;IACZ,IAAI,EAAE,MAAM;CACJ,CAAA;AAEV,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,GAAG,EAAE,KAAK;IACV,IAAI,EAAE,MAAM;IACZ,IAAI,EAAE,UAAU;CACR,CAAA"}

22
node_modules/@pkgr/utils/lib/helpers.d.ts generated vendored Normal file
View file

@ -0,0 +1,22 @@
export declare const tryPkg: (pkg: string) => string | undefined;
export declare const tryRequirePkg: <T>(pkg: string) => T | undefined;
export declare const isPkgAvailable: (pkg: string) => boolean;
export declare const isTsAvailable: boolean;
export declare const isAngularAvailable: boolean;
export declare const isMdxAvailable: boolean;
export declare const isReactAvailable: boolean;
export declare const isSvelteAvailable: boolean;
export declare const isVueAvailable: boolean;
export declare const tryFile: (filePath?: string[] | string, includeDir?: boolean) => string;
export declare const tryExtensions: (filepath: string, extensions?: string[]) => string;
export declare const tryGlob: (paths: string[], options?: string | {
absolute?: boolean;
baseDir?: string;
ignore?: [string];
}) => string[];
export declare const identify: <T>(_: T) => _ is Exclude<T, "" | (T extends boolean ? false : boolean) | null | undefined>;
export declare const findUp: (searchEntry: string, searchFile?: string) => string;
export declare const arrayify: <T, R = T extends (infer S)[] ? NonNullable<S> : NonNullable<T>>(...args: (R | R[])[]) => R[];
export declare const getPackageManager: () => "pnpm" | "yarn" | "npm" | undefined;
export declare const getScriptRunner: () => "npx" | "pnpm" | "yarn" | undefined;
export declare const getScriptExecutor: () => "npx" | "pnpx" | "yarn dlx" | undefined;

111
node_modules/@pkgr/utils/lib/helpers.js generated vendored Normal file
View file

@ -0,0 +1,111 @@
import fs from 'node:fs';
import path from 'node:path';
import isGlob from 'is-glob';
import { CWD, EXTENSIONS, cjsRequire, SCRIPT_RUNNERS, SCRIPT_EXECUTORS, } from './constants.js';
export const tryPkg = (pkg) => {
try {
return cjsRequire.resolve(pkg);
}
catch (_a) { }
};
export const tryRequirePkg = (pkg) => {
try {
return cjsRequire(pkg);
}
catch (_a) { }
};
export const isPkgAvailable = (pkg) => !!tryPkg(pkg);
export const isTsAvailable = isPkgAvailable('typescript');
export const isAngularAvailable = isPkgAvailable('@angular/core/package.json');
export const isMdxAvailable = isPkgAvailable('@mdx-js/mdx/package.json') ||
isPkgAvailable('@mdx-js/react/package.json');
export const isReactAvailable = isPkgAvailable('react');
export const isSvelteAvailable = isPkgAvailable('svelte');
export const isVueAvailable = isPkgAvailable('vue');
export const tryFile = (filePath, includeDir = false) => {
if (typeof filePath === 'string') {
return fs.existsSync(filePath) &&
(includeDir || fs.statSync(filePath).isFile())
? filePath
: '';
}
for (const file of filePath !== null && filePath !== void 0 ? filePath : []) {
if (tryFile(file, includeDir)) {
return file;
}
}
return '';
};
export const tryExtensions = (filepath, extensions = EXTENSIONS) => {
const ext = [...extensions, ''].find(ext => tryFile(filepath + ext));
return ext == null ? '' : filepath + ext;
};
export const tryGlob = (paths, options = {}) => {
const { absolute = true, baseDir = CWD, ignore = ['**/node_modules/**'], } = typeof options === 'string' ? { baseDir: options } : options;
return paths.reduce((acc, pkg) => [
...acc,
...(isGlob(pkg)
? tryRequirePkg('fast-glob')
.sync(pkg, {
cwd: baseDir,
ignore,
onlyFiles: false,
})
.map(file => (absolute ? path.resolve(baseDir, file) : file))
: [tryFile(path.resolve(baseDir, pkg), true)]),
].filter(Boolean), []);
};
export const identify = (_) => !!_;
export const findUp = (searchEntry, searchFile = 'package.json') => {
console.assert(path.isAbsolute(searchEntry));
if (!tryFile(searchEntry, true) ||
(searchEntry !== CWD && !searchEntry.startsWith(CWD + path.sep))) {
return '';
}
searchEntry = path.resolve(fs.statSync(searchEntry).isDirectory()
? searchEntry
: path.resolve(searchEntry, '..'));
do {
const searched = tryFile(path.resolve(searchEntry, searchFile));
if (searched) {
return searched;
}
searchEntry = path.resolve(searchEntry, '..');
} while (searchEntry === CWD || searchEntry.startsWith(CWD + path.sep));
return '';
};
export const arrayify = (...args) => args.reduce((arr, curr) => {
arr.push(...(Array.isArray(curr) ? curr : curr == null ? [] : [curr]));
return arr;
}, []);
export const getPackageManager = () => {
const execPath = process.env.npm_execpath;
if (!execPath) {
return;
}
if (/\byarn\b/.test(execPath)) {
return 'yarn';
}
if (/\bpnpm\b/.test(execPath)) {
return 'pnpm';
}
if (/\bnpm\b/.test(execPath)) {
return 'npm';
}
console.warn('unknown package manager:', execPath);
};
export const getScriptRunner = () => {
const pm = getPackageManager();
if (!pm) {
return;
}
return SCRIPT_RUNNERS[pm];
};
export const getScriptExecutor = () => {
const pm = getPackageManager();
if (!pm) {
return;
}
return SCRIPT_EXECUTORS[pm];
};
//# sourceMappingURL=helpers.js.map

1
node_modules/@pkgr/utils/lib/helpers.js.map generated vendored Normal file
View file

@ -0,0 +1 @@
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../src/helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAA;AACxB,OAAO,IAAI,MAAM,WAAW,CAAA;AAE5B,OAAO,MAAM,MAAM,SAAS,CAAA;AAE5B,OAAO,EACL,GAAG,EACH,UAAU,EACV,UAAU,EACV,cAAc,EACd,gBAAgB,GACjB,MAAM,gBAAgB,CAAA;AAEvB,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,GAAW,EAAE,EAAE;IACpC,IAAI;QACF,OAAO,UAAU,CAAC,OAAO,CAAC,GAAG,CAAC,CAAA;KAC/B;IAAC,WAAM,GAAE;AACZ,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,aAAa,GAAG,CAAI,GAAW,EAAiB,EAAE;IAC7D,IAAI;QAEF,OAAO,UAAU,CAAC,GAAG,CAAC,CAAA;KACvB;IAAC,WAAM,GAAE;AACZ,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,cAAc,GAAG,CA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AC,CAAC,CAAA;IACtE,OAAO,GAAG,CAAA;AACZ,CAAC,EAAE,EAAE,CAAC,CAAA;AAER,MAAM,CAAC,MAAM,iBAAiB,GAAG,GAAG,EAAE;IACpC,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,YAAY,CAAA;IAEzC,IAAI,CAAC,QAAQ,EAAE;QACb,OAAM;KACP;IAED,IAAI,UAAU,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE;QAC7B,OAAO,MAAM,CAAA;KACd;IAED,IAAI,UAAU,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE;QAC7B,OAAO,MAAM,CAAA;KACd;IAED,IAAI,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE;QAC5B,OAAO,KAAK,CAAA;KACb;IAED,OAAO,CAAC,IAAI,CAAC,0BAA0B,EAAE,QAAQ,CAAC,CAAA;AACpD,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,eAAe,GAAG,GAAG,EAAE;IAClC,MAAM,EAAE,GAAG,iBAAiB,EAAE,CAAA;IAE9B,IAAI,CAAC,EAAE,EAAE;QACP,OAAM;KACP;IAED,OAAO,cAAc,CAAC,EAAE,CAAC,CAAA;AAC3B,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,iBAAiB,GAAG,GAAG,EAAE;IACpC,MAAM,EAAE,GAAG,iBAAiB,EAAE,CAAA;IAE9B,IAAI,CAAC,EAAE,EAAE;QACP,OAAM;KACP;IAED,OAAO,gBAAgB,CAAC,EAAE,CAAC,CAAA;AAC7B,CAAC,CAAA"}

306
node_modules/@pkgr/utils/lib/index.cjs generated vendored Normal file
View file

@ -0,0 +1,306 @@
'use strict';
var node_child_process = require('node:child_process');
var path = require('node:path');
var node_url = require('node:url');
var spawn = require('cross-spawn');
var picocolors = require('picocolors');
var node_module = require('node:module');
var fs = require('node:fs');
var isGlob = require('is-glob');
var __async = (__this, __arguments, generator) => {
return new Promise((resolve, reject) => {
var fulfilled = (value) => {
try {
step(generator.next(value));
} catch (e) {
reject(e);
}
};
var rejected = (value) => {
try {
step(generator.throw(value));
} catch (e) {
reject(e);
}
};
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
step((generator = generator.apply(__this, __arguments)).next());
});
};
const import_meta$1 = {};
const OSX_CHROME = "google chrome";
function getBrowserEnv() {
const value = process.env.BROWSER;
const args = process.env.BROWSER_ARGS ? process.env.BROWSER_ARGS.split(" ") : [];
let action;
if (!value) {
action = 1 /* BROWSER */;
} else if (value.toLowerCase().endsWith(".js")) {
action = 2 /* SCRIPT */;
} else if (value.toLowerCase() === "none") {
action = 0 /* NONE */;
} else {
action = 1 /* BROWSER */;
}
return { action, value, args };
}
function executeNodeScript(scriptPath, url) {
const extraArgs = process.argv.slice(2);
const child = spawn(process.execPath, [scriptPath, ...extraArgs, url], {
stdio: "inherit"
});
child.on("close", (code) => {
if (code !== 0) {
console.log();
console.log(
picocolors.red(
"The script specified as BROWSER environment variable failed."
)
);
console.log(`${picocolors.cyan(scriptPath)} exited with code ${code}`);
console.log();
}
});
return true;
}
function startBrowserProcess(browser, url, args) {
return __async(this, null, function* () {
const shouldTryOpenChromiumWithAppleScript = process.platform === "darwin" && (typeof browser !== "string" || browser === OSX_CHROME);
if (shouldTryOpenChromiumWithAppleScript) {
const supportedChromiumBrowsers = [
"Google Chrome Canary",
"Google Chrome",
"Microsoft Edge",
"Brave Browser",
"Vivaldi",
"Chromium"
];
const _dirname = typeof __dirname === "undefined" ? path.dirname(node_url.fileURLToPath(import_meta$1.url)) : __dirname;
for (const chromiumBrowser of supportedChromiumBrowsers) {
try {
node_child_process.execSync('ps cax | grep "' + chromiumBrowser + '"');
node_child_process.execSync(
'osascript ../openChrome.applescript "' + // lgtm [js/shell-command-constructed-from-input]
encodeURI(url) + '" "' + chromiumBrowser + '"',
{
cwd: _dirname,
stdio: "ignore"
}
);
return true;
} catch (e) {
}
}
}
if (process.platform === "darwin" && browser === "open") {
browser = void 0;
}
try {
const open = (yield import('open')).default;
open(url, {
app: browser ? {
name: browser,
arguments: args
} : void 0,
wait: false
}).catch(() => {
});
return true;
} catch (e) {
return false;
}
});
}
function openBrowser(url) {
return __async(this, null, function* () {
const { action, value, args } = getBrowserEnv();
switch (action) {
case 0 /* NONE */: {
return false;
}
case 2 /* SCRIPT */: {
return executeNodeScript(value, url);
}
case 1 /* BROWSER */: {
return startBrowserProcess(value, url, args);
}
default: {
throw new Error("Not implemented.");
}
}
});
}
const import_meta = {};
var _a$1;
const DEV = "development";
const PROD = "production";
const NODE_ENV = (_a$1 = process.env.NODE_ENV) != null ? _a$1 : DEV;
const __DEV__ = NODE_ENV === DEV;
const __PROD__ = NODE_ENV === PROD;
const NODE_MODULES_REG = /[/\\]node_modules[/\\]/;
const CWD = process.cwd();
const cjsRequire = typeof require === "undefined" ? node_module.createRequire(import_meta.url) : require;
const EXTENSIONS = [".ts", ".tsx", ...Object.keys(cjsRequire.extensions)];
const SCRIPT_RUNNERS = {
npm: "npx",
pnpm: "pnpm",
yarn: "yarn"
};
const SCRIPT_EXECUTORS = {
npm: "npx",
pnpm: "pnpx",
// same as 'pnpm dlx'
yarn: "yarn dlx"
};
const tryPkg = (pkg) => {
try {
return cjsRequire.resolve(pkg);
} catch (e) {
}
};
const tryRequirePkg = (pkg) => {
try {
return cjsRequire(pkg);
} catch (e) {
}
};
const isPkgAvailable = (pkg) => !!tryPkg(pkg);
const isTsAvailable = isPkgAvailable("typescript");
const isAngularAvailable = isPkgAvailable("@angular/core/package.json");
const isMdxAvailable = isPkgAvailable("@mdx-js/mdx/package.json") || isPkgAvailable("@mdx-js/react/package.json");
const isReactAvailable = isPkgAvailable("react");
const isSvelteAvailable = isPkgAvailable("svelte");
const isVueAvailable = isPkgAvailable("vue");
const tryFile = (filePath, includeDir = false) => {
if (typeof filePath === "string") {
return fs.existsSync(filePath) && (includeDir || fs.statSync(filePath).isFile()) ? filePath : "";
}
for (const file of filePath != null ? filePath : []) {
if (tryFile(file, includeDir)) {
return file;
}
}
return "";
};
const tryExtensions = (filepath, extensions = EXTENSIONS) => {
const ext = [...extensions, ""].find((ext2) => tryFile(filepath + ext2));
return ext == null ? "" : filepath + ext;
};
const tryGlob = (paths, options = {}) => {
const {
absolute = true,
baseDir = CWD,
ignore = ["**/node_modules/**"]
} = typeof options === "string" ? { baseDir: options } : options;
return paths.reduce(
(acc, pkg) => [
...acc,
...isGlob(pkg) ? tryRequirePkg("fast-glob").sync(pkg, {
cwd: baseDir,
ignore,
onlyFiles: false
}).map((file) => absolute ? path.resolve(baseDir, file) : file) : [tryFile(path.resolve(baseDir, pkg), true)]
].filter(Boolean),
[]
);
};
const identify = (_) => !!_;
const findUp = (searchEntry, searchFile = "package.json") => {
console.assert(path.isAbsolute(searchEntry));
if (!tryFile(searchEntry, true) || searchEntry !== CWD && !searchEntry.startsWith(CWD + path.sep)) {
return "";
}
searchEntry = path.resolve(
fs.statSync(searchEntry).isDirectory() ? searchEntry : path.resolve(searchEntry, "..")
);
do {
const searched = tryFile(path.resolve(searchEntry, searchFile));
if (searched) {
return searched;
}
searchEntry = path.resolve(searchEntry, "..");
} while (searchEntry === CWD || searchEntry.startsWith(CWD + path.sep));
return "";
};
const arrayify = (...args) => args.reduce((arr, curr) => {
arr.push(...Array.isArray(curr) ? curr : curr == null ? [] : [curr]);
return arr;
}, []);
const getPackageManager = () => {
const execPath = process.env.npm_execpath;
if (!execPath) {
return;
}
if (/\byarn\b/.test(execPath)) {
return "yarn";
}
if (/\bpnpm\b/.test(execPath)) {
return "pnpm";
}
if (/\bnpm\b/.test(execPath)) {
return "npm";
}
console.warn("unknown package manager:", execPath);
};
const getScriptRunner = () => {
const pm = getPackageManager();
if (!pm) {
return;
}
return SCRIPT_RUNNERS[pm];
};
const getScriptExecutor = () => {
const pm = getPackageManager();
if (!pm) {
return;
}
return SCRIPT_EXECUTORS[pm];
};
var _a, _b, _c, _d;
const pkg = (_a = tryRequirePkg(path.resolve("package.json"))) != null ? _a : {};
const lernaConfig = (_b = tryRequirePkg(path.resolve("lerna.json"))) != null ? _b : {};
const pkgsPath = (_d = (_c = lernaConfig.packages) != null ? _c : pkg.workspaces) != null ? _d : [];
const isMonorepo = Array.isArray(pkgsPath) && pkgsPath.length > 0;
const monorepoPkgs = isMonorepo ? tryGlob(
pkgsPath.map(
(pkg2) => pkg2.endsWith("/package.json") ? pkg2 : `${pkg2}/package.json`
)
) : [];
exports.CWD = CWD;
exports.DEV = DEV;
exports.EXTENSIONS = EXTENSIONS;
exports.NODE_ENV = NODE_ENV;
exports.NODE_MODULES_REG = NODE_MODULES_REG;
exports.PROD = PROD;
exports.SCRIPT_EXECUTORS = SCRIPT_EXECUTORS;
exports.SCRIPT_RUNNERS = SCRIPT_RUNNERS;
exports.__DEV__ = __DEV__;
exports.__PROD__ = __PROD__;
exports.arrayify = arrayify;
exports.cjsRequire = cjsRequire;
exports.findUp = findUp;
exports.getPackageManager = getPackageManager;
exports.getScriptExecutor = getScriptExecutor;
exports.getScriptRunner = getScriptRunner;
exports.identify = identify;
exports.isAngularAvailable = isAngularAvailable;
exports.isMdxAvailable = isMdxAvailable;
exports.isMonorepo = isMonorepo;
exports.isPkgAvailable = isPkgAvailable;
exports.isReactAvailable = isReactAvailable;
exports.isSvelteAvailable = isSvelteAvailable;
exports.isTsAvailable = isTsAvailable;
exports.isVueAvailable = isVueAvailable;
exports.monorepoPkgs = monorepoPkgs;
exports.openBrowser = openBrowser;
exports.tryExtensions = tryExtensions;
exports.tryFile = tryFile;
exports.tryGlob = tryGlob;
exports.tryPkg = tryPkg;
exports.tryRequirePkg = tryRequirePkg;

4
node_modules/@pkgr/utils/lib/index.d.ts generated vendored Normal file
View file

@ -0,0 +1,4 @@
export * from './browser.js';
export * from './constants.js';
export * from './helpers.js';
export * from './monorepo.js';

5
node_modules/@pkgr/utils/lib/index.js generated vendored Normal file
View file

@ -0,0 +1,5 @@
export * from './browser.js';
export * from './constants.js';
export * from './helpers.js';
export * from './monorepo.js';
//# sourceMappingURL=index.js.map

1
node_modules/@pkgr/utils/lib/index.js.map generated vendored Normal file
View file

@ -0,0 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAA;AAC5B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,cAAc,CAAA;AAC5B,cAAc,eAAe,CAAA"}

2
node_modules/@pkgr/utils/lib/monorepo.d.ts generated vendored Normal file
View file

@ -0,0 +1,2 @@
export declare const isMonorepo: boolean;
export declare const monorepoPkgs: string[];

11
node_modules/@pkgr/utils/lib/monorepo.js generated vendored Normal file
View file

@ -0,0 +1,11 @@
var _a, _b, _c, _d;
import path from 'node:path';
import { tryGlob, tryRequirePkg } from './helpers.js';
const pkg = (_a = tryRequirePkg(path.resolve('package.json'))) !== null && _a !== void 0 ? _a : {};
const lernaConfig = (_b = tryRequirePkg(path.resolve('lerna.json'))) !== null && _b !== void 0 ? _b : {};
const pkgsPath = (_d = (_c = lernaConfig.packages) !== null && _c !== void 0 ? _c : pkg.workspaces) !== null && _d !== void 0 ? _d : [];
export const isMonorepo = Array.isArray(pkgsPath) && pkgsPath.length > 0;
export const monorepoPkgs = isMonorepo
? tryGlob(pkgsPath.map(pkg => pkg.endsWith('/package.json') ? pkg : `${pkg}/package.json`))
: [];
//# sourceMappingURL=monorepo.js.map

1
node_modules/@pkgr/utils/lib/monorepo.js.map generated vendored Normal file
View file

@ -0,0 +1 @@
{"version":3,"file":"monorepo.js","sourceRoot":"","sources":["../src/monorepo.ts"],"names":[],"mappings":";AAAA,OAAO,IAAI,MAAM,WAAW,CAAA;AAE5B,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AAErD,MAAM,GAAG,GACP,MAAA,aAAa,CAA4B,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC,mCAAI,EAAE,CAAA;AAE9E,MAAM,WAAW,GACf,MAAA,aAAa,CAA0B,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC,mCAAI,EAAE,CAAA;AAE1E,MAAM,QAAQ,GAAG,MAAA,MAAA,WAAW,CAAC,QAAQ,mCAAI,GAAG,CAAC,UAAU,mCAAI,EAAE,CAAA;AAE7D,MAAM,CAAC,MAAM,UAAU,GAAG,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAA;AAExE,MAAM,CAAC,MAAM,YAAY,GAAG,UAAU;IACpC,CAAC,CAAC,OAAO,CACL,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CACjB,GAAG,CAAC,QAAQ,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,GAAG,eAAe,CAC5D,CACF;IACH,CAAC,CAAC,EAAE,CAAA"}

87
node_modules/@pkgr/utils/openChrome.applescript generated vendored Normal file
View file

@ -0,0 +1,87 @@
property targetTab: null
property targetTabIndex: -1
property targetWindow: null
property theProgram: "Google Chrome"
on run argv
set theURL to item 1 of argv
-- Allow requested program to be optional,
-- default to Google Chrome
if (count of argv) > 1 then
set theProgram to item 2 of argv
end if
using terms from application "Google Chrome"
tell application theProgram
if (count every window) = 0 then
make new window
end if
-- 1: Looking for tab running debugger
-- then, Reload debugging tab if found
-- then return
set found to my lookupTabWithUrl(theURL)
if found then
set targetWindow's active tab index to targetTabIndex
tell targetTab to reload
tell targetWindow to activate
set index of targetWindow to 1
return
end if
-- 2: Looking for Empty tab
-- In case debugging tab was not found
-- We try to find an empty tab instead
set found to my lookupTabWithUrl("chrome://newtab/")
if found then
set targetWindow's active tab index to targetTabIndex
set URL of targetTab to theURL
tell targetWindow to activate
return
end if
-- 3: Create new tab
-- both debugging and empty tab were not found
-- make a new tab with url
tell window 1
activate
make new tab with properties {URL:theURL}
end tell
end tell
end using terms from
end run
-- Function:
-- Lookup tab with given url
-- if found, store tab, index, and window in properties
-- (properties were declared on top of file)
on lookupTabWithUrl(lookupUrl)
using terms from application "Google Chrome"
tell application theProgram
-- Find a tab with the given url
set found to false
set theTabIndex to -1
repeat with theWindow in every window
set theTabIndex to 0
repeat with theTab in every tab of theWindow
set theTabIndex to theTabIndex + 1
if (theTab's URL as string) contains lookupUrl then
-- assign tab, tab index, and window to properties
set targetTab to theTab
set targetTabIndex to theTabIndex
set targetWindow to theWindow
set found to true
exit repeat
end if
end repeat
if found then
exit repeat
end if
end repeat
end tell
end using terms from
return found
end lookupTabWithUrl

38
node_modules/@pkgr/utils/package.json generated vendored Normal file
View file

@ -0,0 +1,38 @@
{
"name": "@pkgr/utils",
"version": "2.4.2",
"type": "module",
"description": "Shared utils for `@pkgr` packages or any package else",
"repository": "git+https://github.com/un-ts/pkgr.git",
"homepage": "https://github.com/un-ts/pkgr/blob/master/packages/utils",
"author": "JounQin (https://www.1stG.me) <admin@1stg.me>",
"funding": "https://opencollective.com/unts",
"license": "MIT",
"engines": {
"node": "^12.20.0 || ^14.18.0 || >=16.0.0"
},
"main": "./lib/index.cjs",
"module": "./lib/index.js",
"exports": {
"types": "./lib/index.d.ts",
"import": "./lib/index.js",
"require": "./lib/index.cjs"
},
"types": "./lib/index.d.ts",
"files": [
"lib",
"openChrome.applescript"
],
"dependencies": {
"cross-spawn": "^7.0.3",
"fast-glob": "^3.3.0",
"is-glob": "^4.0.3",
"open": "^9.1.0",
"picocolors": "^1.0.0",
"tslib": "^2.6.0"
},
"publishConfig": {
"access": "public"
},
"sideEffects": false
}