jiek 0.4.7-alpha.13 → 0.4.7-alpha.3
Sign up to get free protection for your applications and to get access to all the features.
- package/bin/jiek.js +4 -7
- package/dist/cli.d.mts.map +1 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +95 -4277
- package/dist/cli.js.map +1 -0
- package/dist/cli.min.js +1 -19
- package/dist/cli.min.js.map +1 -0
- package/dist/cli.min.mjs +1 -0
- package/dist/cli.min.mjs.map +1 -0
- package/dist/cli.mjs +803 -0
- package/dist/cli.mjs.map +1 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -0
- package/dist/index.min.js +1 -1
- package/dist/index.min.js.map +1 -0
- package/dist/index.min.mjs +1 -0
- package/dist/index.min.mjs.map +1 -0
- package/dist/index.mjs +3 -0
- package/dist/index.mjs.map +1 -0
- package/dist/rollup/index.d.mts.map +1 -0
- package/dist/rollup/index.d.ts.map +1 -0
- package/dist/rollup/index.js +68 -4183
- package/dist/rollup/index.js.map +1 -0
- package/dist/rollup/index.min.js +1 -19
- package/dist/rollup/index.min.js.map +1 -0
- package/dist/rollup/index.min.mjs +1 -0
- package/dist/rollup/index.min.mjs.map +1 -0
- package/dist/rollup/index.mjs +551 -0
- package/dist/rollup/index.mjs.map +1 -0
- package/package.json +11 -13
- package/src/commands/base.ts +2 -1
- package/src/commands/build.ts +2 -4
- package/src/pkg.ts +1 -0
- package/src/rollup/index.ts +3 -5
- package/src/utils/filterSupport.ts +0 -2
- package/src/utils/tsRegister.ts +0 -4
- package/dist/cli.cjs +0 -5037
- package/dist/cli.min.cjs +0 -19
- package/dist/index.cjs +0 -5
- package/dist/index.min.cjs +0 -1
- package/dist/rollup/index.cjs +0 -4683
- package/dist/rollup/index.min.cjs +0 -19
- /package/dist/{cli.d.cts → cli.d.mts} +0 -0
- /package/dist/{index.d.cts → index.d.mts} +0 -0
- /package/dist/rollup/{index.d.cts → index.d.mts} +0 -0
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../src/utils/getRoot.ts","../../src/utils/filterSupport.ts","../../src/utils/getWD.ts","../../src/utils/tsRegister.ts","../../src/utils/loadConfig.ts","../../src/rollup/plugins/progress.ts","../../src/rollup/plugins/skip.ts","../../src/rollup/utils/externalResolver.ts","../../src/rollup/index.ts"],"sourcesContent":["import path from 'node:path'\n\nimport { program } from 'commander'\n\nlet root: string\nexport function getRoot() {\n if (root) return root\n\n const rootOption = program.getOptionValue('root')\n root = rootOption\n ? path.isAbsolute(rootOption)\n ? rootOption\n : path.resolve(process.cwd(), rootOption)\n : undefined\n return root\n}\n","import fs from 'node:fs'\nimport path from 'node:path'\n\nimport { filterPackagesFromDir } from '@pnpm/filter-workspace-packages'\nimport { program } from 'commander'\nimport { load } from 'js-yaml'\n\nimport { getRoot } from './getRoot'\nimport { getWD } from './getWD'\n\nexport let type = ''\n\ntry {\n require.resolve('@pnpm/filter-workspace-packages')\n type = 'pnpm'\n} catch { /* empty */ }\nif (type !== '') {\n program\n .option('-f, --filter <filter>', 'filter packages')\n}\n\ninterface ProjectsGraph {\n wd: string\n root: string\n value?: Record<string, {\n name?: string\n }>\n}\n\nexport async function getSelectedProjectsGraph(): Promise<ProjectsGraph> {\n let filter = program.getOptionValue('filter')\n const root = getRoot()\n const { wd, notWorkspace } = getWD()\n if (!notWorkspace && type === 'pnpm') {\n const pnpmWorkspaceFilePath = path.resolve(wd, 'pnpm-workspace.yaml')\n const pnpmWorkspaceFileContent = fs.readFileSync(pnpmWorkspaceFilePath, 'utf-8')\n const pnpmWorkspace = load(pnpmWorkspaceFileContent) as {\n packages: string[]\n }\n if (root === wd && !filter) {\n throw new Error('root path is workspace root, please provide a filter')\n // TODO inquirer prompt support user select packages\n }\n if (root !== wd && !filter) {\n const packageJSONIsExist = fs.existsSync(path.resolve(root, 'package.json'))\n if (!packageJSONIsExist) {\n throw new Error('root path is not workspace root, please provide a filter')\n }\n const packageJSON = JSON.parse(fs.readFileSync(path.resolve(root, 'package.json'), 'utf-8'))\n if (!packageJSON.name) {\n throw new Error('root path is not workspace root, please provide a filter')\n }\n filter = packageJSON.name\n }\n const { selectedProjectsGraph } = await filterPackagesFromDir(wd, [{\n filter: filter ?? '',\n followProdDepsOnly: true\n }], {\n prefix: root,\n workspaceDir: wd,\n patterns: pnpmWorkspace.packages\n })\n return {\n wd,\n root,\n value: Object.entries(selectedProjectsGraph)\n .reduce((acc, [key, value]) => {\n acc[key] = value.package.manifest\n return acc\n }, {} as NonNullable<ProjectsGraph['value']>)\n }\n }\n return {\n wd,\n root,\n value: {\n [wd]: JSON.parse(fs.readFileSync(path.resolve(wd, 'package.json'), 'utf-8'))\n }\n }\n}\n","import { getWorkspaceDir, isWorkspaceDir } from '@jiek/utils/getWorkspaceDir'\n\nimport { type } from './filterSupport'\nimport { getRoot } from './getRoot'\n\nlet wd: string\nlet notWorkspace = false\n\nexport function getWD() {\n if (wd) return { wd, notWorkspace }\n\n const root = getRoot()\n if (root !== undefined) {\n const isWorkspace = isWorkspaceDir(root, type)\n notWorkspace = !isWorkspace\n wd = root\n return { wd, notWorkspace }\n }\n try {\n wd = getWorkspaceDir(type)\n } catch (e) {\n // @ts-ignore\n if ('message' in e && e.message === 'workspace root not found') {\n wd = root\n notWorkspace = true\n } else {\n throw e\n }\n }\n return { wd, notWorkspace }\n}\n","function packageIsExist(name: string) {\n try {\n require.resolve(name)\n return true\n } catch (e) {\n return false\n }\n}\n\nexport let tsRegisterName: string | undefined\nconst registers = [\n process.env.JIEK_TS_REGISTER,\n 'esbuild-register',\n '@swc-node/register',\n 'ts-node/register'\n].filter(Boolean) as string[]\nfor (const register of registers) {\n if (packageIsExist(register)) {\n tsRegisterName = register\n break\n }\n}\n","import fs from 'node:fs'\nimport path from 'node:path'\n\nimport { program } from 'commander'\nimport type { Config } from 'jiek'\nimport { load } from 'js-yaml'\n\nimport { getWD } from './getWD'\nimport { tsRegisterName } from './tsRegister'\n\nlet configName = 'jiek.config'\n\nfunction getConfigPath(root: string) {\n const isSupportTsLoader = !!tsRegisterName\n function configWithExtIsExist(ext: string) {\n const filenames = [\n path.resolve(process.cwd(), `${configName}.${ext}`),\n path.resolve(process.cwd(), `.${configName}.${ext}`),\n path.resolve(root, `${configName}.${ext}`),\n path.resolve(root, `.${configName}.${ext}`)\n ]\n for (const filename of filenames) {\n if (\n fs.existsSync(filename)\n && fs.lstatSync(filename)\n .isFile()\n ) {\n return filename\n }\n }\n return\n }\n configName = configWithExtIsExist('js') ?? configName\n configName = configWithExtIsExist('json') ?? configName\n configName = configWithExtIsExist('yaml') ?? configName\n if (isSupportTsLoader) {\n configName = configWithExtIsExist('ts') ?? configName\n }\n return path.resolve(root, configName)\n}\n\nexport function loadConfig(): Config {\n const { wd: root, notWorkspace } = getWD()\n if (notWorkspace) {\n throw new Error('not in workspace')\n }\n\n let configPath = program.getOptionValue('configPath')\n\n if (!configPath) {\n configPath = getConfigPath(root)\n } else {\n if (!fs.existsSync(configPath)) {\n throw new Error(`config file not found: ${configPath}`)\n }\n if (!path.isAbsolute(configPath)) {\n configPath = path.resolve(root, configPath)\n }\n }\n const ext = path.extname(configPath)\n\n let module: any\n switch (ext) {\n case '.js':\n module = require(configPath)\n break\n case '.json':\n return require(configPath)\n case '.yaml':\n return load(fs.readFileSync(configPath, 'utf-8')) as Config\n case '.ts':\n if (tsRegisterName) {\n require(tsRegisterName)\n module = require(configPath)\n break\n }\n throw new Error(\n 'ts config file is not supported without ts register, '\n + 'please install esbuild-register or set JIEK_TS_REGISTER env for custom ts register'\n )\n case '.config':\n module = {}\n break\n default:\n throw new Error(`unsupported config file type: ${ext}`)\n }\n if (!module) throw new Error('config file is empty')\n\n return module.default ?? module\n}\n","import type { PluginImpl } from 'rollup'\n\ninterface Options {\n onEvent?: (event: string, message?: string) => void\n}\n\nexport default ((options = {}) => {\n const { onEvent } = options\n return {\n name: 'progress',\n buildStart: () => onEvent?.('start', 'Start building...'),\n buildEnd: () => onEvent?.('end', 'Build completed!'),\n resolveId: {\n order: 'post',\n handler: source => onEvent?.('resolve', `Resolving ${source}...`)\n },\n load: {\n order: 'post',\n handler: id => onEvent?.('load', `Loading ${id}...`)\n },\n transform: {\n order: 'post',\n handler: (_, id) => onEvent?.('transform', `Transforming ${id}...`)\n }\n }\n}) as PluginImpl<Options>\n","import type { PluginImpl } from 'rollup'\n\ninterface Options {\n patterns?: (string | RegExp)[]\n}\n\nexport default ((options = {}) => {\n return {\n name: 'skip',\n // skip the specified files by `options.patterns`\n load(id) {\n if (\n options.patterns?.some((pattern) =>\n typeof pattern === 'string'\n ? id.includes(pattern)\n : pattern.test(id)\n )\n ) {\n return ''\n }\n }\n }\n}) as PluginImpl<Options>\n","import fs from 'node:fs'\n\nexport default function(json: Record<string, unknown>): (string | RegExp)[]\nexport default function(path?: string): (string | RegExp)[]\nexport default function(jsonOrPath: string | Record<string, unknown> = process.cwd()): (string | RegExp)[] {\n const pkg = typeof jsonOrPath === 'string'\n ? fs.existsSync(`${jsonOrPath}/package.json`)\n ? JSON.parse(fs.readFileSync(`${jsonOrPath}/package.json`, 'utf-8'))\n : {}\n : jsonOrPath\n const { dependencies = {}, peerDependencies = {}, optionalDependencies = {} } = pkg\n const external = <(string | RegExp)[]> Object\n .keys(dependencies)\n .concat(Object.keys(peerDependencies))\n .concat(Object.keys(optionalDependencies))\n return external\n .map(dep => new RegExp(`^${dep}(/.*)?$`))\n .concat([\n /^node:/\n ])\n}\n","import '../rollup/base'\n\nimport fs from 'node:fs'\nimport { dirname, resolve } from 'node:path'\n\nimport type { Entrypoints2ExportsOptions, RecursiveRecord } from '@jiek/pkger/entrypoints'\nimport {\n DEFAULT_SKIP_VALUES,\n entrypoints2Exports,\n filterLeafs,\n getAllLeafs,\n resolveEntrypoints\n} from '@jiek/pkger/entrypoints'\nimport { dts } from '@jiek/rollup-plugin-dts'\nimport { getWorkspaceDir } from '@jiek/utils/getWorkspaceDir'\nimport json from '@rollup/plugin-json'\nimport { nodeResolve } from '@rollup/plugin-node-resolve'\nimport terser from '@rollup/plugin-terser'\nimport { sendMessage } from 'execa'\nimport { parse } from 'jsonc-parser'\nimport { isMatch } from 'micromatch'\nimport type { OutputOptions, OutputPlugin, RollupOptions } from 'rollup'\nimport esbuild from 'rollup-plugin-esbuild'\nimport ts from 'typescript'\n\nimport { loadConfig } from '../utils/loadConfig'\nimport type { RollupProgressEvent, TemplateOptions } from './base'\nimport progress from './plugins/progress'\nimport skip from './plugins/skip'\nimport externalResolver from './utils/externalResolver'\n\ninterface PackageJSON {\n name?: string\n type?: string\n exports?: Record<string, unknown> | string | string[]\n}\n\nconst {\n JIEK_ROOT,\n JIEK_ENTRIES\n} = process.env\nconst WORKSPACE_ROOT = JIEK_ROOT ?? getWorkspaceDir()\nconst COMMON_OPTIONS = {} satisfies RollupOptions\nconst COMMON_PLUGINS = [\n json()\n]\n\nconst { build } = loadConfig()\nconst jsOutdir = resolve(\n (\n typeof build?.output?.dir === 'object'\n // the outdir only effect js output in this function\n ? build.output.dir.js\n : build?.output?.dir\n ) ?? 'dist'\n)\n\nconst STYLE_REGEXP = /\\.(css|s[ac]ss|less|styl)$/\n\n// eslint-disable-next-line unused-imports/no-unused-vars\nconst debug = (...args: unknown[]) => sendMessage({ type: 'debug', data: args } satisfies RollupProgressEvent)\n\nconst resolveWorkspacePath = (p: string) => resolve(WORKSPACE_ROOT, p)\n\nconst intersection = <T>(a: Set<T>, b: Set<T>) => new Set([...a].filter(i => b.has(i)))\n\nconst pascalCase = (str: string) =>\n str\n .replace(/[@|/-](\\w)/g, (_, $1) => $1.toUpperCase())\n .replace(/(?:^|-)(\\w)/g, (_, $1) => $1.toUpperCase())\n\nconst reveal = (obj: string | Record<string, unknown>, keys: string[]) =>\n keys.reduce((acc, key) => {\n if (typeof acc === 'string') throw new Error('key not found in exports')\n if (!(key in acc)) throw new Error(`key ${key} not found in exports`)\n return acc[key] as string | Record<string, unknown>\n }, obj)\n\nconst withMinify = (\n output: OutputOptions & {\n plugins?: OutputPlugin[]\n },\n minify = build?.output?.minify\n) =>\n minify === false\n ? [output]\n : minify === 'only-minify'\n ? [{\n ...output,\n // TODO replace suffix when pubish to npm and the `build.output.minify` is 'only-minify'\n // TODO resolve dts output file name\n file: output.file?.replace(/(\\.[cm]?js)$/, '.min$1'),\n plugins: [\n ...(output.plugins ?? []),\n terser()\n ]\n }]\n : [\n output,\n {\n ...output,\n file: output.file?.replace(/(\\.[cm]?js)$/, '.min$1'),\n plugins: [\n ...(output.plugins ?? []),\n terser()\n ]\n }\n ]\n\ntype TSConfig = {\n extends?: string | string[]\n compilerOptions?: Record<string, unknown>\n references?: { path: string }[]\n files?: string[]\n include?: string[]\n exclude?: string[]\n}\n\nconst getTSConfig = (p: string): TSConfig =>\n !fs.existsSync(p) || !fs.statSync(p).isFile()\n ? {}\n : parse(fs.readFileSync(p, 'utf-8'), [], { allowTrailingComma: true, allowEmptyContent: true })\n\nconst getExtendTSConfig = (tsconfigPath: string): TSConfig => {\n tsconfigPath = resolve(tsconfigPath)\n const tsconfigPathDirname = dirname(tsconfigPath)\n const { extends: exts, ...tsconfig } = getTSConfig(tsconfigPath)\n const resolvePaths = (paths: string[] | undefined) => paths?.map(p => resolve(tsconfigPathDirname, p)) ?? []\n\n const extendsPaths = resolvePaths(\n exts ? Array.isArray(exts) ? exts : [exts] : []\n )\n if (extendsPaths.length === 0) return tsconfig\n return extendsPaths\n .map(getExtendTSConfig)\n // https://www.typescriptlang.org/tsconfig/#files:~:text=Currently%2C%20the%20only%20top%2Dlevel%20property%20that%20is%20excluded%20from%20inheritance%20is%20references.\n // Currently, the only top-level property that is excluded from inheritance is references.\n .reduce((acc, { compilerOptions = {}, references: _, ...curr }) => ({\n ...acc,\n ...curr,\n compilerOptions: {\n ...acc.compilerOptions,\n ...compilerOptions\n }\n }), tsconfig)\n}\n\nconst getCompilerOptionsByFilePath = (tsconfigPath: string, filePath: string): Record<string, unknown> | undefined => {\n tsconfigPath = resolve(tsconfigPath)\n filePath = resolve(filePath)\n const tsconfigPathDirname = dirname(tsconfigPath)\n // https://www.typescriptlang.org/tsconfig/#files:~:text=It%E2%80%99s%20worth%20noting%20that%20files%2C%20include%2C%20and%20exclude%20from%20the%20inheriting%20config%20file%20overwrite%20those%20from%20the%20base%20config%20file%2C%20and%20that%20circularity%20between%20configuration%20files%20is%20not%20allowed.\n // It’s worth noting that files, include, and exclude from the inheriting config file overwrite\n // those from the base config file, and that circularity between configuration files is not allowed.\n const tsconfig = getExtendTSConfig(tsconfigPath)\n\n const resolvePaths = (paths: string[] | undefined) => paths?.map(p => resolve(tsconfigPathDirname, p)) ?? []\n\n const [\n references,\n files,\n include,\n exclude\n ] = [\n tsconfig.references?.map(({ path }) => path),\n tsconfig.files,\n tsconfig.include,\n tsconfig.exclude\n ].map(resolvePaths)\n if (exclude.length > 0 && exclude.some(i => isMatch(filePath, i))) return\n\n // when files or include is not empty, the tsconfig should be ignored\n if (tsconfig.files?.length === 0 && tsconfig.include?.length === 0) return\n let isInclude = false\n isInclude ||= files.length > 0 && files.includes(filePath)\n isInclude ||= include.length > 0 && include.some(i => isMatch(filePath, i))\n if (isInclude) {\n return tsconfig.compilerOptions ?? {}\n } else {\n // when files or include is not empty, but the file is not matched, the tsconfig should be ignored\n if (\n (tsconfig.files && tsconfig.files.length > 0)\n || (tsconfig.include && tsconfig.include.length > 0)\n ) return\n }\n\n references.reverse()\n for (const ref of references) {\n const compilerOptions = getCompilerOptionsByFilePath(ref, filePath)\n if (compilerOptions) return compilerOptions\n }\n return tsconfig.compilerOptions\n}\n\nconst generateConfigs = ({\n path,\n name,\n input,\n output,\n external,\n pkgIsModule,\n conditionals\n}: {\n path: string\n name: string\n input: string\n output: string\n external: (string | RegExp)[]\n pkgIsModule: boolean\n conditionals: string[]\n}, options: TemplateOptions = {}): RollupOptions[] => {\n const isModule = conditionals.includes('import')\n const isCommonJS = conditionals.includes('require')\n const isBrowser = conditionals.includes('browser')\n const dtsTSConfigPaths = [\n resolveWorkspacePath('tsconfig.json'),\n resolveWorkspacePath('tsconfig.dts.json')\n ]\n let dtsTSConfigPath: string | undefined\n dtsTSConfigPaths.forEach(p => {\n if (fs.existsSync(p) && fs.statSync(p).isFile()) {\n dtsTSConfigPath = p\n }\n })\n let compilerOptions: ts.CompilerOptions = {}\n if (dtsTSConfigPath) {\n const jsonCompilerOptions = getCompilerOptionsByFilePath(dtsTSConfigPath, resolve(input))\n const { options, errors } = ts.convertCompilerOptionsFromJson(\n jsonCompilerOptions,\n dirname(dtsTSConfigPath)\n )\n if (errors.length > 0) {\n throw new Error(errors.map(e => e.messageText).join('\\n'))\n }\n compilerOptions = options\n }\n const exportConditions = [...conditionals, ...(compilerOptions.customConditions ?? [])]\n const throughEventProps: RollupProgressEvent & { type: 'progress' } = {\n type: 'progress',\n data: { name, path, exportConditions, input }\n }\n const outdir = options?.output?.dir\n return [\n {\n input,\n external,\n output: [\n ...withMinify({\n file: output,\n name,\n sourcemap: typeof options?.output?.sourcemap === 'object'\n ? options.output.sourcemap.js\n : options?.output?.sourcemap ?? true,\n format: isModule ? 'esm' : (\n isCommonJS ? 'cjs' : (\n isBrowser ? 'umd' : (\n pkgIsModule ? 'esm' : 'cjs'\n )\n )\n ),\n strict: typeof options?.output?.strict === 'object'\n ? options.output.strict.js\n : options?.output?.strict\n })\n ],\n plugins: [\n nodeResolve({ exportConditions }),\n import('rollup-plugin-postcss')\n .then(({ default: postcss }) =>\n postcss({\n extract: resolve(output.replace(/\\.[cm]?js$/, '.css')),\n minimize: true\n })\n )\n .catch(() => void 0),\n esbuild(),\n progress({\n onEvent: (event, message) =>\n sendMessage(\n {\n ...throughEventProps,\n data: { ...throughEventProps.data, event, message, tags: ['js'] }\n } satisfies RollupProgressEvent\n )\n })\n ]\n },\n {\n input,\n external,\n output: [\n {\n dir: resolve((typeof outdir === 'object' ? outdir.dts : outdir) ?? 'dist'),\n sourcemap: typeof options?.output?.sourcemap === 'object'\n ? options.output.sourcemap.dts\n : options?.output?.sourcemap ?? true,\n entryFileNames: () =>\n output\n .replace(`${jsOutdir}/`, '')\n .replace(/(\\.[cm]?)js$/, '.d$1ts'),\n strict: typeof options?.output?.strict === 'object'\n ? options.output.strict.dts\n : options?.output?.strict\n }\n ],\n plugins: [\n nodeResolve({ exportConditions }),\n skip({ patterns: [STYLE_REGEXP] }),\n dts({\n respectExternal: true,\n compilerOptions\n }),\n progress({\n onEvent: (event, message) =>\n sendMessage(\n {\n ...throughEventProps,\n data: { ...throughEventProps.data, event, message, tags: ['dts'] }\n } satisfies RollupProgressEvent\n )\n })\n ]\n }\n ]\n}\n\nexport function template(packageJSON: PackageJSON): RollupOptions[] {\n const { name, type, exports: entrypoints } = packageJSON\n const pkgIsModule = type === 'module'\n if (!name) throw new Error('package.json name is required')\n if (!entrypoints) throw new Error('package.json exports is required')\n\n const entries = JIEK_ENTRIES\n ?.split(',')\n .map(e => e.trim())\n .map(e => ({\n 'index': '.'\n }[e] ?? e))\n\n const {\n crossModuleConvertor = true\n } = build ?? {}\n\n const packageName = pascalCase(name)\n\n const external = externalResolver(packageJSON as Record<string, unknown>)\n\n const [, resolvedEntrypoints] = resolveEntrypoints(entrypoints)\n if (entries) {\n Object\n .entries(resolvedEntrypoints)\n .forEach(([key]) => {\n if (!entries.some(e => isMatch(key, e, { matchBase: true }))) {\n delete resolvedEntrypoints[key]\n }\n })\n }\n const filteredResolvedEntrypoints = filterLeafs(\n resolvedEntrypoints as RecursiveRecord<string>,\n {\n skipValue: [\n // ignore values that filename starts with `.jk-noentry`\n /(^|\\/)\\.jk-noentry/,\n ...DEFAULT_SKIP_VALUES\n ]\n }\n )\n const crossModuleWithConditional: Entrypoints2ExportsOptions['withConditional'] = crossModuleConvertor\n ? {\n import: opts =>\n !pkgIsModule && intersection(\n new Set(opts.conditionals),\n new Set(['import', 'module'])\n ).size === 0\n ? opts.dist.replace(/\\.js$/, '.mjs')\n : false,\n require: opts => {\n return pkgIsModule && intersection(\n new Set(opts.conditionals),\n new Set(['require', 'node'])\n ).size === 0\n ? opts.dist.replace(/\\.js$/, '.cjs')\n : false\n }\n }\n : {}\n const exports = entrypoints2Exports(filteredResolvedEntrypoints, {\n outdir: jsOutdir,\n withConditional: {\n ...crossModuleWithConditional\n }\n })\n\n const leafMap = new Map<string, string[][]>()\n getAllLeafs(filteredResolvedEntrypoints as RecursiveRecord<string>, ({ keys, value }) => {\n if (typeof value === 'string') {\n const keysArr = leafMap.get(value) ?? []\n leafMap.set(value, keysArr)\n keysArr.push(keys)\n }\n return false\n })\n\n const configs: RollupOptions[] = []\n leafMap.forEach((keysArr, input) =>\n keysArr.forEach((keys) => {\n const [path, ...conditionals] = keys\n\n const name = packageName + (path === '.' ? '' : pascalCase(path))\n const keyExports = reveal(exports, keys)\n const commonOptions = {\n path,\n name,\n input,\n external,\n pkgIsModule\n }\n\n switch (typeof keyExports) {\n case 'string': {\n configs.push(...generateConfigs({\n ...commonOptions,\n output: keyExports,\n conditionals\n }, build))\n break\n }\n case 'object': {\n getAllLeafs(keyExports as RecursiveRecord<string>, ({ keys: nextKeys, value }) => {\n const allConditionals = [...new Set([...conditionals, ...nextKeys])]\n if (typeof value === 'string') {\n configs.push(...generateConfigs({\n ...commonOptions,\n output: value,\n conditionals: allConditionals\n }, build))\n }\n return false\n })\n break\n }\n }\n })\n )\n sendMessage(\n {\n type: 'init',\n data: {\n leafMap,\n targetsLength: configs.length\n }\n } satisfies RollupProgressEvent\n )\n return configs.map(c => ({\n ...COMMON_OPTIONS,\n ...c,\n plugins: [\n ...COMMON_PLUGINS,\n c.plugins\n ]\n }))\n}\n"],"names":["program","isWorkspaceDir","getWorkspaceDir","load","resolve","parse","dirname","isMatch","path","options","nodeResolve","sendMessage","dts","entrypoints","resolveEntrypoints","filterLeafs","DEFAULT_SKIP_VALUES","entrypoints2Exports","getAllLeafs","name"],"mappings":";;;;;;;;;;;;;;;;;;;AAIA,IAAI,IAAA,CAAA;AACG,SAAS,OAAU,GAAA;AACxB,EAAI,IAAA,IAAA;AAAM,IAAO,OAAA,IAAA,CAAA;AAEjB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ist/rollup/index.min.js
CHANGED
@@ -1,19 +1 @@
|
|
1
|
-
|
2
|
-
/*!
|
3
|
-
* is-number <https://github.com/jonschlinkert/is-number>
|
4
|
-
*
|
5
|
-
* Copyright (c) 2014-present, Jon Schlinkert.
|
6
|
-
* Released under the MIT License.
|
7
|
-
*/function q(){return w?T:(w=1,T=function(e){return"number"==typeof e?e-e==0:"string"==typeof e&&""!==e.trim()&&(Number.isFinite?Number.isFinite(+e):isFinite(+e))})}
|
8
|
-
/*!
|
9
|
-
* to-regex-range <https://github.com/micromatch/to-regex-range>
|
10
|
-
*
|
11
|
-
* Copyright (c) 2015-present, Jon Schlinkert.
|
12
|
-
* Released under the MIT License.
|
13
|
-
*/function Z(){if(O)return L;O=1;const e=q(),t=(n,s,i)=>{if(!1===e(n))throw new TypeError("toRegexRange: expected the first argument to be a number");if(void 0===s||n===s)return String(n);if(!1===e(s))throw new TypeError("toRegexRange: expected the second argument to be a number.");let u={relaxZeros:!0,...i};"boolean"==typeof u.strictZeros&&(u.relaxZeros=!1===u.strictZeros);let a=n+":"+s+"="+String(u.relaxZeros)+String(u.shorthand)+String(u.capture)+String(u.wrap);if(t.cache.hasOwnProperty(a))return t.cache[a].result;let p=Math.min(n,s),l=Math.max(n,s);if(1===Math.abs(p-l)){let e=n+"|"+s;return u.capture?`(${e})`:!1===u.wrap?e:`(?:${e})`}let f=c(n)||c(s),g={min:n,max:s,a:p,b:l},d=[],A=[];if(f&&(g.isPadded=f,g.maxLen=String(g.max).length),p<0){A=r(l<0?Math.abs(l):1,Math.abs(p),g,u),p=g.a=0}return l>=0&&(d=r(p,l,g,u)),g.negatives=A,g.positives=d,g.result=function(e,t,n){let r=o(e,t,"-",!1)||[],s=o(t,e,"",!1)||[],i=o(e,t,"-?",!0)||[];return r.concat(i).concat(s).join("|")}(A,d),!0===u.capture?g.result=`(${g.result})`:!1!==u.wrap&&d.length+A.length>1&&(g.result=`(?:${g.result})`),t.cache[a]=g,g.result};function n(e,t,n){if(e===t)return{pattern:e,count:[],digits:0};let r=function(e,t){let n=[];for(let r=0;r<e.length;r++)n.push([e[r],t[r]]);return n}(e,t),o=r.length,s="",i=0;for(let e=0;e<o;e++){let[t,n]=r[e];t===n?s+=t:"0"!==t||"9"!==n?s+=l(t,n):i++}return i&&(s+=!0===n.shorthand?"\\d":"[0-9]"),{pattern:s,count:[i],digits:o}}function r(e,t,r,o){let i,l=function(e,t){let n=1,r=1,o=u(e,n),i=new Set([t]);for(;e<=o&&o<=t;)i.add(o),n+=1,o=u(e,n);for(o=a(t+1,r)-1;e<o&&o<=t;)i.add(o),r+=1,o=a(t+1,r)-1;return i=[...i],i.sort(s),i}(e,t),c=[],g=e;for(let e=0;e<l.length;e++){let t=l[e],s=n(String(g),String(t),o),u="";r.isPadded||!i||i.pattern!==s.pattern?(r.isPadded&&(u=f(t,r,o)),s.string=u+s.pattern+p(s.count),c.push(s),g=t+1,i=s):(i.count.length>1&&i.count.pop(),i.count.push(s.count[0]),i.string=i.pattern+p(i.count),g=t+1)}return c}function o(e,t,n,r,o){let s=[];for(let o of e){let{string:e}=o;r||i(t,"string",e)||s.push(n+e),r&&i(t,"string",e)&&s.push(n+e)}return s}function s(e,t){return e>t?1:t>e?-1:0}function i(e,t,n){return e.some((e=>e[t]===n))}function u(e,t){return Number(String(e).slice(0,-t)+"9".repeat(t))}function a(e,t){return e-e%Math.pow(10,t)}function p(e){let[t=0,n=""]=e;return n||t>1?`{${t+(n?","+n:"")}}`:""}function l(e,t,n){return`[${e}${t-e==1?"":"-"}${t}]`}function c(e){return/^-?(0+)\d/.test(e)}function f(e,t,n){if(!t.isPadded)return e;let r=Math.abs(t.maxLen-String(e).length),o=!1!==n.relaxZeros;switch(r){case 0:return"";case 1:return o?"0?":"0";case 2:return o?"0{0,2}":"00";default:return o?`0{0,${r}}`:`0{${r}}`}}return t.cache={},t.clearCache=()=>t.cache={},L=t}
|
14
|
-
/*!
|
15
|
-
* fill-range <https://github.com/jonschlinkert/fill-range>
|
16
|
-
*
|
17
|
-
* Copyright (c) 2014-present, Jon Schlinkert.
|
18
|
-
* Licensed under the MIT License.
|
19
|
-
*/function Y(){if(N)return k;N=1;const e=_,t=Z(),n=e=>null!==e&&"object"==typeof e&&!Array.isArray(e),r=e=>"number"==typeof e||"string"==typeof e&&""!==e,o=e=>Number.isInteger(+e),s=e=>{let t=`${e}`,n=-1;if("-"===t[0]&&(t=t.slice(1)),"0"===t)return!1;for(;"0"===t[++n];);return n>0},i=(e,t,n)=>{if(t>0){let n="-"===e[0]?"-":"";n&&(e=e.slice(1)),e=n+e.padStart(n?t-1:t,"0")}return!1===n?String(e):e},u=(e,t)=>{let n="-"===e[0]?"-":"";for(n&&(e=e.slice(1),t--);e.length<t;)e="0"+e;return n?"-"+e:e},a=(e,n,r,o)=>{if(r)return t(e,n,{wrap:!1,...o});let s=String.fromCharCode(e);return e===n?s:`[${s}-${String.fromCharCode(n)}]`},p=(e,n,r)=>{if(Array.isArray(e)){let t=!0===r.wrap,n=r.capture?"":"?:";return t?`(${n}${e.join("|")})`:e.join("|")}return t(e,n,r)},l=(...t)=>new RangeError("Invalid range arguments: "+e.inspect(...t)),c=(e,t,n)=>{if(!0===n.strictRanges)throw l([e,t]);return[]},f=(e,t,n=1,r={})=>{let o=Number(e),c=Number(t);if(!Number.isInteger(o)||!Number.isInteger(c)){if(!0===r.strictRanges)throw l([e,t]);return[]}0===o&&(o=0),0===c&&(c=0);let f=o>c,g=String(e),d=String(t),A=String(n);n=Math.max(Math.abs(n),1);let h=s(g)||s(d)||s(A),R=h?Math.max(g.length,d.length,A.length):0,E=!1===h&&!1===((e,t,n)=>"string"==typeof e||"string"==typeof t||!0===n.stringify)(e,t,r),_=r.transform||(e=>t=>!0===e?Number(t):String(t))(E);if(r.toRegex&&1===n)return a(u(e,R),u(t,R),!0,r);let y={negatives:[],positives:[]},m=[],C=0;for(;f?o>=c:o<=c;)!0===r.toRegex&&n>1?y[(S=o)<0?"negatives":"positives"].push(Math.abs(S)):m.push(i(_(o,C),R,E)),o=f?o-n:o+n,C++;var S;return!0===r.toRegex?n>1?((e,t)=>{e.negatives.sort(((e,t)=>e<t?-1:e>t?1:0)),e.positives.sort(((e,t)=>e<t?-1:e>t?1:0));let n,r=t.capture?"":"?:",o="",s="";return e.positives.length&&(o=e.positives.join("|")),e.negatives.length&&(s=`-(${r}${e.negatives.join("|")})`),n=o&&s?`${o}|${s}`:o||s,t.wrap?`(${r}${n})`:n})(y,r):p(m,null,{wrap:!1,...r}):m},g=(e,t,s,i={})=>{if(null==t&&r(e))return[e];if(!r(e)||!r(t))return c(e,t,i);if("function"==typeof s)return g(e,t,1,{transform:s});if(n(s))return g(e,t,0,s);let u={...i};return!0===u.capture&&(u.wrap=!0),s=s||u.step||1,o(s)?o(e)&&o(t)?f(e,t,s,u):((e,t,n=1,r={})=>{if(!o(e)&&e.length>1||!o(t)&&t.length>1)return c(e,t,r);let s=r.transform||(e=>String.fromCharCode(e)),i=`${e}`.charCodeAt(0),u=`${t}`.charCodeAt(0),l=i>u,f=Math.min(i,u),g=Math.max(i,u);if(r.toRegex&&1===n)return a(f,g,!1,r);let d=[],A=0;for(;l?i>=u:i<=u;)d.push(s(i,A)),i=l?i-n:i+n,A++;return!0===r.toRegex?p(d,null,{wrap:!1,options:r}):d})(e,t,Math.max(Math.abs(s),1),u):null==s||n(s)?g(e,t,1,s):((e,t)=>{if(!0===t.strictRanges)throw new TypeError(`Expected step "${e}" to be a number`);return[]})(s,u)};return k=g}function z(){if(K)return D;K=1;const e=X(),{MAX_LENGTH:t,CHAR_BACKSLASH:n,CHAR_BACKTICK:r,CHAR_COMMA:o,CHAR_DOT:s,CHAR_LEFT_PARENTHESES:i,CHAR_RIGHT_PARENTHESES:u,CHAR_LEFT_CURLY_BRACE:a,CHAR_RIGHT_CURLY_BRACE:p,CHAR_LEFT_SQUARE_BRACKET:l,CHAR_RIGHT_SQUARE_BRACKET:c,CHAR_DOUBLE_QUOTE:f,CHAR_SINGLE_QUOTE:g,CHAR_NO_BREAK_SPACE:d,CHAR_ZERO_WIDTH_NOBREAK_SPACE:A}=G?P:(G=1,P={MAX_LENGTH:65536,CHAR_0:"0",CHAR_9:"9",CHAR_UPPERCASE_A:"A",CHAR_LOWERCASE_A:"a",CHAR_UPPERCASE_Z:"Z",CHAR_LOWERCASE_Z:"z",CHAR_LEFT_PARENTHESES:"(",CHAR_RIGHT_PARENTHESES:")",CHAR_ASTERISK:"*",CHAR_AMPERSAND:"&",CHAR_AT:"@",CHAR_BACKSLASH:"\\",CHAR_BACKTICK:"`",CHAR_CARRIAGE_RETURN:"\r",CHAR_CIRCUMFLEX_ACCENT:"^",CHAR_COLON:":",CHAR_COMMA:",",CHAR_DOLLAR:"$",CHAR_DOT:".",CHAR_DOUBLE_QUOTE:'"',CHAR_EQUAL:"=",CHAR_EXCLAMATION_MARK:"!",CHAR_FORM_FEED:"\f",CHAR_FORWARD_SLASH:"/",CHAR_HASH:"#",CHAR_HYPHEN_MINUS:"-",CHAR_LEFT_ANGLE_BRACKET:"<",CHAR_LEFT_CURLY_BRACE:"{",CHAR_LEFT_SQUARE_BRACKET:"[",CHAR_LINE_FEED:"\n",CHAR_NO_BREAK_SPACE:" ",CHAR_PERCENT:"%",CHAR_PLUS:"+",CHAR_QUESTION_MARK:"?",CHAR_RIGHT_ANGLE_BRACKET:">",CHAR_RIGHT_CURLY_BRACE:"}",CHAR_RIGHT_SQUARE_BRACKET:"]",CHAR_SEMICOLON:";",CHAR_SINGLE_QUOTE:"'",CHAR_SPACE:" ",CHAR_TAB:"\t",CHAR_UNDERSCORE:"_",CHAR_VERTICAL_LINE:"|",CHAR_ZERO_WIDTH_NOBREAK_SPACE:"\ufeff"});return D=(h,R={})=>{if("string"!=typeof h)throw new TypeError("Expected a string");let E=R||{},_="number"==typeof E.maxLength?Math.min(t,E.maxLength):t;if(h.length>_)throw new SyntaxError(`Input length (${h.length}), exceeds max characters (${_})`);let y,m={type:"root",input:h,nodes:[]},C=[m],S=m,b=m,v=0,x=h.length,$=0,H=0;const T=()=>h[$++],w=e=>{if("text"===e.type&&"dot"===b.type&&(b.type="text"),!b||"text"!==b.type||"text"!==e.type)return S.nodes.push(e),e.parent=S,e.prev=b,b=e,e;b.value+=e.value};for(w({type:"bos"});$<x;)if(S=C[C.length-1],y=T(),y!==A&&y!==d)if(y!==n)if(y!==c)if(y!==l)if(y!==i)if(y!==u)if(y!==f&&y!==g&&y!==r)if(y!==a)if(y!==p)if(y===o&&H>0){if(S.ranges>0){S.ranges=0;let t=S.nodes.shift();S.nodes=[t,{type:"text",value:e(S)}]}w({type:"comma",value:y}),S.commas++}else if(y===s&&H>0&&0===S.commas){let e=S.nodes;if(0===H||0===e.length){w({type:"text",value:y});continue}if("dot"===b.type){if(S.range=[],b.value+=y,b.type="range",3!==S.nodes.length&&5!==S.nodes.length){S.invalid=!0,S.ranges=0,b.type="text";continue}S.ranges++,S.args=[];continue}if("range"===b.type){e.pop();let t=e[e.length-1];t.value+=b.value+y,b=t,S.ranges--;continue}w({type:"dot",value:y})}else w({type:"text",value:y});else{if("brace"!==S.type){w({type:"text",value:y});continue}let e="close";S=C.pop(),S.close=!0,w({type:e,value:y}),H--,S=C[C.length-1]}else{H++;let e=b.value&&"$"===b.value.slice(-1)||!0===S.dollar;S=w({type:"brace",open:!0,close:!1,dollar:e,depth:H,commas:0,ranges:0,nodes:[]}),C.push(S),w({type:"open",value:y})}else{let e,t=y;for(!0!==R.keepQuotes&&(y="");$<x&&(e=T());)if(e!==n){if(e===t){!0===R.keepQuotes&&(y+=e);break}y+=e}else y+=e+T();w({type:"text",value:y})}else{if("paren"!==S.type){w({type:"text",value:y});continue}S=C.pop(),w({type:"text",value:y}),S=C[C.length-1]}else S=w({type:"paren",nodes:[]}),C.push(S),w({type:"text",value:y});else{let e;for(v++;$<x&&(e=T());)if(y+=e,e!==l)if(e!==n){if(e===c&&(v--,0===v))break}else y+=T();else v++;w({type:"text",value:y})}else w({type:"text",value:"\\"+y});else w({type:"text",value:(R.keepEscaping?y:"")+T()});do{if(S=C.pop(),"root"!==S.type){S.nodes.forEach((e=>{e.nodes||("open"===e.type&&(e.isOpen=!0),"close"===e.type&&(e.isClose=!0),e.nodes||(e.type="text"),e.invalid=!0)}));let e=C[C.length-1],t=e.nodes.indexOf(S);e.nodes.splice(t,1,...S.nodes)}}while(C.length>0);return w({type:"eos"}),m},D}function V(){if(F)return U;F=1;const e=X(),t=function(){if(M)return I;M=1;const e=Y(),t=W();return I=(n,r={})=>{let o=(n,s={})=>{let i=t.isInvalidBrace(s),u=!0===n.invalid&&!0===r.escapeInvalid,a=!0===i||!0===u,p=!0===r.escapeInvalid?"\\":"",l="";if(!0===n.isOpen)return p+n.value;if(!0===n.isClose)return p+n.value;if("open"===n.type)return a?p+n.value:"(";if("close"===n.type)return a?p+n.value:")";if("comma"===n.type)return"comma"===n.prev.type?"":a?n.value:"|";if(n.value)return n.value;if(n.nodes&&n.ranges>0){let o=t.reduce(n.nodes),s=e(...o,{...r,wrap:!1,toRegex:!0});if(0!==s.length)return o.length>1&&s.length>1?`(${s})`:s}if(n.nodes)for(let e of n.nodes)l+=o(e,n);return l};return o(n)}}(),n=function(){if(j)return B;j=1;const e=Y(),t=X(),n=W(),r=(e="",t="",o=!1)=>{let s=[];if(e=[].concat(e),!(t=[].concat(t)).length)return e;if(!e.length)return o?n.flatten(t).map((e=>`{${e}}`)):t;for(let n of e)if(Array.isArray(n))for(let e of n)s.push(r(e,t,o));else for(let e of t)!0===o&&"string"==typeof e&&(e=`{${e}}`),s.push(Array.isArray(e)?r(n,e,o):n+e);return n.flatten(s)};return B=(o,s={})=>{let i=void 0===s.rangeLimit?1e3:s.rangeLimit,u=(o,a={})=>{o.queue=[];let p=a,l=a.queue;for(;"brace"!==p.type&&"root"!==p.type&&p.parent;)p=p.parent,l=p.queue;if(o.invalid||o.dollar)return void l.push(r(l.pop(),t(o,s)));if("brace"===o.type&&!0!==o.invalid&&2===o.nodes.length)return void l.push(r(l.pop(),["{}"]));if(o.nodes&&o.ranges>0){let u=n.reduce(o.nodes);if(n.exceedsLimit(...u,s.step,i))throw new RangeError("expanded array length exceeds range limit. Use options.rangeLimit to increase or disable the limit.");let a=e(...u,s);return 0===a.length&&(a=t(o,s)),l.push(r(l.pop(),a)),void(o.nodes=[])}let c=n.encloseBrace(o),f=o.queue,g=o;for(;"brace"!==g.type&&"root"!==g.type&&g.parent;)g=g.parent,f=g.queue;for(let e=0;e<o.nodes.length;e++){let t=o.nodes[e];"comma"!==t.type||"brace"!==o.type?"close"!==t.type?t.value&&"open"!==t.type?f.push(r(f.pop(),t.value)):t.nodes&&u(t,o):l.push(r(l.pop(),f,c)):(1===e&&f.push(""),f.push(""))}return f};return n.flatten(u(o))}}(),r=z(),o=(e,t={})=>{let n=[];if(Array.isArray(e))for(let r of e){let e=o.create(r,t);Array.isArray(e)?n.push(...e):n.push(e)}else n=[].concat(o.create(e,t));return t&&!0===t.expand&&!0===t.nodupes&&(n=[...new Set(n)]),n};return o.parse=(e,t={})=>r(e,t),o.stringify=(t,n={})=>e("string"==typeof t?o.parse(t,n):t,n),o.compile=(e,n={})=>("string"==typeof e&&(e=o.parse(e,n)),t(e,n)),o.expand=(e,t={})=>{"string"==typeof e&&(e=o.parse(e,t));let r=n(e,t);return!0===t.noempty&&(r=r.filter(Boolean)),!0===t.nodupes&&(r=[...new Set(r)]),r},o.create=(e,t={})=>""===e||e.length<3?[e]:!0!==t.expand?o.compile(e,t):o.expand(e,t),U=o}var J,ee,te,ne,re,oe,se,ie,ue,ae,pe,le,ce,fe={};function ge(){if(ee)return J;ee=1;const e=y,t="\\\\/",n=`[^${t}]`,r="\\.",o="\\/",s="[^/]",i=`(?:${o}|$)`,u=`(?:^|${o})`,a=`${r}{1,2}${i}`,p={DOT_LITERAL:r,PLUS_LITERAL:"\\+",QMARK_LITERAL:"\\?",SLASH_LITERAL:o,ONE_CHAR:"(?=.)",QMARK:s,END_ANCHOR:i,DOTS_SLASH:a,NO_DOT:`(?!${r})`,NO_DOTS:`(?!${u}${a})`,NO_DOT_SLASH:`(?!${r}{0,1}${i})`,NO_DOTS_SLASH:`(?!${a})`,QMARK_NO_DOT:`[^.${o}]`,STAR:`${s}*?`,START_ANCHOR:u},l={...p,SLASH_LITERAL:`[${t}]`,QMARK:n,STAR:`${n}*?`,DOTS_SLASH:`${r}{1,2}(?:[${t}]|$)`,NO_DOT:`(?!${r})`,NO_DOTS:`(?!(?:^|[${t}])${r}{1,2}(?:[${t}]|$))`,NO_DOT_SLASH:`(?!${r}{0,1}(?:[${t}]|$))`,NO_DOTS_SLASH:`(?!${r}{1,2}(?:[${t}]|$))`,QMARK_NO_DOT:`[^.${t}]`,START_ANCHOR:`(?:^|[${t}])`,END_ANCHOR:`(?:[${t}]|$)`};return J={MAX_LENGTH:65536,POSIX_REGEX_SOURCE:{alnum:"a-zA-Z0-9",alpha:"a-zA-Z",ascii:"\\x00-\\x7F",blank:" \\t",cntrl:"\\x00-\\x1F\\x7F",digit:"0-9",graph:"\\x21-\\x7E",lower:"a-z",print:"\\x20-\\x7E ",punct:"\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",space:" \\t\\r\\n\\v\\f",upper:"A-Z",word:"A-Za-z0-9_",xdigit:"A-Fa-f0-9"},REGEX_BACKSLASH:/\\(?![*+?^${}(|)[\]])/g,REGEX_NON_SPECIAL_CHARS:/^[^@![\].,$*+?^{}()|\\/]+/,REGEX_SPECIAL_CHARS:/[-*+?.^${}(|)[\]]/,REGEX_SPECIAL_CHARS_BACKREF:/(\\?)((\W)(\3*))/g,REGEX_SPECIAL_CHARS_GLOBAL:/([-*+?.^${}(|)[\]])/g,REGEX_REMOVE_BACKSLASH:/(?:\[.*?[^\\]\]|\\(?=.))/g,REPLACEMENTS:{"***":"*","**/**":"**","**/**/**":"**"},CHAR_0:48,CHAR_9:57,CHAR_UPPERCASE_A:65,CHAR_LOWERCASE_A:97,CHAR_UPPERCASE_Z:90,CHAR_LOWERCASE_Z:122,CHAR_LEFT_PARENTHESES:40,CHAR_RIGHT_PARENTHESES:41,CHAR_ASTERISK:42,CHAR_AMPERSAND:38,CHAR_AT:64,CHAR_BACKWARD_SLASH:92,CHAR_CARRIAGE_RETURN:13,CHAR_CIRCUMFLEX_ACCENT:94,CHAR_COLON:58,CHAR_COMMA:44,CHAR_DOT:46,CHAR_DOUBLE_QUOTE:34,CHAR_EQUAL:61,CHAR_EXCLAMATION_MARK:33,CHAR_FORM_FEED:12,CHAR_FORWARD_SLASH:47,CHAR_GRAVE_ACCENT:96,CHAR_HASH:35,CHAR_HYPHEN_MINUS:45,CHAR_LEFT_ANGLE_BRACKET:60,CHAR_LEFT_CURLY_BRACE:123,CHAR_LEFT_SQUARE_BRACKET:91,CHAR_LINE_FEED:10,CHAR_NO_BREAK_SPACE:160,CHAR_PERCENT:37,CHAR_PLUS:43,CHAR_QUESTION_MARK:63,CHAR_RIGHT_ANGLE_BRACKET:62,CHAR_RIGHT_CURLY_BRACE:125,CHAR_RIGHT_SQUARE_BRACKET:93,CHAR_SEMICOLON:59,CHAR_SINGLE_QUOTE:39,CHAR_SPACE:32,CHAR_TAB:9,CHAR_UNDERSCORE:95,CHAR_VERTICAL_LINE:124,CHAR_ZERO_WIDTH_NOBREAK_SPACE:65279,SEP:e.sep,extglobChars:e=>({"!":{type:"negate",open:"(?:(?!(?:",close:`))${e.STAR})`},"?":{type:"qmark",open:"(?:",close:")?"},"+":{type:"plus",open:"(?:",close:")+"},"*":{type:"star",open:"(?:",close:")*"},"@":{type:"at",open:"(?:",close:")"}}),globChars:e=>!0===e?l:p}}function de(){return te||(te=1,function(e){const t=y,n="win32"===process.platform,{REGEX_BACKSLASH:r,REGEX_REMOVE_BACKSLASH:o,REGEX_SPECIAL_CHARS:s,REGEX_SPECIAL_CHARS_GLOBAL:i}=ge();e.isObject=e=>null!==e&&"object"==typeof e&&!Array.isArray(e),e.hasRegexChars=e=>s.test(e),e.isRegexChar=t=>1===t.length&&e.hasRegexChars(t),e.escapeRegex=e=>e.replace(i,"\\$1"),e.toPosixSlashes=e=>e.replace(r,"/"),e.removeBackslashes=e=>e.replace(o,(e=>"\\"===e?"":e)),e.supportsLookbehinds=()=>{const e=process.version.slice(1).split(".").map(Number);return 3===e.length&&e[0]>=9||8===e[0]&&e[1]>=10},e.isWindows=e=>e&&"boolean"==typeof e.windows?e.windows:!0===n||"\\"===t.sep,e.escapeLast=(t,n,r)=>{const o=t.lastIndexOf(n,r);return-1===o?t:"\\"===t[o-1]?e.escapeLast(t,n,o-1):`${t.slice(0,o)}\\${t.slice(o)}`},e.removePrefix=(e,t={})=>{let n=e;return n.startsWith("./")&&(n=n.slice(2),t.prefix="./"),n},e.wrapOutput=(e,t={},n={})=>{let r=`${n.contains?"":"^"}(?:${e})${n.contains?"":"$"}`;return!0===t.negated&&(r=`(?:^(?!${r}).*$)`),r}}(fe)),fe}function Ae(){if(ue)return ie;ue=1;const e=y,t=function(){if(re)return ne;re=1;const e=de(),{CHAR_ASTERISK:t,CHAR_AT:n,CHAR_BACKWARD_SLASH:r,CHAR_COMMA:o,CHAR_DOT:s,CHAR_EXCLAMATION_MARK:i,CHAR_FORWARD_SLASH:u,CHAR_LEFT_CURLY_BRACE:a,CHAR_LEFT_PARENTHESES:p,CHAR_LEFT_SQUARE_BRACKET:l,CHAR_PLUS:c,CHAR_QUESTION_MARK:f,CHAR_RIGHT_CURLY_BRACE:g,CHAR_RIGHT_PARENTHESES:d,CHAR_RIGHT_SQUARE_BRACKET:A}=ge(),h=e=>e===u||e===r,R=e=>{!0!==e.isPrefix&&(e.depth=e.isGlobstar?1/0:1)};return ne=(E,_)=>{const y=_||{},m=E.length-1,C=!0===y.parts||!0===y.scanToEnd,S=[],b=[],v=[];let x,$,H=E,T=-1,w=0,L=0,O=!1,k=!1,N=!1,I=!1,M=!1,B=!1,j=!1,P=!1,G=!1,D=!1,K=0,U={value:"",depth:0,isGlob:!1};const F=()=>T>=m,Q=()=>(x=$,H.charCodeAt(++T));for(;T<m;){let e;if($=Q(),$!==r){if(!0===B||$===a){for(K++;!0!==F()&&($=Q());)if($!==r)if($!==a){if(!0!==B&&$===s&&($=Q())===s){if(O=U.isBrace=!0,N=U.isGlob=!0,D=!0,!0===C)continue;break}if(!0!==B&&$===o){if(O=U.isBrace=!0,N=U.isGlob=!0,D=!0,!0===C)continue;break}if($===g&&(K--,0===K)){B=!1,O=U.isBrace=!0,D=!0;break}}else K++;else j=U.backslashes=!0,Q();if(!0===C)continue;break}if($!==u){if(!0!==y.noext&&!0==($===c||$===n||$===t||$===f||$===i)&&H.charCodeAt(T+1)===p){if(N=U.isGlob=!0,I=U.isExtglob=!0,D=!0,$===i&&T===w&&(G=!0),!0===C){for(;!0!==F()&&($=Q());)if($!==r){if($===d){N=U.isGlob=!0,D=!0;break}}else j=U.backslashes=!0,$=Q();continue}break}if($===t){if(x===t&&(M=U.isGlobstar=!0),N=U.isGlob=!0,D=!0,!0===C)continue;break}if($===f){if(N=U.isGlob=!0,D=!0,!0===C)continue;break}if($===l){for(;!0!==F()&&(e=Q());)if(e!==r){if(e===A){k=U.isBracket=!0,N=U.isGlob=!0,D=!0;break}}else j=U.backslashes=!0,Q();if(!0===C)continue;break}if(!0===y.nonegate||$!==i||T!==w){if(!0!==y.noparen&&$===p){if(N=U.isGlob=!0,!0===C){for(;!0!==F()&&($=Q());)if($!==p){if($===d){D=!0;break}}else j=U.backslashes=!0,$=Q();continue}break}if(!0===N){if(D=!0,!0===C)continue;break}}else P=U.negated=!0,w++}else{if(S.push(T),b.push(U),U={value:"",depth:0,isGlob:!1},!0===D)continue;if(x===s&&T===w+1){w+=2;continue}L=T+1}}else j=U.backslashes=!0,$=Q(),$===a&&(B=!0)}!0===y.noext&&(I=!1,N=!1);let W=H,X="",q="";w>0&&(X=H.slice(0,w),H=H.slice(w),L-=w),W&&!0===N&&L>0?(W=H.slice(0,L),q=H.slice(L)):!0===N?(W="",q=H):W=H,W&&""!==W&&"/"!==W&&W!==H&&h(W.charCodeAt(W.length-1))&&(W=W.slice(0,-1)),!0===y.unescape&&(q&&(q=e.removeBackslashes(q)),W&&!0===j&&(W=e.removeBackslashes(W)));const Z={prefix:X,input:E,start:w,base:W,glob:q,isBrace:O,isBracket:k,isGlob:N,isExtglob:I,isGlobstar:M,negated:P,negatedExtglob:G};if(!0===y.tokens&&(Z.maxDepth=0,h($)||b.push(U),Z.tokens=b),!0===y.parts||!0===y.tokens){let e;for(let t=0;t<S.length;t++){const n=e?e+1:w,r=S[t],o=E.slice(n,r);y.tokens&&(0===t&&0!==w?(b[t].isPrefix=!0,b[t].value=X):b[t].value=o,R(b[t]),Z.maxDepth+=b[t].depth),0===t&&""===o||v.push(o),e=r}if(e&&e+1<E.length){const t=E.slice(e+1);v.push(t),y.tokens&&(b[b.length-1].value=t,R(b[b.length-1]),Z.maxDepth+=b[b.length-1].depth)}Z.slashes=S,Z.parts=v}return Z}}(),n=function(){if(se)return oe;se=1;const e=ge(),t=de(),{MAX_LENGTH:n,POSIX_REGEX_SOURCE:r,REGEX_NON_SPECIAL_CHARS:o,REGEX_SPECIAL_CHARS_BACKREF:s,REPLACEMENTS:i}=e,u=(e,n)=>{if("function"==typeof n.expandRange)return n.expandRange(...e,n);e.sort();const r=`[${e.join("-")}]`;try{new RegExp(r)}catch(n){return e.map((e=>t.escapeRegex(e))).join("..")}return r},a=(e,t)=>`Missing ${e}: "${t}" - use "\\\\${t}" to match literal characters`,p=(l,c)=>{if("string"!=typeof l)throw new TypeError("Expected a string");l=i[l]||l;const f={...c},g="number"==typeof f.maxLength?Math.min(n,f.maxLength):n;let d=l.length;if(d>g)throw new SyntaxError(`Input length: ${d}, exceeds maximum allowed length: ${g}`);const A={type:"bos",value:"",output:f.prepend||""},h=[A],R=f.capture?"":"?:",E=t.isWindows(c),_=e.globChars(E),y=e.extglobChars(_),{DOT_LITERAL:m,PLUS_LITERAL:C,SLASH_LITERAL:S,ONE_CHAR:b,DOTS_SLASH:v,NO_DOT:x,NO_DOT_SLASH:$,NO_DOTS_SLASH:H,QMARK:T,QMARK_NO_DOT:w,STAR:L,START_ANCHOR:O}=_,k=e=>`(${R}(?:(?!${O}${e.dot?v:m}).)*?)`,N=f.dot?"":x,I=f.dot?T:w;let M=!0===f.bash?k(f):L;f.capture&&(M=`(${M})`),"boolean"==typeof f.noext&&(f.noextglob=f.noext);const B={input:l,index:-1,start:0,dot:!0===f.dot,consumed:"",output:"",prefix:"",backtrack:!1,negated:!1,brackets:0,braces:0,parens:0,quotes:0,globstar:!1,tokens:h};l=t.removePrefix(l,B),d=l.length;const j=[],P=[],G=[];let D,K=A;const U=()=>B.index===d-1,F=B.peek=(e=1)=>l[B.index+e],Q=B.advance=()=>l[++B.index]||"",W=()=>l.slice(B.index+1),X=(e="",t=0)=>{B.consumed+=e,B.index+=t},q=e=>{B.output+=null!=e.output?e.output:e.value,X(e.value)},Z=()=>{let e=1;for(;"!"===F()&&("("!==F(2)||"?"===F(3));)Q(),B.start++,e++;return e%2!=0&&(B.negated=!0,B.start++,!0)},Y=e=>{B[e]++,G.push(e)},z=e=>{B[e]--,G.pop()},V=e=>{if("globstar"===K.type){const t=B.braces>0&&("comma"===e.type||"brace"===e.type),n=!0===e.extglob||j.length&&("pipe"===e.type||"paren"===e.type);"slash"===e.type||"paren"===e.type||t||n||(B.output=B.output.slice(0,-K.output.length),K.type="star",K.value="*",K.output=M,B.output+=K.output)}if(j.length&&"paren"!==e.type&&(j[j.length-1].inner+=e.value),(e.value||e.output)&&q(e),K&&"text"===K.type&&"text"===e.type)return K.value+=e.value,void(K.output=(K.output||"")+e.value);e.prev=K,h.push(e),K=e},J=(e,t)=>{const n={...y[t],conditions:1,inner:""};n.prev=K,n.parens=B.parens,n.output=B.output;const r=(f.capture?"(":"")+n.open;Y("parens"),V({type:e,value:t,output:B.output?"":b}),V({type:"paren",extglob:!0,value:Q(),output:r}),j.push(n)},ee=e=>{let t,n=e.close+(f.capture?")":"");if("negate"===e.type){let r=M;if(e.inner&&e.inner.length>1&&e.inner.includes("/")&&(r=k(f)),(r!==M||U()||/^\)+$/.test(W()))&&(n=e.close=`)$))${r}`),e.inner.includes("*")&&(t=W())&&/^\.[^\\/.]+$/.test(t)){const o=p(t,{...c,fastpaths:!1}).output;n=e.close=`)${o})${r})`}"bos"===e.prev.type&&(B.negatedExtglob=!0)}V({type:"paren",extglob:!0,value:D,output:n}),z("parens")};if(!1!==f.fastpaths&&!/(^[*!]|[/()[\]{}"])/.test(l)){let e=!1,n=l.replace(s,((t,n,r,o,s,i)=>"\\"===o?(e=!0,t):"?"===o?n?n+o+(s?T.repeat(s.length):""):0===i?I+(s?T.repeat(s.length):""):T.repeat(r.length):"."===o?m.repeat(r.length):"*"===o?n?n+o+(s?M:""):M:n?t:`\\${t}`));return!0===e&&(n=!0===f.unescape?n.replace(/\\/g,""):n.replace(/\\+/g,(e=>e.length%2==0?"\\\\":e?"\\":""))),n===l&&!0===f.contains?(B.output=l,B):(B.output=t.wrapOutput(n,B,c),B)}for(;!U();){if(D=Q(),"\0"===D)continue;if("\\"===D){const e=F();if("/"===e&&!0!==f.bash)continue;if("."===e||";"===e)continue;if(!e){D+="\\",V({type:"text",value:D});continue}const t=/^\\+/.exec(W());let n=0;if(t&&t[0].length>2&&(n=t[0].length,B.index+=n,n%2!=0&&(D+="\\")),!0===f.unescape?D=Q():D+=Q(),0===B.brackets){V({type:"text",value:D});continue}}if(B.brackets>0&&("]"!==D||"["===K.value||"[^"===K.value)){if(!1!==f.posix&&":"===D){const e=K.value.slice(1);if(e.includes("[")&&(K.posix=!0,e.includes(":"))){const e=K.value.lastIndexOf("["),t=K.value.slice(0,e),n=K.value.slice(e+2),o=r[n];if(o){K.value=t+o,B.backtrack=!0,Q(),A.output||1!==h.indexOf(K)||(A.output=b);continue}}}("["===D&&":"!==F()||"-"===D&&"]"===F())&&(D=`\\${D}`),"]"!==D||"["!==K.value&&"[^"!==K.value||(D=`\\${D}`),!0===f.posix&&"!"===D&&"["===K.value&&(D="^"),K.value+=D,q({value:D});continue}if(1===B.quotes&&'"'!==D){D=t.escapeRegex(D),K.value+=D,q({value:D});continue}if('"'===D){B.quotes=1===B.quotes?0:1,!0===f.keepQuotes&&V({type:"text",value:D});continue}if("("===D){Y("parens"),V({type:"paren",value:D});continue}if(")"===D){if(0===B.parens&&!0===f.strictBrackets)throw new SyntaxError(a("opening","("));const e=j[j.length-1];if(e&&B.parens===e.parens+1){ee(j.pop());continue}V({type:"paren",value:D,output:B.parens?")":"\\)"}),z("parens");continue}if("["===D){if(!0!==f.nobracket&&W().includes("]"))Y("brackets");else{if(!0!==f.nobracket&&!0===f.strictBrackets)throw new SyntaxError(a("closing","]"));D=`\\${D}`}V({type:"bracket",value:D});continue}if("]"===D){if(!0===f.nobracket||K&&"bracket"===K.type&&1===K.value.length){V({type:"text",value:D,output:`\\${D}`});continue}if(0===B.brackets){if(!0===f.strictBrackets)throw new SyntaxError(a("opening","["));V({type:"text",value:D,output:`\\${D}`});continue}z("brackets");const e=K.value.slice(1);if(!0===K.posix||"^"!==e[0]||e.includes("/")||(D=`/${D}`),K.value+=D,q({value:D}),!1===f.literalBrackets||t.hasRegexChars(e))continue;const n=t.escapeRegex(K.value);if(B.output=B.output.slice(0,-K.value.length),!0===f.literalBrackets){B.output+=n,K.value=n;continue}K.value=`(${R}${n}|${K.value})`,B.output+=K.value;continue}if("{"===D&&!0!==f.nobrace){Y("braces");const e={type:"brace",value:D,output:"(",outputIndex:B.output.length,tokensIndex:B.tokens.length};P.push(e),V(e);continue}if("}"===D){const e=P[P.length-1];if(!0===f.nobrace||!e){V({type:"text",value:D,output:D});continue}let t=")";if(!0===e.dots){const e=h.slice(),n=[];for(let t=e.length-1;t>=0&&(h.pop(),"brace"!==e[t].type);t--)"dots"!==e[t].type&&n.unshift(e[t].value);t=u(n,f),B.backtrack=!0}if(!0!==e.comma&&!0!==e.dots){const n=B.output.slice(0,e.outputIndex),r=B.tokens.slice(e.tokensIndex);e.value=e.output="\\{",D=t="\\}",B.output=n;for(const e of r)B.output+=e.output||e.value}V({type:"brace",value:D,output:t}),z("braces"),P.pop();continue}if("|"===D){j.length>0&&j[j.length-1].conditions++,V({type:"text",value:D});continue}if(","===D){let e=D;const t=P[P.length-1];t&&"braces"===G[G.length-1]&&(t.comma=!0,e="|"),V({type:"comma",value:D,output:e});continue}if("/"===D){if("dot"===K.type&&B.index===B.start+1){B.start=B.index+1,B.consumed="",B.output="",h.pop(),K=A;continue}V({type:"slash",value:D,output:S});continue}if("."===D){if(B.braces>0&&"dot"===K.type){"."===K.value&&(K.output=m);const e=P[P.length-1];K.type="dots",K.output+=D,K.value+=D,e.dots=!0;continue}if(B.braces+B.parens===0&&"bos"!==K.type&&"slash"!==K.type){V({type:"text",value:D,output:m});continue}V({type:"dot",value:D,output:m});continue}if("?"===D){if((!K||"("!==K.value)&&!0!==f.noextglob&&"("===F()&&"?"!==F(2)){J("qmark",D);continue}if(K&&"paren"===K.type){const e=F();let n=D;if("<"===e&&!t.supportsLookbehinds())throw new Error("Node.js v10 or higher is required for regex lookbehinds");("("===K.value&&!/[!=<:]/.test(e)||"<"===e&&!/<([!=]|\w+>)/.test(W()))&&(n=`\\${D}`),V({type:"text",value:D,output:n});continue}if(!0!==f.dot&&("slash"===K.type||"bos"===K.type)){V({type:"qmark",value:D,output:w});continue}V({type:"qmark",value:D,output:T});continue}if("!"===D){if(!0!==f.noextglob&&"("===F()&&("?"!==F(2)||!/[!=<:]/.test(F(3)))){J("negate",D);continue}if(!0!==f.nonegate&&0===B.index){Z();continue}}if("+"===D){if(!0!==f.noextglob&&"("===F()&&"?"!==F(2)){J("plus",D);continue}if(K&&"("===K.value||!1===f.regex){V({type:"plus",value:D,output:C});continue}if(K&&("bracket"===K.type||"paren"===K.type||"brace"===K.type)||B.parens>0){V({type:"plus",value:D});continue}V({type:"plus",value:C});continue}if("@"===D){if(!0!==f.noextglob&&"("===F()&&"?"!==F(2)){V({type:"at",extglob:!0,value:D,output:""});continue}V({type:"text",value:D});continue}if("*"!==D){"$"!==D&&"^"!==D||(D=`\\${D}`);const e=o.exec(W());e&&(D+=e[0],B.index+=e[0].length),V({type:"text",value:D});continue}if(K&&("globstar"===K.type||!0===K.star)){K.type="star",K.star=!0,K.value+=D,K.output=M,B.backtrack=!0,B.globstar=!0,X(D);continue}let e=W();if(!0!==f.noextglob&&/^\([^?]/.test(e)){J("star",D);continue}if("star"===K.type){if(!0===f.noglobstar){X(D);continue}const t=K.prev,n=t.prev,r="slash"===t.type||"bos"===t.type,o=n&&("star"===n.type||"globstar"===n.type);if(!0===f.bash&&(!r||e[0]&&"/"!==e[0])){V({type:"star",value:D,output:""});continue}const s=B.braces>0&&("comma"===t.type||"brace"===t.type),i=j.length&&("pipe"===t.type||"paren"===t.type);if(!r&&"paren"!==t.type&&!s&&!i){V({type:"star",value:D,output:""});continue}for(;"/**"===e.slice(0,3);){const t=l[B.index+4];if(t&&"/"!==t)break;e=e.slice(3),X("/**",3)}if("bos"===t.type&&U()){K.type="globstar",K.value+=D,K.output=k(f),B.output=K.output,B.globstar=!0,X(D);continue}if("slash"===t.type&&"bos"!==t.prev.type&&!o&&U()){B.output=B.output.slice(0,-(t.output+K.output).length),t.output=`(?:${t.output}`,K.type="globstar",K.output=k(f)+(f.strictSlashes?")":"|$)"),K.value+=D,B.globstar=!0,B.output+=t.output+K.output,X(D);continue}if("slash"===t.type&&"bos"!==t.prev.type&&"/"===e[0]){const n=void 0!==e[1]?"|$":"";B.output=B.output.slice(0,-(t.output+K.output).length),t.output=`(?:${t.output}`,K.type="globstar",K.output=`${k(f)}${S}|${S}${n})`,K.value+=D,B.output+=t.output+K.output,B.globstar=!0,X(D+Q()),V({type:"slash",value:"/",output:""});continue}if("bos"===t.type&&"/"===e[0]){K.type="globstar",K.value+=D,K.output=`(?:^|${S}|${k(f)}${S})`,B.output=K.output,B.globstar=!0,X(D+Q()),V({type:"slash",value:"/",output:""});continue}B.output=B.output.slice(0,-K.output.length),K.type="globstar",K.output=k(f),K.value+=D,B.output+=K.output,B.globstar=!0,X(D);continue}const n={type:"star",value:D,output:M};!0!==f.bash?!K||"bracket"!==K.type&&"paren"!==K.type||!0!==f.regex?(B.index!==B.start&&"slash"!==K.type&&"dot"!==K.type||("dot"===K.type?(B.output+=$,K.output+=$):!0===f.dot?(B.output+=H,K.output+=H):(B.output+=N,K.output+=N),"*"!==F()&&(B.output+=b,K.output+=b)),V(n)):(n.output=D,V(n)):(n.output=".*?","bos"!==K.type&&"slash"!==K.type||(n.output=N+n.output),V(n))}for(;B.brackets>0;){if(!0===f.strictBrackets)throw new SyntaxError(a("closing","]"));B.output=t.escapeLast(B.output,"["),z("brackets")}for(;B.parens>0;){if(!0===f.strictBrackets)throw new SyntaxError(a("closing",")"));B.output=t.escapeLast(B.output,"("),z("parens")}for(;B.braces>0;){if(!0===f.strictBrackets)throw new SyntaxError(a("closing","}"));B.output=t.escapeLast(B.output,"{"),z("braces")}if(!0===f.strictSlashes||"star"!==K.type&&"bracket"!==K.type||V({type:"maybe_slash",value:"",output:`${S}?`}),!0===B.backtrack){B.output="";for(const e of B.tokens)B.output+=null!=e.output?e.output:e.value,e.suffix&&(B.output+=e.suffix)}return B};return p.fastpaths=(r,o)=>{const s={...o},u="number"==typeof s.maxLength?Math.min(n,s.maxLength):n,a=r.length;if(a>u)throw new SyntaxError(`Input length: ${a}, exceeds maximum allowed length: ${u}`);r=i[r]||r;const p=t.isWindows(o),{DOT_LITERAL:l,SLASH_LITERAL:c,ONE_CHAR:f,DOTS_SLASH:g,NO_DOT:d,NO_DOTS:A,NO_DOTS_SLASH:h,STAR:R,START_ANCHOR:E}=e.globChars(p),_=s.dot?A:d,y=s.dot?h:d,m=s.capture?"":"?:";let C=!0===s.bash?".*?":R;s.capture&&(C=`(${C})`);const S=e=>!0===e.noglobstar?C:`(${m}(?:(?!${E}${e.dot?g:l}).)*?)`,b=e=>{switch(e){case"*":return`${_}${f}${C}`;case".*":return`${l}${f}${C}`;case"*.*":return`${_}${C}${l}${f}${C}`;case"*/*":return`${_}${C}${c}${f}${y}${C}`;case"**":return _+S(s);case"**/*":return`(?:${_}${S(s)}${c})?${y}${f}${C}`;case"**/*.*":return`(?:${_}${S(s)}${c})?${y}${C}${l}${f}${C}`;case"**/.*":return`(?:${_}${S(s)}${c})?${l}${f}${C}`;default:{const t=/^(.*?)\.(\w+)$/.exec(e);if(!t)return;const n=b(t[1]);if(!n)return;return n+l+t[2]}}},v=t.removePrefix(r,{negated:!1,prefix:""});let x=b(v);return x&&!0!==s.strictSlashes&&(x+=`${c}?`),x},oe=p}(),r=de(),o=ge(),s=(e,t,n=!1)=>{if(Array.isArray(e)){const r=e.map((e=>s(e,t,n))),o=e=>{for(const t of r){const n=t(e);if(n)return n}return!1};return o}const o=(i=e)&&"object"==typeof i&&!Array.isArray(i)&&e.tokens&&e.input;var i;if(""===e||"string"!=typeof e&&!o)throw new TypeError("Expected pattern to be a non-empty string");const u=t||{},a=r.isWindows(t),p=o?s.compileRe(e,t):s.makeRe(e,t,!1,!0),l=p.state;delete p.state;let c=()=>!1;if(u.ignore){const e={...t,ignore:null,onMatch:null,onResult:null};c=s(u.ignore,e,n)}const f=(n,r=!1)=>{const{isMatch:o,match:i,output:f}=s.test(n,p,t,{glob:e,posix:a}),g={glob:e,state:l,regex:p,posix:a,input:n,output:f,match:i,isMatch:o};return"function"==typeof u.onResult&&u.onResult(g),!1===o?(g.isMatch=!1,!!r&&g):c(n)?("function"==typeof u.onIgnore&&u.onIgnore(g),g.isMatch=!1,!!r&&g):("function"==typeof u.onMatch&&u.onMatch(g),!r||g)};return n&&(f.state=l),f};return s.test=(e,t,n,{glob:o,posix:i}={})=>{if("string"!=typeof e)throw new TypeError("Expected input to be a string");if(""===e)return{isMatch:!1,output:""};const u=n||{},a=u.format||(i?r.toPosixSlashes:null);let p=e===o,l=p&&a?a(e):e;return!1===p&&(l=a?a(e):e,p=l===o),!1!==p&&!0!==u.capture||(p=!0===u.matchBase||!0===u.basename?s.matchBase(e,t,n,i):t.exec(l)),{isMatch:Boolean(p),match:p,output:l}},s.matchBase=(t,n,o,i=r.isWindows(o))=>(n instanceof RegExp?n:s.makeRe(n,o)).test(e.basename(t)),s.isMatch=(e,t,n)=>s(t,n)(e),s.parse=(e,t)=>Array.isArray(e)?e.map((e=>s.parse(e,t))):n(e,{...t,fastpaths:!1}),s.scan=(e,n)=>t(e,n),s.compileRe=(e,t,n=!1,r=!1)=>{if(!0===n)return e.output;const o=t||{},i=o.contains?"":"^",u=o.contains?"":"$";let a=`${i}(?:${e.output})${u}`;e&&!0===e.negated&&(a=`^(?!${a}).*$`);const p=s.toRegex(a,t);return!0===r&&(p.state=e),p},s.makeRe=(e,t={},r=!1,o=!1)=>{if(!e||"string"!=typeof e)throw new TypeError("Expected a non-empty string");let i={negated:!1,fastpaths:!0};return!1===t.fastpaths||"."!==e[0]&&"*"!==e[0]||(i.output=n.fastpaths(e,t)),i.output||(i=n(e,t)),s.compileRe(i,t,r,o)},s.toRegex=(e,t)=>{try{const n=t||{};return new RegExp(e,n.flags||(n.nocase?"i":""))}catch(e){if(t&&!0===t.debug)throw e;return/$^/}},s.constants=o,ie=s}function he(){return pe?ae:(pe=1,ae=Ae())}var Re=function(){if(ce)return le;ce=1;const e=_,t=V(),n=he(),r=de(),o=e=>""===e||"./"===e,s=(e,t,r)=>{t=[].concat(t),e=[].concat(e);let o=new Set,s=new Set,i=new Set,u=0,a=e=>{i.add(e.output),r&&r.onResult&&r.onResult(e)};for(let i=0;i<t.length;i++){let p=n(String(t[i]),{...r,onResult:a},!0),l=p.state.negated||p.state.negatedExtglob;l&&u++;for(let t of e){let e=p(t,!0);(l?!e.isMatch:e.isMatch)&&(l?o.add(e.output):(o.delete(e.output),s.add(e.output)))}}let p=(u===t.length?[...i]:[...s]).filter((e=>!o.has(e)));if(r&&0===p.length){if(!0===r.failglob)throw new Error(`No matches found for "${t.join(", ")}"`);if(!0===r.nonull||!0===r.nullglob)return r.unescape?t.map((e=>e.replace(/\\/g,""))):t}return p};return s.match=s,s.matcher=(e,t)=>n(e,t),s.any=s.isMatch=(e,t,r)=>n(t,r)(e),s.not=(e,t,n={})=>{t=[].concat(t).map(String);let r=new Set,o=[],i=new Set(s(e,t,{...n,onResult:e=>{n.onResult&&n.onResult(e),o.push(e.output)}}));for(let e of o)i.has(e)||r.add(e);return[...r]},s.contains=(t,n,r)=>{if("string"!=typeof t)throw new TypeError(`Expected a string: "${e.inspect(t)}"`);if(Array.isArray(n))return n.some((e=>s.contains(t,e,r)));if("string"==typeof n){if(o(t)||o(n))return!1;if(t.includes(n)||t.startsWith("./")&&t.slice(2).includes(n))return!0}return s.isMatch(t,n,{...r,contains:!0})},s.matchKeys=(e,t,n)=>{if(!r.isObject(e))throw new TypeError("Expected the first argument to be an object");let o=s(Object.keys(e),t,n),i={};for(let t of o)i[t]=e[t];return i},s.some=(e,t,r)=>{let o=[].concat(e);for(let e of[].concat(t)){let t=n(String(e),r);if(o.some((e=>t(e))))return!0}return!1},s.every=(e,t,r)=>{let o=[].concat(e);for(let e of[].concat(t)){let t=n(String(e),r);if(!o.every((e=>t(e))))return!1}return!0},s.all=(t,r,o)=>{if("string"!=typeof t)throw new TypeError(`Expected a string: "${e.inspect(t)}"`);return[].concat(r).every((e=>n(e,o)(t)))},s.capture=(e,t,o)=>{let s=r.isWindows(o),i=n.makeRe(String(e),{...o,capture:!0}).exec(s?r.toPosixSlashes(t):t);if(i)return i.slice(1).map((e=>void 0===e?"":e))},s.makeRe=(...e)=>n.makeRe(...e),s.scan=(...e)=>n.scan(...e),s.parse=(e,r)=>{let o=[];for(let s of[].concat(e||[]))for(let e of t(String(s),r))o.push(n.parse(e,r));return o},s.braces=(e,n)=>{if("string"!=typeof e)throw new TypeError("Expected a string");return n&&!0===n.nobrace||!/\{.*\}/.test(e)?[e]:t(e,n)},s.braceExpand=(e,t)=>{if("string"!=typeof e)throw new TypeError("Expected a string");return s.braces(e,{...t,expand:!0})},le=s}();const Ee=(e,t)=>new Set([...e].filter((e=>t.has(e))));let _e;function ye(){if(_e)return _e;const e=S.getOptionValue("root");return _e=e?t.isAbsolute(e)?e:t.resolve(process.cwd(),e):void 0,_e}let me,Ce="";try{v(import.meta.url).resolve("@pnpm/filter-workspace-packages"),Ce="pnpm"}catch{}""!==Ce&&S.option("-f, --filter <filter>","filter packages");let Se=!1;const be=v(import.meta.url);function ve(e){try{return be.resolve(e),!0}catch(e){return!1}}let xe;const $e=[process.env.JIEK_TS_REGISTER,"esbuild-register","@swc-node/register","ts-node/register"].filter(Boolean);for(const e of $e)if(ve(e)){xe=e;break}let He="jiek.config";var Te=(e={})=>{const{onEvent:t}=e;return{name:"progress",buildStart:()=>t?.("start","Start building..."),buildEnd:()=>t?.("end","Build completed!"),resolveId:{order:"post",handler:e=>t?.("resolve",`Resolving ${e}...`)},load:{order:"post",handler:e=>t?.("load",`Loading ${e}...`)},transform:{order:"post",handler:(e,n)=>t?.("transform",`Transforming ${n}...`)}}},we=(e={})=>({name:"skip",load(t){if(e.patterns?.some((e=>"string"==typeof e?t.includes(e):e.test(t))))return""}});const{JIEK_ROOT:Le,JIEK_ENTRIES:Oe}=process.env,ke=Le??f(),Ne={},Ie=[d()],Me=function(n){const{wd:r}=function(){if(me)return{wd:me,notWorkspace:Se};const e=ye();if(void 0!==e){const t=c(e,Ce);return Se=!t,me=e,{wd:me,notWorkspace:Se}}try{me=f(Ce)}catch(t){if(!("message"in t)||"workspace root not found"!==t.message)throw t;me=e,Se=!0}return{wd:me,notWorkspace:Se}}();let o=S.getOptionValue("configPath");if(o){if(!e.existsSync(o))throw new Error(`config file not found: ${o}`);t.isAbsolute(o)||(o=t.resolve(r,o))}else o=function(n,r){const o=!!xe;function s(o){const s=[t.resolve(process.cwd(),`${He}.${o}`),t.resolve(process.cwd(),`.${He}.${o}`),t.resolve(n,`${He}.${o}`),t.resolve(n,`.${He}.${o}`)];r&&s.unshift(t.resolve(r,`${He}.${o}`),t.resolve(r,`.${He}.${o}`));for(const t of s)if(e.existsSync(t)&&e.lstatSync(t).isFile())return t}return He=s("js")??He,He=s("json")??He,He=s("yaml")??He,o&&(He=s("ts")??He),t.resolve(n,He)}(r,n);const s=t.extname(o);let i;switch(s){case".js":i=require(o);break;case".json":return require(o);case".yaml":return b(e.readFileSync(o,"utf-8"));case".ts":if(xe){require(xe),i=require(o);break}throw new Error("ts config file is not supported without ts register, please install esbuild-register or set JIEK_TS_REGISTER env for custom ts register");case".config":i={};break;default:throw new Error(`unsupported config file type: ${s}`)}if(!i)throw new Error("config file is empty");return i.default??i}()??{},{build:Be={}}=Me,je=`./${r(process.cwd(),n(("object"==typeof Be?.output?.dir?Be.output.dir.js:Be?.output?.dir)??"dist"))}`,Pe=/\.(css|s[ac]ss|less|styl)$/,Ge=e=>n(ke,e),De=e=>e.replace(/[@|/-](\w)/g,((e,t)=>t.toUpperCase())).replace(/(?:^|-)(\w)/g,((e,t)=>t.toUpperCase())),Ke=(e,t=Be?.output?.minify)=>!1===t?[e]:"only-minify"===t?[{...e,file:e.file?.replace(/(\.[cm]?js)$/,".min$1"),plugins:[...e.plugins??[],h()]}]:[e,{...e,file:e.file?.replace(/(\.[cm]?js)$/,".min$1"),plugins:[...e.plugins??[],h()]}],Ue=t=>{t=n(t);const r=o(t),{extends:s,...i}=(u=t,e.existsSync(u)&&e.statSync(u).isFile()?E(e.readFileSync(u,"utf-8"),[],{allowTrailingComma:!0,allowEmptyContent:!0}):{});var u;const a=(p=s?Array.isArray(s)?s:[s]:[],p?.map((e=>n(r,e)))??[]);var p;return 0===a.length?i:a.map(Ue).concat(i).reduce(((e,{compilerOptions:t={},references:n,...r})=>({...e,...r,compilerOptions:{...e.compilerOptions,...t}})),{})},Fe=(e,t)=>{e=n(e),t=n(t);const r=o(e),s=Ue(e),[i,u,a,p]=[s.references?.map((({path:e})=>e)),s.files,s.include,s.exclude].map((e=>e?.map((e=>n(r,e)))??[]));if(p.length>0&&p.some((e=>Re.isMatch(t,e))))return;if(0===s.files?.length&&0===s.include?.length)return;let l=!1;if(l||(l=u.length>0&&u.includes(t)),l||(l=a.length>0&&a.some((e=>Re.isMatch(t,e)))),l)return s.compilerOptions??{};if(!(s.files&&s.files.length>0||s.include&&s.include.length>0)){i.reverse();for(const e of i){const n=Fe(e,t);if(n)return n}return s.compilerOptions}},Qe=({path:t,name:r,input:s,output:i,external:u,pkgIsModule:a,conditionals:p},c={})=>{const f=p.includes("import"),d=p.includes("require"),h=p.includes("browser");let E;[Ge("tsconfig.json"),Ge("tsconfig.dts.json")].forEach((t=>{e.existsSync(t)&&e.statSync(t).isFile()&&(E=t)}));let _={};if(E){const e=Fe(E,n(s)),{options:t,errors:r}=C.convertCompilerOptionsFromJson(e,o(E));if(r.length>0)throw new Error(r.map((e=>e.messageText)).join("\n"));_=t}const y=[...p,..._.customConditions??[]],S={type:"progress",data:{name:r,path:t,exportConditions:y,input:s}},b=c?.output?.dir;return[{input:s,external:u,output:[...Ke({file:i,name:r,interop:"auto",sourcemap:"object"==typeof c?.output?.sourcemap?c.output.sourcemap.js:c?.output?.sourcemap,format:f?"esm":d?"cjs":h?"umd":a?"esm":"cjs",strict:"object"==typeof c?.output?.strict?c.output.strict.js:c?.output?.strict})],plugins:[A({exportConditions:y}),import("rollup-plugin-postcss").then((({default:e})=>e({extract:n(i.replace(/\.[cm]?js$/,".css")),minimize:!0}))).catch((()=>{})),m(),g(),Te({onEvent:(e,t)=>R({...S,data:{...S.data,event:e,message:t,tags:["js"]}})})]},{input:s,external:u,output:[{dir:n(("object"==typeof b?b.dts:b)??"dist"),sourcemap:"object"==typeof c?.output?.sourcemap?c.output.sourcemap.dts:c?.output?.sourcemap,entryFileNames:()=>i.replace(`${je}/`,"").replace(/(\.[cm]?)js$/,".d$1ts"),strict:"object"==typeof c?.output?.strict?c.output.strict.dts:c?.output?.strict}],plugins:[A({exportConditions:y}),we({patterns:[Pe]}),l({respectExternal:!0,compilerOptions:_}),Te({onEvent:(e,t)=>R({...S,data:{...S.data,event:e,message:t,tags:["dts"]}})})]}]};function We(t){const{name:o,type:l,exports:c}=t,f="module"===l;if(!o)throw new Error("package.json name is required");if(!c)throw new Error("package.json exports is required");const g=Oe?.split(",").map((e=>e.trim())).map((e=>({index:"."}[e]??e))),d=De(o),A=function(t=process.cwd()){const n="string"==typeof t?e.existsSync(`${t}/package.json`)?JSON.parse(e.readFileSync(`${t}/package.json`,"utf-8")):{}:t,{dependencies:r={},peerDependencies:o={},optionalDependencies:s={}}=n;return Object.keys(r).concat(Object.keys(o)).concat(Object.keys(s)).map((e=>new RegExp(`^${e}(/.*)?$`))).concat([/^node:/])}(t),[h,E]=function({entrypoints:e,pkgIsModule:t,entries:o,config:p,dir:l,noFilter:c,withSource:f,withSuffix:g}){const{build:d={}}=p??{},{crossModuleConvertor:A=!0}=d,h=`./${(e=>r(l??process.cwd(),e))(((...e)=>n(l??process.cwd(),...e))(("object"==typeof d?.output?.dir?d.output.dir.js:d?.output?.dir)??"dist"))}`,[,R]=s(e);o&&Object.entries(R).forEach((([e])=>{o.some((t=>Re.isMatch(e,t,{matchBase:!0})))||delete R[e]}));const E=c?R:i(R,{skipValue:[/(^|\/)\.jk-noentry/,...u]});return[E,a(E,{outdir:h,withSource:f,withSuffix:g,withConditional:{...A?{import:e=>!t&&0===Ee(new Set(e.conditionals),new Set(["import","module"])).size&&e.dist.replace(/\.js$/,".mjs"),require:e=>!(!t||0!==Ee(new Set(e.conditionals),new Set(["require","node"])).size)&&e.dist.replace(/\.js$/,".cjs")}:{}}})]}({entrypoints:c,pkgIsModule:f,entries:g,config:Me}),_=new Map;p(h,(({keys:e,value:t})=>{if("string"==typeof t){const n=_.get(t)??[];_.set(t,n),n.push(e)}return!1}));const y=[];return _.forEach(((e,t)=>e.forEach((e=>{const[n,...r]=e,o=d+("."===n?"":De(n)),s=((e,t)=>t.reduce(((e,t)=>{if("string"==typeof e)throw new Error("key not found in exports");if(!(t in e))throw new Error(`key ${t} not found in exports`);return e[t]}),e))(E,e),i={path:n,name:o,input:t,external:A,pkgIsModule:f};switch(typeof s){case"string":y.push(...Qe({...i,output:s,conditionals:r},Be));break;case"object":p(s,(({keys:e,value:t})=>{const n=[...new Set([...r,...e])];return"string"==typeof t&&y.push(...Qe({...i,output:t,conditionals:n},Be)),!1}))}})))),R({type:"init",data:{leafMap:_,targetsLength:y.length}}),y.map((e=>({...Ne,...e,plugins:[...Ie,e.plugins]})))}export{We as template};
|
1
|
+
"use strict";var e=require("node:fs"),t=require("node:path"),r=require("@jiek/pkger/entrypoints"),s=require("@jiek/rollup-plugin-dts"),o=require("@jiek/utils/getWorkspaceDir"),n=require("@rollup/plugin-json"),i=require("@rollup/plugin-node-resolve"),c=require("@rollup/plugin-terser"),p=require("execa"),u=require("jsonc-parser"),a=require("micromatch"),l=require("rollup-plugin-esbuild"),d=require("typescript"),f=require("commander"),m=require("js-yaml");require("@pnpm/filter-workspace-packages");const g=(e,t)=>new Set([...e].filter((e=>t.has(e))));let y;function h(){if(y)return y;const e=f.program.getOptionValue("root");return y=e?t.isAbsolute(e)?e:t.resolve(process.cwd(),e):void 0,y}let v,w="";try{require.resolve("@pnpm/filter-workspace-packages"),w="pnpm"}catch{}""!==w&&f.program.option("-f, --filter <filter>","filter packages");let j,k=!1;function $(e){try{return require.resolve(e),!0}catch(e){return!1}}const E=[process.env.JIEK_TS_REGISTER,"esbuild-register","@swc-node/register","ts-node/register"].filter(Boolean);for(const e of E)if($(e)){j=e;break}let b="jiek.config";var q=(e={})=>{const{onEvent:t}=e;return{name:"progress",buildStart:()=>t?.("start","Start building..."),buildEnd:()=>t?.("end","Build completed!"),resolveId:{order:"post",handler:e=>t?.("resolve",`Resolving ${e}...`)},load:{order:"post",handler:e=>t?.("load",`Loading ${e}...`)},transform:{order:"post",handler:(e,r)=>t?.("transform",`Transforming ${r}...`)}}},x=(e={})=>({name:"skip",load(t){if(e.patterns?.some((e=>"string"==typeof e?t.includes(e):e.test(t))))return""}});const{JIEK_ROOT:S,JIEK_ENTRIES:O}=process.env,I=S??o.getWorkspaceDir(),M={},C=[n()],F=function(r){const{wd:s}=function(){if(v)return{wd:v,notWorkspace:k};const e=h();if(void 0!==e){const t=o.isWorkspaceDir(e,w);return k=!t,v=e,{wd:v,notWorkspace:k}}try{v=o.getWorkspaceDir(w)}catch(t){if(!("message"in t)||"workspace root not found"!==t.message)throw t;v=e,k=!0}return{wd:v,notWorkspace:k}}();let n=f.program.getOptionValue("configPath");if(n){if(!e.existsSync(n))throw new Error(`config file not found: ${n}`);t.isAbsolute(n)||(n=t.resolve(s,n))}else n=function(r,s){const o=!!j;function n(o){const n=[t.resolve(process.cwd(),`${b}.${o}`),t.resolve(process.cwd(),`.${b}.${o}`),t.resolve(r,`${b}.${o}`),t.resolve(r,`.${b}.${o}`)];s&&n.unshift(t.resolve(s,`${b}.${o}`),t.resolve(s,`.${b}.${o}`));for(const t of n)if(e.existsSync(t)&&e.lstatSync(t).isFile())return t}return b=n("js")??b,b=n("json")??b,b=n("yaml")??b,o&&(b=n("ts")??b),t.resolve(r,b)}(s,r);const i=t.extname(n);let c;switch(i){case".js":c=require(n);break;case".json":return require(n);case".yaml":return m.load(e.readFileSync(n,"utf-8"));case".ts":if(j){require(j),c=require(n);break}throw new Error("ts config file is not supported without ts register, please install esbuild-register or set JIEK_TS_REGISTER env for custom ts register");case".config":c={};break;default:throw new Error(`unsupported config file type: ${i}`)}if(!c)throw new Error("config file is empty");return c.default??c}()??{},{build:R={}}=F,T=`./${t.relative(process.cwd(),t.resolve(("object"==typeof R?.output?.dir?R.output.dir.js:R?.output?.dir)??"dist"))}`,A=/\.(css|s[ac]ss|less|styl)$/,_=e=>t.resolve(I,e),D=e=>e.replace(/[@|/-](\w)/g,((e,t)=>t.toUpperCase())).replace(/(?:^|-)(\w)/g,((e,t)=>t.toUpperCase())),L=(e,t=R?.output?.minify)=>!1===t?[e]:"only-minify"===t?[{...e,file:e.file?.replace(/(\.[cm]?js)$/,".min$1"),plugins:[...e.plugins??[],c()]}]:[e,{...e,file:e.file?.replace(/(\.[cm]?js)$/,".min$1"),plugins:[...e.plugins??[],c()]}],W=r=>{r=t.resolve(r);const s=t.dirname(r),{extends:o,...n}=(i=r,e.existsSync(i)&&e.statSync(i).isFile()?u.parse(e.readFileSync(i,"utf-8"),[],{allowTrailingComma:!0,allowEmptyContent:!0}):{});var i;const c=(p=o?Array.isArray(o)?o:[o]:[],p?.map((e=>t.resolve(s,e)))??[]);var p;return 0===c.length?n:c.map(W).reduce(((e,{compilerOptions:t={},references:r,...s})=>({...e,...s,compilerOptions:{...e.compilerOptions,...t}})),n)},J=(e,r)=>{e=t.resolve(e),r=t.resolve(r);const s=t.dirname(e),o=W(e),[n,i,c,p]=[o.references?.map((({path:e})=>e)),o.files,o.include,o.exclude].map((e=>e?.map((e=>t.resolve(s,e)))??[]));if(p.length>0&&p.some((e=>a.isMatch(r,e))))return;if(0===o.files?.length&&0===o.include?.length)return;let u=!1;if(u||(u=i.length>0&&i.includes(r)),u||(u=c.length>0&&c.some((e=>a.isMatch(r,e)))),u)return o.compilerOptions??{};if(!(o.files&&o.files.length>0||o.include&&o.include.length>0)){n.reverse();for(const e of n){const t=J(e,r);if(t)return t}return o.compilerOptions}},K=({path:r,name:o,input:n,output:c,external:u,pkgIsModule:a,conditionals:f},m={})=>{const g=f.includes("import"),y=f.includes("require"),h=f.includes("browser");let v;[_("tsconfig.json"),_("tsconfig.dts.json")].forEach((t=>{e.existsSync(t)&&e.statSync(t).isFile()&&(v=t)}));let w={};if(v){const e=J(v,t.resolve(n)),{options:r,errors:s}=d.convertCompilerOptionsFromJson(e,t.dirname(v));if(s.length>0)throw new Error(s.map((e=>e.messageText)).join("\n"));w=r}const j=[...f,...w.customConditions??[]],k={type:"progress",data:{name:o,path:r,exportConditions:j,input:n}},$=m?.output?.dir;return[{input:n,external:u,output:[...L({file:c,name:o,sourcemap:"object"==typeof m?.output?.sourcemap?m.output.sourcemap.js:m?.output?.sourcemap,format:g?"esm":y?"cjs":h?"umd":a?"esm":"cjs",strict:"object"==typeof m?.output?.strict?m.output.strict.js:m?.output?.strict})],plugins:[i.nodeResolve({exportConditions:j}),import("rollup-plugin-postcss").then((({default:e})=>e({extract:t.resolve(c.replace(/\.[cm]?js$/,".css")),minimize:!0}))).catch((()=>{})),l(),q({onEvent:(e,t)=>p.sendMessage({...k,data:{...k.data,event:e,message:t,tags:["js"]}})})]},{input:n,external:u,output:[{dir:t.resolve(("object"==typeof $?$.dts:$)??"dist"),sourcemap:"object"==typeof m?.output?.sourcemap?m.output.sourcemap.dts:m?.output?.sourcemap,entryFileNames:()=>c.replace(`${T}/`,"").replace(/(\.[cm]?)js$/,".d$1ts"),strict:"object"==typeof m?.output?.strict?m.output.strict.dts:m?.output?.strict}],plugins:[i.nodeResolve({exportConditions:j}),x({patterns:[A]}),s.dts({respectExternal:!0,compilerOptions:w}),q({onEvent:(e,t)=>p.sendMessage({...k,data:{...k.data,event:e,message:t,tags:["dts"]}})})]}]};exports.template=function(s){const{name:o,type:n,exports:i}=s,c="module"===n;if(!o)throw new Error("package.json name is required");if(!i)throw new Error("package.json exports is required");const u=O?.split(",").map((e=>e.trim())).map((e=>({index:"."}[e]??e))),l=D(o),d=function(t=process.cwd()){const r="string"==typeof t?e.existsSync(`${t}/package.json`)?JSON.parse(e.readFileSync(`${t}/package.json`,"utf-8")):{}:t,{dependencies:s={},peerDependencies:o={},optionalDependencies:n={}}=r;return Object.keys(s).concat(Object.keys(o)).concat(Object.keys(n)).map((e=>new RegExp(`^${e}(/.*)?$`))).concat([/^node:/])}(s),[f,m]=function({entrypoints:e,pkgIsModule:s,entries:o,config:n,dir:i,noFilter:c}){const{build:p={}}=n??{},{crossModuleConvertor:u=!0}=p,l=`./${d=((...e)=>t.resolve(i??process.cwd(),...e))(("object"==typeof p?.output?.dir?p.output.dir.js:p?.output?.dir)??"dist"),t.relative(i??process.cwd(),d)}`;var d;const[,f]=r.resolveEntrypoints(e);o&&Object.entries(f).forEach((([e])=>{o.some((t=>a.isMatch(e,t,{matchBase:!0})))||delete f[e]}));const m=c?f:r.filterLeafs(f,{skipValue:[/(^|\/)\.jk-noentry/,...r.DEFAULT_SKIP_VALUES]}),y=u?{import:e=>!s&&0===g(new Set(e.conditionals),new Set(["import","module"])).size&&e.dist.replace(/\.js$/,".mjs"),require:e=>!(!s||0!==g(new Set(e.conditionals),new Set(["require","node"])).size)&&e.dist.replace(/\.js$/,".cjs")}:{};return[m,r.entrypoints2Exports(m,{outdir:l,withConditional:{...y}})]}({entrypoints:i,pkgIsModule:c,entries:u,config:F}),y=new Map;r.getAllLeafs(f,(({keys:e,value:t})=>{if("string"==typeof t){const r=y.get(t)??[];y.set(t,r),r.push(e)}return!1}));const h=[];return y.forEach(((e,t)=>e.forEach((e=>{const[s,...o]=e,n=l+("."===s?"":D(s)),i=((e,t)=>t.reduce(((e,t)=>{if("string"==typeof e)throw new Error("key not found in exports");if(!(t in e))throw new Error(`key ${t} not found in exports`);return e[t]}),e))(m,e),p={path:s,name:n,input:t,external:d,pkgIsModule:c};switch(typeof i){case"string":h.push(...K({...p,output:i,conditionals:o},R));break;case"object":r.getAllLeafs(i,(({keys:e,value:t})=>{const r=[...new Set([...o,...e])];return"string"==typeof t&&h.push(...K({...p,output:t,conditionals:r},R)),!1}))}})))),p.sendMessage({type:"init",data:{leafMap:y,targetsLength:h.length}}),h.map((e=>({...M,...e,plugins:[...C,e.plugins]})))};
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.min.js","sources":["../../src/utils/getRoot.ts","../../src/utils/filterSupport.ts","../../src/utils/getWD.ts","../../src/utils/tsRegister.ts","../../src/utils/loadConfig.ts","../../src/rollup/plugins/progress.ts","../../src/rollup/plugins/skip.ts","../../src/rollup/index.ts","../../src/rollup/utils/externalResolver.ts"],"sourcesContent":["import path from 'node:path'\n\nimport { program } from 'commander'\n\nlet root: string\nexport function getRoot() {\n if (root) return root\n\n const rootOption = program.getOptionValue('root')\n root = rootOption\n ? path.isAbsolute(rootOption)\n ? rootOption\n : path.resolve(process.cwd(), rootOption)\n : undefined\n return root\n}\n","import fs from 'node:fs'\nimport path from 'node:path'\n\nimport { filterPackagesFromDir } from '@pnpm/filter-workspace-packages'\nimport { program } from 'commander'\nimport { load } from 'js-yaml'\n\nimport { getRoot } from './getRoot'\nimport { getWD } from './getWD'\n\nexport let type = ''\n\ntry {\n require.resolve('@pnpm/filter-workspace-packages')\n type = 'pnpm'\n} catch { /* empty */ }\nif (type !== '') {\n program\n .option('-f, --filter <filter>', 'filter packages')\n}\n\ninterface ProjectsGraph {\n wd: string\n root: string\n value?: Record<string, {\n name?: string\n }>\n}\n\nexport async function getSelectedProjectsGraph(): Promise<ProjectsGraph> {\n let filter = program.getOptionValue('filter')\n const root = getRoot()\n const { wd, notWorkspace } = getWD()\n if (!notWorkspace && type === 'pnpm') {\n const pnpmWorkspaceFilePath = path.resolve(wd, 'pnpm-workspace.yaml')\n const pnpmWorkspaceFileContent = fs.readFileSync(pnpmWorkspaceFilePath, 'utf-8')\n const pnpmWorkspace = load(pnpmWorkspaceFileContent) as {\n packages: string[]\n }\n if (root === wd && !filter) {\n throw new Error('root path is workspace root, please provide a filter')\n // TODO inquirer prompt support user select packages\n }\n if (root !== wd && !filter) {\n const packageJSONIsExist = fs.existsSync(path.resolve(root, 'package.json'))\n if (!packageJSONIsExist) {\n throw new Error('root path is not workspace root, please provide a filter')\n }\n const packageJSON = JSON.parse(fs.readFileSync(path.resolve(root, 'package.json'), 'utf-8'))\n if (!packageJSON.name) {\n throw new Error('root path is not workspace root, please provide a filter')\n }\n filter = packageJSON.name\n }\n const { selectedProjectsGraph } = await filterPackagesFromDir(wd, [{\n filter: filter ?? '',\n followProdDepsOnly: true\n }], {\n prefix: root,\n workspaceDir: wd,\n patterns: pnpmWorkspace.packages\n })\n return {\n wd,\n root,\n value: Object.entries(selectedProjectsGraph)\n .reduce((acc, [key, value]) => {\n acc[key] = value.package.manifest\n return acc\n }, {} as NonNullable<ProjectsGraph['value']>)\n }\n }\n return {\n wd,\n root,\n value: {\n [wd]: JSON.parse(fs.readFileSync(path.resolve(wd, 'package.json'), 'utf-8'))\n }\n }\n}\n","import { getWorkspaceDir, isWorkspaceDir } from '@jiek/utils/getWorkspaceDir'\n\nimport { type } from './filterSupport'\nimport { getRoot } from './getRoot'\n\nlet wd: string\nlet notWorkspace = false\n\nexport function getWD() {\n if (wd) return { wd, notWorkspace }\n\n const root = getRoot()\n if (root !== undefined) {\n const isWorkspace = isWorkspaceDir(root, type)\n notWorkspace = !isWorkspace\n wd = root\n return { wd, notWorkspace }\n }\n try {\n wd = getWorkspaceDir(type)\n } catch (e) {\n // @ts-ignore\n if ('message' in e && e.message === 'workspace root not found') {\n wd = root\n notWorkspace = true\n } else {\n throw e\n }\n }\n return { wd, notWorkspace }\n}\n","function packageIsExist(name: string) {\n try {\n require.resolve(name)\n return true\n } catch (e) {\n return false\n }\n}\n\nexport let tsRegisterName: string | undefined\nconst registers = [\n process.env.JIEK_TS_REGISTER,\n 'esbuild-register',\n '@swc-node/register',\n 'ts-node/register'\n].filter(Boolean) as string[]\nfor (const register of registers) {\n if (packageIsExist(register)) {\n tsRegisterName = register\n break\n }\n}\n","import fs from 'node:fs'\nimport path from 'node:path'\n\nimport { program } from 'commander'\nimport type { Config } from 'jiek'\nimport { load } from 'js-yaml'\n\nimport { getWD } from './getWD'\nimport { tsRegisterName } from './tsRegister'\n\nlet configName = 'jiek.config'\n\nfunction getConfigPath(root: string) {\n const isSupportTsLoader = !!tsRegisterName\n function configWithExtIsExist(ext: string) {\n const filenames = [\n path.resolve(process.cwd(), `${configName}.${ext}`),\n path.resolve(process.cwd(), `.${configName}.${ext}`),\n path.resolve(root, `${configName}.${ext}`),\n path.resolve(root, `.${configName}.${ext}`)\n ]\n for (const filename of filenames) {\n if (\n fs.existsSync(filename)\n && fs.lstatSync(filename)\n .isFile()\n ) {\n return filename\n }\n }\n return\n }\n configName = configWithExtIsExist('js') ?? configName\n configName = configWithExtIsExist('json') ?? configName\n configName = configWithExtIsExist('yaml') ?? configName\n if (isSupportTsLoader) {\n configName = configWithExtIsExist('ts') ?? configName\n }\n return path.resolve(root, configName)\n}\n\nexport function loadConfig(): Config {\n const { wd: root, notWorkspace } = getWD()\n if (notWorkspace) {\n throw new Error('not in workspace')\n }\n\n let configPath = program.getOptionValue('configPath')\n\n if (!configPath) {\n configPath = getConfigPath(root)\n } else {\n if (!fs.existsSync(configPath)) {\n throw new Error(`config file not found: ${configPath}`)\n }\n if (!path.isAbsolute(configPath)) {\n configPath = path.resolve(root, configPath)\n }\n }\n const ext = path.extname(configPath)\n\n let module: any\n switch (ext) {\n case '.js':\n module = require(configPath)\n break\n case '.json':\n return require(configPath)\n case '.yaml':\n return load(fs.readFileSync(configPath, 'utf-8')) as Config\n case '.ts':\n if (tsRegisterName) {\n require(tsRegisterName)\n module = require(configPath)\n break\n }\n throw new Error(\n 'ts config file is not supported without ts register, '\n + 'please install esbuild-register or set JIEK_TS_REGISTER env for custom ts register'\n )\n case '.config':\n module = {}\n break\n default:\n throw new Error(`unsupported config file type: ${ext}`)\n }\n if (!module) throw new Error('config file is empty')\n\n return module.default ?? module\n}\n","import type { PluginImpl } from 'rollup'\n\ninterface Options {\n onEvent?: (event: string, message?: string) => void\n}\n\nexport default ((options = {}) => {\n const { onEvent } = options\n return {\n name: 'progress',\n buildStart: () => onEvent?.('start', 'Start building...'),\n buildEnd: () => onEvent?.('end', 'Build completed!'),\n resolveId: {\n order: 'post',\n handler: source => onEvent?.('resolve', `Resolving ${source}...`)\n },\n load: {\n order: 'post',\n handler: id => onEvent?.('load', `Loading ${id}...`)\n },\n transform: {\n order: 'post',\n handler: (_, id) => onEvent?.('transform', `Transforming ${id}...`)\n }\n }\n}) as PluginImpl<Options>\n","import type { PluginImpl } from 'rollup'\n\ninterface Options {\n patterns?: (string | RegExp)[]\n}\n\nexport default ((options = {}) => {\n return {\n name: 'skip',\n // skip the specified files by `options.patterns`\n load(id) {\n if (\n options.patterns?.some((pattern) =>\n typeof pattern === 'string'\n ? id.includes(pattern)\n : pattern.test(id)\n )\n ) {\n return ''\n }\n }\n }\n}) as PluginImpl<Options>\n","import '../rollup/base'\n\nimport fs from 'node:fs'\nimport { dirname, resolve } from 'node:path'\n\nimport type { Entrypoints2ExportsOptions, RecursiveRecord } from '@jiek/pkger/entrypoints'\nimport {\n DEFAULT_SKIP_VALUES,\n entrypoints2Exports,\n filterLeafs,\n getAllLeafs,\n resolveEntrypoints\n} from '@jiek/pkger/entrypoints'\nimport { dts } from '@jiek/rollup-plugin-dts'\nimport { getWorkspaceDir } from '@jiek/utils/getWorkspaceDir'\nimport json from '@rollup/plugin-json'\nimport { nodeResolve } from '@rollup/plugin-node-resolve'\nimport terser from '@rollup/plugin-terser'\nimport { sendMessage } from 'execa'\nimport { parse } from 'jsonc-parser'\nimport { isMatch } from 'micromatch'\nimport type { OutputOptions, OutputPlugin, RollupOptions } from 'rollup'\nimport esbuild from 'rollup-plugin-esbuild'\nimport ts from 'typescript'\n\nimport { loadConfig } from '../utils/loadConfig'\nimport type { RollupProgressEvent, TemplateOptions } from './base'\nimport progress from './plugins/progress'\nimport skip from './plugins/skip'\nimport externalResolver from './utils/externalResolver'\n\ninterface PackageJSON {\n name?: string\n type?: string\n exports?: Record<string, unknown> | string | string[]\n}\n\nconst {\n JIEK_ROOT,\n JIEK_ENTRIES\n} = process.env\nconst WORKSPACE_ROOT = JIEK_ROOT ?? getWorkspaceDir()\nconst COMMON_OPTIONS = {} satisfies RollupOptions\nconst COMMON_PLUGINS = [\n json()\n]\n\nconst { build } = loadConfig()\nconst jsOutdir = resolve(\n (\n typeof build?.output?.dir === 'object'\n // the outdir only effect js output in this function\n ? build.output.dir.js\n : build?.output?.dir\n ) ?? 'dist'\n)\n\nconst STYLE_REGEXP = /\\.(css|s[ac]ss|less|styl)$/\n\n// eslint-disable-next-line unused-imports/no-unused-vars\nconst debug = (...args: unknown[]) => sendMessage({ type: 'debug', data: args } satisfies RollupProgressEvent)\n\nconst resolveWorkspacePath = (p: string) => resolve(WORKSPACE_ROOT, p)\n\nconst intersection = <T>(a: Set<T>, b: Set<T>) => new Set([...a].filter(i => b.has(i)))\n\nconst pascalCase = (str: string) =>\n str\n .replace(/[@|/-](\\w)/g, (_, $1) => $1.toUpperCase())\n .replace(/(?:^|-)(\\w)/g, (_, $1) => $1.toUpperCase())\n\nconst reveal = (obj: string | Record<string, unknown>, keys: string[]) =>\n keys.reduce((acc, key) => {\n if (typeof acc === 'string') throw new Error('key not found in exports')\n if (!(key in acc)) throw new Error(`key ${key} not found in exports`)\n return acc[key] as string | Record<string, unknown>\n }, obj)\n\nconst withMinify = (\n output: OutputOptions & {\n plugins?: OutputPlugin[]\n },\n minify = build?.output?.minify\n) =>\n minify === false\n ? [output]\n : minify === 'only-minify'\n ? [{\n ...output,\n // TODO replace suffix when pubish to npm and the `build.output.minify` is 'only-minify'\n // TODO resolve dts output file name\n file: output.file?.replace(/(\\.[cm]?js)$/, '.min$1'),\n plugins: [\n ...(output.plugins ?? []),\n terser()\n ]\n }]\n : [\n output,\n {\n ...output,\n file: output.file?.replace(/(\\.[cm]?js)$/, '.min$1'),\n plugins: [\n ...(output.plugins ?? []),\n terser()\n ]\n }\n ]\n\ntype TSConfig = {\n extends?: string | string[]\n compilerOptions?: Record<string, unknown>\n references?: { path: string }[]\n files?: string[]\n include?: string[]\n exclude?: string[]\n}\n\nconst getTSConfig = (p: string): TSConfig =>\n !fs.existsSync(p) || !fs.statSync(p).isFile()\n ? {}\n : parse(fs.readFileSync(p, 'utf-8'), [], { allowTrailingComma: true, allowEmptyContent: true })\n\nconst getExtendTSConfig = (tsconfigPath: string): TSConfig => {\n tsconfigPath = resolve(tsconfigPath)\n const tsconfigPathDirname = dirname(tsconfigPath)\n const { extends: exts, ...tsconfig } = getTSConfig(tsconfigPath)\n const resolvePaths = (paths: string[] | undefined) => paths?.map(p => resolve(tsconfigPathDirname, p)) ?? []\n\n const extendsPaths = resolvePaths(\n exts ? Array.isArray(exts) ? exts : [exts] : []\n )\n if (extendsPaths.length === 0) return tsconfig\n return extendsPaths\n .map(getExtendTSConfig)\n // https://www.typescriptlang.org/tsconfig/#files:~:text=Currently%2C%20the%20only%20top%2Dlevel%20property%20that%20is%20excluded%20from%20inheritance%20is%20references.\n // Currently, the only top-level property that is excluded from inheritance is references.\n .reduce((acc, { compilerOptions = {}, references: _, ...curr }) => ({\n ...acc,\n ...curr,\n compilerOptions: {\n ...acc.compilerOptions,\n ...compilerOptions\n }\n }), tsconfig)\n}\n\nconst getCompilerOptionsByFilePath = (tsconfigPath: string, filePath: string): Record<string, unknown> | undefined => {\n tsconfigPath = resolve(tsconfigPath)\n filePath = resolve(filePath)\n const tsconfigPathDirname = dirname(tsconfigPath)\n // https://www.typescriptlang.org/tsconfig/#files:~:text=It%E2%80%99s%20worth%20noting%20that%20files%2C%20include%2C%20and%20exclude%20from%20the%20inheriting%20config%20file%20overwrite%20those%20from%20the%20base%20config%20file%2C%20and%20that%20circularity%20between%20configuration%20files%20is%20not%20allowed.\n // It’s worth noting that files, include, and exclude from the inheriting config file overwrite\n // those from the base config file, and that circularity between configuration files is not allowed.\n const tsconfig = getExtendTSConfig(tsconfigPath)\n\n const resolvePaths = (paths: string[] | undefined) => paths?.map(p => resolve(tsconfigPathDirname, p)) ?? []\n\n const [\n references,\n files,\n include,\n exclude\n ] = [\n tsconfig.references?.map(({ path }) => path),\n tsconfig.files,\n tsconfig.include,\n tsconfig.exclude\n ].map(resolvePaths)\n if (exclude.length > 0 && exclude.some(i => isMatch(filePath, i))) return\n\n // when files or include is not empty, the tsconfig should be ignored\n if (tsconfig.files?.length === 0 && tsconfig.include?.length === 0) return\n let isInclude = false\n isInclude ||= files.length > 0 && files.includes(filePath)\n isInclude ||= include.length > 0 && include.some(i => isMatch(filePath, i))\n if (isInclude) {\n return tsconfig.compilerOptions ?? {}\n } else {\n // when files or include is not empty, but the file is not matched, the tsconfig should be ignored\n if (\n (tsconfig.files && tsconfig.files.length > 0)\n || (tsconfig.include && tsconfig.include.length > 0)\n ) return\n }\n\n references.reverse()\n for (const ref of references) {\n const compilerOptions = getCompilerOptionsByFilePath(ref, filePath)\n if (compilerOptions) return compilerOptions\n }\n return tsconfig.compilerOptions\n}\n\nconst generateConfigs = ({\n path,\n name,\n input,\n output,\n external,\n pkgIsModule,\n conditionals\n}: {\n path: string\n name: string\n input: string\n output: string\n external: (string | RegExp)[]\n pkgIsModule: boolean\n conditionals: string[]\n}, options: TemplateOptions = {}): RollupOptions[] => {\n const isModule = conditionals.includes('import')\n const isCommonJS = conditionals.includes('require')\n const isBrowser = conditionals.includes('browser')\n const dtsTSConfigPaths = [\n resolveWorkspacePath('tsconfig.json'),\n resolveWorkspacePath('tsconfig.dts.json')\n ]\n let dtsTSConfigPath: string | undefined\n dtsTSConfigPaths.forEach(p => {\n if (fs.existsSync(p) && fs.statSync(p).isFile()) {\n dtsTSConfigPath = p\n }\n })\n let compilerOptions: ts.CompilerOptions = {}\n if (dtsTSConfigPath) {\n const jsonCompilerOptions = getCompilerOptionsByFilePath(dtsTSConfigPath, resolve(input))\n const { options, errors } = ts.convertCompilerOptionsFromJson(\n jsonCompilerOptions,\n dirname(dtsTSConfigPath)\n )\n if (errors.length > 0) {\n throw new Error(errors.map(e => e.messageText).join('\\n'))\n }\n compilerOptions = options\n }\n const exportConditions = [...conditionals, ...(compilerOptions.customConditions ?? [])]\n const throughEventProps: RollupProgressEvent & { type: 'progress' } = {\n type: 'progress',\n data: { name, path, exportConditions, input }\n }\n const outdir = options?.output?.dir\n return [\n {\n input,\n external,\n output: [\n ...withMinify({\n file: output,\n name,\n sourcemap: typeof options?.output?.sourcemap === 'object'\n ? options.output.sourcemap.js\n : options?.output?.sourcemap ?? true,\n format: isModule ? 'esm' : (\n isCommonJS ? 'cjs' : (\n isBrowser ? 'umd' : (\n pkgIsModule ? 'esm' : 'cjs'\n )\n )\n ),\n strict: typeof options?.output?.strict === 'object'\n ? options.output.strict.js\n : options?.output?.strict\n })\n ],\n plugins: [\n nodeResolve({ exportConditions }),\n import('rollup-plugin-postcss')\n .then(({ default: postcss }) =>\n postcss({\n extract: resolve(output.replace(/\\.[cm]?js$/, '.css')),\n minimize: true\n })\n )\n .catch(() => void 0),\n esbuild(),\n progress({\n onEvent: (event, message) =>\n sendMessage(\n {\n ...throughEventProps,\n data: { ...throughEventProps.data, event, message, tags: ['js'] }\n } satisfies RollupProgressEvent\n )\n })\n ]\n },\n {\n input,\n external,\n output: [\n {\n dir: resolve((typeof outdir === 'object' ? outdir.dts : outdir) ?? 'dist'),\n sourcemap: typeof options?.output?.sourcemap === 'object'\n ? options.output.sourcemap.dts\n : options?.output?.sourcemap ?? true,\n entryFileNames: () =>\n output\n .replace(`${jsOutdir}/`, '')\n .replace(/(\\.[cm]?)js$/, '.d$1ts'),\n strict: typeof options?.output?.strict === 'object'\n ? options.output.strict.dts\n : options?.output?.strict\n }\n ],\n plugins: [\n nodeResolve({ exportConditions }),\n skip({ patterns: [STYLE_REGEXP] }),\n dts({\n respectExternal: true,\n compilerOptions\n }),\n progress({\n onEvent: (event, message) =>\n sendMessage(\n {\n ...throughEventProps,\n data: { ...throughEventProps.data, event, message, tags: ['dts'] }\n } satisfies RollupProgressEvent\n )\n })\n ]\n }\n ]\n}\n\nexport function template(packageJSON: PackageJSON): RollupOptions[] {\n const { name, type, exports: entrypoints } = packageJSON\n const pkgIsModule = type === 'module'\n if (!name) throw new Error('package.json name is required')\n if (!entrypoints) throw new Error('package.json exports is required')\n\n const entries = JIEK_ENTRIES\n ?.split(',')\n .map(e => e.trim())\n .map(e => ({\n 'index': '.'\n }[e] ?? e))\n\n const {\n crossModuleConvertor = true\n } = build ?? {}\n\n const packageName = pascalCase(name)\n\n const external = externalResolver(packageJSON as Record<string, unknown>)\n\n const [, resolvedEntrypoints] = resolveEntrypoints(entrypoints)\n if (entries) {\n Object\n .entries(resolvedEntrypoints)\n .forEach(([key]) => {\n if (!entries.some(e => isMatch(key, e, { matchBase: true }))) {\n delete resolvedEntrypoints[key]\n }\n })\n }\n const filteredResolvedEntrypoints = filterLeafs(\n resolvedEntrypoints as RecursiveRecord<string>,\n {\n skipValue: [\n // ignore values that filename starts with `.jk-noentry`\n /(^|\\/)\\.jk-noentry/,\n ...DEFAULT_SKIP_VALUES\n ]\n }\n )\n const crossModuleWithConditional: Entrypoints2ExportsOptions['withConditional'] = crossModuleConvertor\n ? {\n import: opts =>\n !pkgIsModule && intersection(\n new Set(opts.conditionals),\n new Set(['import', 'module'])\n ).size === 0\n ? opts.dist.replace(/\\.js$/, '.mjs')\n : false,\n require: opts => {\n return pkgIsModule && intersection(\n new Set(opts.conditionals),\n new Set(['require', 'node'])\n ).size === 0\n ? opts.dist.replace(/\\.js$/, '.cjs')\n : false\n }\n }\n : {}\n const exports = entrypoints2Exports(filteredResolvedEntrypoints, {\n outdir: jsOutdir,\n withConditional: {\n ...crossModuleWithConditional\n }\n })\n\n const leafMap = new Map<string, string[][]>()\n getAllLeafs(filteredResolvedEntrypoints as RecursiveRecord<string>, ({ keys, value }) => {\n if (typeof value === 'string') {\n const keysArr = leafMap.get(value) ?? []\n leafMap.set(value, keysArr)\n keysArr.push(keys)\n }\n return false\n })\n\n const configs: RollupOptions[] = []\n leafMap.forEach((keysArr, input) =>\n keysArr.forEach((keys) => {\n const [path, ...conditionals] = keys\n\n const name = packageName + (path === '.' ? '' : pascalCase(path))\n const keyExports = reveal(exports, keys)\n const commonOptions = {\n path,\n name,\n input,\n external,\n pkgIsModule\n }\n\n switch (typeof keyExports) {\n case 'string': {\n configs.push(...generateConfigs({\n ...commonOptions,\n output: keyExports,\n conditionals\n }, build))\n break\n }\n case 'object': {\n getAllLeafs(keyExports as RecursiveRecord<string>, ({ keys: nextKeys, value }) => {\n const allConditionals = [...new Set([...conditionals, ...nextKeys])]\n if (typeof value === 'string') {\n configs.push(...generateConfigs({\n ...commonOptions,\n output: value,\n conditionals: allConditionals\n }, build))\n }\n return false\n })\n break\n }\n }\n })\n )\n sendMessage(\n {\n type: 'init',\n data: {\n leafMap,\n targetsLength: configs.length\n }\n } satisfies RollupProgressEvent\n )\n return configs.map(c => ({\n ...COMMON_OPTIONS,\n ...c,\n plugins: [\n ...COMMON_PLUGINS,\n c.plugins\n ]\n }))\n}\n","import fs from 'node:fs'\n\nexport default function(json: Record<string, unknown>): (string | RegExp)[]\nexport default function(path?: string): (string | RegExp)[]\nexport default function(jsonOrPath: string | Record<string, unknown> = process.cwd()): (string | RegExp)[] {\n const pkg = typeof jsonOrPath === 'string'\n ? fs.existsSync(`${jsonOrPath}/package.json`)\n ? JSON.parse(fs.readFileSync(`${jsonOrPath}/package.json`, 'utf-8'))\n : {}\n : jsonOrPath\n const { dependencies = {}, peerDependencies = {}, optionalDependencies = {} } = pkg\n const external = <(string | RegExp)[]> Object\n .keys(dependencies)\n .concat(Object.keys(peerDependencies))\n .concat(Object.keys(optionalDependencies))\n return external\n .map(dep => new RegExp(`^${dep}(/.*)?$`))\n .concat([\n /^node:/\n ])\n}\n"],"names":["root","getRoot","rootOption","program","getOptionValue","path","isAbsolute","resolve","process","cwd","wd","type","require","option","tsRegisterName","notWorkspace","getWD","isWorkspace","isWorkspaceDir","getWorkspaceDir","e","message","packageIsExist","name","registers","env","JIEK_TS_REGISTER","filter","Boolean","register","configName","progress","options","onEvent","buildStart","buildEnd","resolveId","order","handler","source","load","id","transform","_","skip","patterns","some","pattern","includes","test","JIEK_ROOT","JIEK_ENTRIES","WORKSPACE_ROOT","COMMON_OPTIONS","COMMON_PLUGINS","json","build","Error","configPath","fs","existsSync","isSupportTsLoader","configWithExtIsExist","ext","filenames","filename","lstatSync","isFile","getConfigPath","extname","module","readFileSync","default","loadConfig","jsOutdir","output","dir","js","STYLE_REGEXP","resolveWorkspacePath","p","intersection","a","b","Set","i","has","pascalCase","str","replace","$1","toUpperCase","withMinify","minify","file","plugins","terser","getExtendTSConfig","tsconfigPath","tsconfigPathDirname","dirname","extends","exts","tsconfig","statSync","parse","allowTrailingComma","allowEmptyContent","extendsPaths","paths","Array","isArray","map","length","reduce","acc","compilerOptions","references","curr","getCompilerOptionsByFilePath","filePath","files","include","exclude","isMatch","isInclude","reverse","ref","generateConfigs","input","external","pkgIsModule","conditionals","isModule","isCommonJS","isBrowser","dtsTSConfigPath","forEach","jsonCompilerOptions","errors","ts","convertCompilerOptionsFromJson","messageText","join","exportConditions","customConditions","throughEventProps","data","outdir","sourcemap","format","strict","nodeResolve","import","then","postcss","extract","minimize","catch","esbuild","event","sendMessage","tags","dts","entryFileNames","respectExternal","packageJSON","exports","entrypoints","entries","split","trim","index","crossModuleConvertor","packageName","jsonOrPath","pkg","JSON","dependencies","peerDependencies","optionalDependencies","Object","keys","concat","dep","RegExp","externalResolver","resolvedEntrypoints","resolveEntrypoints","key","matchBase","filteredResolvedEntrypoints","filterLeafs","skipValue","DEFAULT_SKIP_VALUES","crossModuleWithConditional","opts","size","dist","entrypoints2Exports","withConditional","leafMap","Map","getAllLeafs","value","keysArr","get","set","push","configs","keyExports","obj","reveal","commonOptions","nextKeys","allConditionals","targetsLength","c"],"mappings":"ycAIA,IAAIA,EACG,SAASC,IACV,GAAAD,EAAa,OAAAA,EAEX,MAAAE,EAAaC,EAAAA,QAAQC,eAAe,QAMnC,OALPJ,EAAOE,EACHG,EAAKC,WAAWJ,GACdA,EACAG,EAAKE,QAAQC,QAAQC,MAAOP,QAC9B,EACGF,CACT,4CCLO,ICLHU,EDKOC,EAAO,GAElB,IACEC,QAAQL,QAAQ,mCACTI,EAAA,MACT,CAAQ,MAAc,CACT,KAATA,GAECR,EAAAA,QAAAU,OAAO,wBAAyB,mBCZrC,ICGWC,EDHPC,GAAe,EAEZ,SAASC,IACV,GAAAN,EAAW,MAAA,CAAEA,KAAIK,gBAErB,MAAMf,EAAOC,IACb,QAAa,IAATD,EAAoB,CAChB,MAAAiB,EAAcC,EAAAA,eAAelB,EAAMW,GAGlC,OAFPI,GAAgBE,EACXP,EAAAV,EACE,CAAEU,KAAIK,eACf,CACI,IACFL,EAAKS,EAAAA,gBAAgBR,SACdS,GAEP,KAAI,YAAaA,IAAmB,6BAAdA,EAAEC,QAIhB,MAAAD,EAHDV,EAAAV,EACUe,GAAA,CAInB,CACO,MAAA,CAAEL,KAA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AWlF,IACrD6M,EAlVG,EAACC,EAAuC7B,IACrDA,EAAKpE,QAAO,CAACC,EAAK0E,KAChB,GAAmB,iBAAR1E,EAAwB,MAAA,IAAI1D,MAAM,4BAC7C,KAAMoI,KAAO1E,GAAM,MAAM,IAAI1D,MAAM,OAAOoI,0BAC1C,OAAO1E,EAAI0E,EAAG,GACbsB,GA6UoBC,CAAO7C,EAASe,GAC7B+B,EAAgB,CACpBhN,OACAkB,KAAAA,EACA0G,QACAC,WACAC,eAGF,cAAe+E,GACb,IAAK,SACKD,EAAAD,QAAQhF,EAAgB,IAC3BqF,EACH1I,OAAQuI,EACR9E,gBACC5E,IACH,MAEF,IAAK,SACHmJ,EAAAA,YAAYO,GAAuC,EAAG5B,KAAMgC,EAAUV,YAC9D,MAAAW,EAAkB,IAAQ,IAAAnI,IAAI,IAAIgD,KAAiBkF,KAQlD,MAPc,iBAAVV,GACDK,EAAAD,QAAQhF,EAAgB,IAC3BqF,EACH1I,OAAQiI,EACRxE,aAAcmF,GACb/J,KAEE,CAAA,IAIb,MAGJyG,EAAAA,YACE,CACEtJ,KAAM,OACNwI,KAAM,CACJsD,UACAe,cAAeP,EAAQhG,UAItBgG,EAAQjG,KAAUyG,IAAA,IACpBpK,KACAoK,EACH1H,QAAS,IACJzC,EACHmK,EAAE1H,YAGR"}
|
@@ -0,0 +1 @@
|
|
1
|
+
import e from"node:fs";import t,{resolve as r,relative as o,dirname as s}from"node:path";import{resolveEntrypoints as n,filterLeafs as i,DEFAULT_SKIP_VALUES as p,entrypoints2Exports as c,getAllLeafs as u}from"@jiek/pkger/entrypoints";import{dts as l}from"@jiek/rollup-plugin-dts";import{isWorkspaceDir as a,getWorkspaceDir as f}from"@jiek/utils/getWorkspaceDir";import d from"@rollup/plugin-json";import{nodeResolve as m}from"@rollup/plugin-node-resolve";import g from"@rollup/plugin-terser";import{sendMessage as y}from"execa";import{parse as w}from"jsonc-parser";import{isMatch as h}from"micromatch";import j from"rollup-plugin-esbuild";import k from"typescript";import{program as $}from"commander";import{load as v}from"js-yaml";import"@pnpm/filter-workspace-packages";const E=(e,t)=>new Set([...e].filter((e=>t.has(e))));let b;function x(){if(b)return b;const e=$.getOptionValue("root");return b=e?t.isAbsolute(e)?e:t.resolve(process.cwd(),e):void 0,b}let S,O="";try{require.resolve("@pnpm/filter-workspace-packages"),O="pnpm"}catch{}""!==O&&$.option("-f, --filter <filter>","filter packages");let I,q=!1;function C(e){try{return require.resolve(e),!0}catch(e){return!1}}const F=[process.env.JIEK_TS_REGISTER,"esbuild-register","@swc-node/register","ts-node/register"].filter(Boolean);for(const e of F)if(C(e)){I=e;break}let T="jiek.config";var R=(e={})=>{const{onEvent:t}=e;return{name:"progress",buildStart:()=>t?.("start","Start building..."),buildEnd:()=>t?.("end","Build completed!"),resolveId:{order:"post",handler:e=>t?.("resolve",`Resolving ${e}...`)},load:{order:"post",handler:e=>t?.("load",`Loading ${e}...`)},transform:{order:"post",handler:(e,r)=>t?.("transform",`Transforming ${r}...`)}}},M=(e={})=>({name:"skip",load(t){if(e.patterns?.some((e=>"string"==typeof e?t.includes(e):e.test(t))))return""}});const{JIEK_ROOT:J,JIEK_ENTRIES:_}=process.env,A=J??f(),K={},W=[d()],z=function(r){const{wd:o}=function(){if(S)return{wd:S,notWorkspace:q};const e=x();if(void 0!==e){const t=a(e,O);return q=!t,S=e,{wd:S,notWorkspace:q}}try{S=f(O)}catch(t){if(!("message"in t)||"workspace root not found"!==t.message)throw t;S=e,q=!0}return{wd:S,notWorkspace:q}}();let s=$.getOptionValue("configPath");if(s){if(!e.existsSync(s))throw new Error(`config file not found: ${s}`);t.isAbsolute(s)||(s=t.resolve(o,s))}else s=function(r,o){const s=!!I;function n(s){const n=[t.resolve(process.cwd(),`${T}.${s}`),t.resolve(process.cwd(),`.${T}.${s}`),t.resolve(r,`${T}.${s}`),t.resolve(r,`.${T}.${s}`)];o&&n.unshift(t.resolve(o,`${T}.${s}`),t.resolve(o,`.${T}.${s}`));for(const t of n)if(e.existsSync(t)&&e.lstatSync(t).isFile())return t}return T=n("js")??T,T=n("json")??T,T=n("yaml")??T,s&&(T=n("ts")??T),t.resolve(r,T)}(o,r);const n=t.extname(s);let i;switch(n){case".js":i=require(s);break;case".json":return require(s);case".yaml":return v(e.readFileSync(s,"utf-8"));case".ts":if(I){require(I),i=require(s);break}throw new Error("ts config file is not supported without ts register, please install esbuild-register or set JIEK_TS_REGISTER env for custom ts register");case".config":i={};break;default:throw new Error(`unsupported config file type: ${n}`)}if(!i)throw new Error("config file is empty");return i.default??i}()??{},{build:B={}}=z,D=`./${o(process.cwd(),r(("object"==typeof B?.output?.dir?B.output.dir.js:B?.output?.dir)??"dist"))}`,N=/\.(css|s[ac]ss|less|styl)$/,V=e=>r(A,e),G=e=>e.replace(/[@|/-](\w)/g,((e,t)=>t.toUpperCase())).replace(/(?:^|-)(\w)/g,((e,t)=>t.toUpperCase())),L=(e,t=B?.output?.minify)=>!1===t?[e]:"only-minify"===t?[{...e,file:e.file?.replace(/(\.[cm]?js)$/,".min$1"),plugins:[...e.plugins??[],g()]}]:[e,{...e,file:e.file?.replace(/(\.[cm]?js)$/,".min$1"),plugins:[...e.plugins??[],g()]}],U=t=>{t=r(t);const o=s(t),{extends:n,...i}=(p=t,e.existsSync(p)&&e.statSync(p).isFile()?w(e.readFileSync(p,"utf-8"),[],{allowTrailingComma:!0,allowEmptyContent:!0}):{});var p;const c=(u=n?Array.isArray(n)?n:[n]:[],u?.map((e=>r(o,e)))??[]);var u;return 0===c.length?i:c.map(U).reduce(((e,{compilerOptions:t={},references:r,...o})=>({...e,...o,compilerOptions:{...e.compilerOptions,...t}})),i)},P=(e,t)=>{e=r(e),t=r(t);const o=s(e),n=U(e),[i,p,c,u]=[n.references?.map((({path:e})=>e)),n.files,n.include,n.exclude].map((e=>e?.map((e=>r(o,e)))??[]));if(u.length>0&&u.some((e=>h(t,e))))return;if(0===n.files?.length&&0===n.include?.length)return;let l=!1;if(l||(l=p.length>0&&p.includes(t)),l||(l=c.length>0&&c.some((e=>h(t,e)))),l)return n.compilerOptions??{};if(!(n.files&&n.files.length>0||n.include&&n.include.length>0)){i.reverse();for(const e of i){const r=P(e,t);if(r)return r}return n.compilerOptions}},H=({path:t,name:o,input:n,output:i,external:p,pkgIsModule:c,conditionals:u},a={})=>{const f=u.includes("import"),d=u.includes("require"),g=u.includes("browser");let w;[V("tsconfig.json"),V("tsconfig.dts.json")].forEach((t=>{e.existsSync(t)&&e.statSync(t).isFile()&&(w=t)}));let h={};if(w){const e=P(w,r(n)),{options:t,errors:o}=k.convertCompilerOptionsFromJson(e,s(w));if(o.length>0)throw new Error(o.map((e=>e.messageText)).join("\n"));h=t}const $=[...u,...h.customConditions??[]],v={type:"progress",data:{name:o,path:t,exportConditions:$,input:n}},E=a?.output?.dir;return[{input:n,external:p,output:[...L({file:i,name:o,sourcemap:"object"==typeof a?.output?.sourcemap?a.output.sourcemap.js:a?.output?.sourcemap,format:f?"esm":d?"cjs":g?"umd":c?"esm":"cjs",strict:"object"==typeof a?.output?.strict?a.output.strict.js:a?.output?.strict})],plugins:[m({exportConditions:$}),import("rollup-plugin-postcss").then((({default:e})=>e({extract:r(i.replace(/\.[cm]?js$/,".css")),minimize:!0}))).catch((()=>{})),j(),R({onEvent:(e,t)=>y({...v,data:{...v.data,event:e,message:t,tags:["js"]}})})]},{input:n,external:p,output:[{dir:r(("object"==typeof E?E.dts:E)??"dist"),sourcemap:"object"==typeof a?.output?.sourcemap?a.output.sourcemap.dts:a?.output?.sourcemap,entryFileNames:()=>i.replace(`${D}/`,"").replace(/(\.[cm]?)js$/,".d$1ts"),strict:"object"==typeof a?.output?.strict?a.output.strict.dts:a?.output?.strict}],plugins:[m({exportConditions:$}),M({patterns:[N]}),l({respectExternal:!0,compilerOptions:h}),R({onEvent:(e,t)=>y({...v,data:{...v.data,event:e,message:t,tags:["dts"]}})})]}]};function Q(t){const{name:s,type:l,exports:a}=t,f="module"===l;if(!s)throw new Error("package.json name is required");if(!a)throw new Error("package.json exports is required");const d=_?.split(",").map((e=>e.trim())).map((e=>({index:"."}[e]??e))),m=G(s),g=function(t=process.cwd()){const r="string"==typeof t?e.existsSync(`${t}/package.json`)?JSON.parse(e.readFileSync(`${t}/package.json`,"utf-8")):{}:t,{dependencies:o={},peerDependencies:s={},optionalDependencies:n={}}=r;return Object.keys(o).concat(Object.keys(s)).concat(Object.keys(n)).map((e=>new RegExp(`^${e}(/.*)?$`))).concat([/^node:/])}(t),[w,j]=function({entrypoints:e,pkgIsModule:t,entries:s,config:u,dir:l,noFilter:a}){const{build:f={}}=u??{},{crossModuleConvertor:d=!0}=f,m=`./${(e=>o(l??process.cwd(),e))(((...e)=>r(l??process.cwd(),...e))(("object"==typeof f?.output?.dir?f.output.dir.js:f?.output?.dir)??"dist"))}`,[,g]=n(e);s&&Object.entries(g).forEach((([e])=>{s.some((t=>h(e,t,{matchBase:!0})))||delete g[e]}));const y=a?g:i(g,{skipValue:[/(^|\/)\.jk-noentry/,...p]});return[y,c(y,{outdir:m,withConditional:{...d?{import:e=>!t&&0===E(new Set(e.conditionals),new Set(["import","module"])).size&&e.dist.replace(/\.js$/,".mjs"),require:e=>!(!t||0!==E(new Set(e.conditionals),new Set(["require","node"])).size)&&e.dist.replace(/\.js$/,".cjs")}:{}}})]}({entrypoints:a,pkgIsModule:f,entries:d,config:z}),k=new Map;u(w,(({keys:e,value:t})=>{if("string"==typeof t){const r=k.get(t)??[];k.set(t,r),r.push(e)}return!1}));const $=[];return k.forEach(((e,t)=>e.forEach((e=>{const[r,...o]=e,s=m+("."===r?"":G(r)),n=((e,t)=>t.reduce(((e,t)=>{if("string"==typeof e)throw new Error("key not found in exports");if(!(t in e))throw new Error(`key ${t} not found in exports`);return e[t]}),e))(j,e),i={path:r,name:s,input:t,external:g,pkgIsModule:f};switch(typeof n){case"string":$.push(...H({...i,output:n,conditionals:o},B));break;case"object":u(n,(({keys:e,value:t})=>{const r=[...new Set([...o,...e])];return"string"==typeof t&&$.push(...H({...i,output:t,conditionals:r},B)),!1}))}})))),y({type:"init",data:{leafMap:k,targetsLength:$.length}}),$.map((e=>({...K,...e,plugins:[...W,e.plugins]})))}export{Q as template};
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.min.mjs","sources":["../../src/utils/getRoot.ts","../../src/utils/filterSupport.ts","../../src/utils/getWD.ts","../../src/utils/tsRegister.ts","../../src/utils/loadConfig.ts","../../src/rollup/plugins/progress.ts","../../src/rollup/plugins/skip.ts","../../src/rollup/index.ts","../../src/rollup/utils/externalResolver.ts"],"sourcesContent":["import path from 'node:path'\n\nimport { program } from 'commander'\n\nlet root: string\nexport function getRoot() {\n if (root) return root\n\n const rootOption = program.getOptionValue('root')\n root = rootOption\n ? path.isAbsolute(rootOption)\n ? rootOption\n : path.resolve(process.cwd(), rootOption)\n : undefined\n return root\n}\n","import fs from 'node:fs'\nimport path from 'node:path'\n\nimport { filterPackagesFromDir } from '@pnpm/filter-workspace-packages'\nimport { program } from 'commander'\nimport { load } from 'js-yaml'\n\nimport { getRoot } from './getRoot'\nimport { getWD } from './getWD'\n\nexport let type = ''\n\ntry {\n require.resolve('@pnpm/filter-workspace-packages')\n type = 'pnpm'\n} catch { /* empty */ }\nif (type !== '') {\n program\n .option('-f, --filter <filter>', 'filter packages')\n}\n\ninterface ProjectsGraph {\n wd: string\n root: string\n value?: Record<string, {\n name?: string\n }>\n}\n\nexport async function getSelectedProjectsGraph(): Promise<ProjectsGraph> {\n let filter = program.getOptionValue('filter')\n const root = getRoot()\n const { wd, notWorkspace } = getWD()\n if (!notWorkspace && type === 'pnpm') {\n const pnpmWorkspaceFilePath = path.resolve(wd, 'pnpm-workspace.yaml')\n const pnpmWorkspaceFileContent = fs.readFileSync(pnpmWorkspaceFilePath, 'utf-8')\n const pnpmWorkspace = load(pnpmWorkspaceFileContent) as {\n packages: string[]\n }\n if (root === wd && !filter) {\n throw new Error('root path is workspace root, please provide a filter')\n // TODO inquirer prompt support user select packages\n }\n if (root !== wd && !filter) {\n const packageJSONIsExist = fs.existsSync(path.resolve(root, 'package.json'))\n if (!packageJSONIsExist) {\n throw new Error('root path is not workspace root, please provide a filter')\n }\n const packageJSON = JSON.parse(fs.readFileSync(path.resolve(root, 'package.json'), 'utf-8'))\n if (!packageJSON.name) {\n throw new Error('root path is not workspace root, please provide a filter')\n }\n filter = packageJSON.name\n }\n const { selectedProjectsGraph } = await filterPackagesFromDir(wd, [{\n filter: filter ?? '',\n followProdDepsOnly: true\n }], {\n prefix: root,\n workspaceDir: wd,\n patterns: pnpmWorkspace.packages\n })\n return {\n wd,\n root,\n value: Object.entries(selectedProjectsGraph)\n .reduce((acc, [key, value]) => {\n acc[key] = value.package.manifest\n return acc\n }, {} as NonNullable<ProjectsGraph['value']>)\n }\n }\n return {\n wd,\n root,\n value: {\n [wd]: JSON.parse(fs.readFileSync(path.resolve(wd, 'package.json'), 'utf-8'))\n }\n }\n}\n","import { getWorkspaceDir, isWorkspaceDir } from '@jiek/utils/getWorkspaceDir'\n\nimport { type } from './filterSupport'\nimport { getRoot } from './getRoot'\n\nlet wd: string\nlet notWorkspace = false\n\nexport function getWD() {\n if (wd) return { wd, notWorkspace }\n\n const root = getRoot()\n if (root !== undefined) {\n const isWorkspace = isWorkspaceDir(root, type)\n notWorkspace = !isWorkspace\n wd = root\n return { wd, notWorkspace }\n }\n try {\n wd = getWorkspaceDir(type)\n } catch (e) {\n // @ts-ignore\n if ('message' in e && e.message === 'workspace root not found') {\n wd = root\n notWorkspace = true\n } else {\n throw e\n }\n }\n return { wd, notWorkspace }\n}\n","function packageIsExist(name: string) {\n try {\n require.resolve(name)\n return true\n } catch (e) {\n return false\n }\n}\n\nexport let tsRegisterName: string | undefined\nconst registers = [\n process.env.JIEK_TS_REGISTER,\n 'esbuild-register',\n '@swc-node/register',\n 'ts-node/register'\n].filter(Boolean) as string[]\nfor (const register of registers) {\n if (packageIsExist(register)) {\n tsRegisterName = register\n break\n }\n}\n","import fs from 'node:fs'\nimport path from 'node:path'\n\nimport { program } from 'commander'\nimport type { Config } from 'jiek'\nimport { load } from 'js-yaml'\n\nimport { getWD } from './getWD'\nimport { tsRegisterName } from './tsRegister'\n\nlet configName = 'jiek.config'\n\nfunction getConfigPath(root: string) {\n const isSupportTsLoader = !!tsRegisterName\n function configWithExtIsExist(ext: string) {\n const filenames = [\n path.resolve(process.cwd(), `${configName}.${ext}`),\n path.resolve(process.cwd(), `.${configName}.${ext}`),\n path.resolve(root, `${configName}.${ext}`),\n path.resolve(root, `.${configName}.${ext}`)\n ]\n for (const filename of filenames) {\n if (\n fs.existsSync(filename)\n && fs.lstatSync(filename)\n .isFile()\n ) {\n return filename\n }\n }\n return\n }\n configName = configWithExtIsExist('js') ?? configName\n configName = configWithExtIsExist('json') ?? configName\n configName = configWithExtIsExist('yaml') ?? configName\n if (isSupportTsLoader) {\n configName = configWithExtIsExist('ts') ?? configName\n }\n return path.resolve(root, configName)\n}\n\nexport function loadConfig(): Config {\n const { wd: root, notWorkspace } = getWD()\n if (notWorkspace) {\n throw new Error('not in workspace')\n }\n\n let configPath = program.getOptionValue('configPath')\n\n if (!configPath) {\n configPath = getConfigPath(root)\n } else {\n if (!fs.existsSync(configPath)) {\n throw new Error(`config file not found: ${configPath}`)\n }\n if (!path.isAbsolute(configPath)) {\n configPath = path.resolve(root, configPath)\n }\n }\n const ext = path.extname(configPath)\n\n let module: any\n switch (ext) {\n case '.js':\n module = require(configPath)\n break\n case '.json':\n return require(configPath)\n case '.yaml':\n return load(fs.readFileSync(configPath, 'utf-8')) as Config\n case '.ts':\n if (tsRegisterName) {\n require(tsRegisterName)\n module = require(configPath)\n break\n }\n throw new Error(\n 'ts config file is not supported without ts register, '\n + 'please install esbuild-register or set JIEK_TS_REGISTER env for custom ts register'\n )\n case '.config':\n module = {}\n break\n default:\n throw new Error(`unsupported config file type: ${ext}`)\n }\n if (!module) throw new Error('config file is empty')\n\n return module.default ?? module\n}\n","import type { PluginImpl } from 'rollup'\n\ninterface Options {\n onEvent?: (event: string, message?: string) => void\n}\n\nexport default ((options = {}) => {\n const { onEvent } = options\n return {\n name: 'progress',\n buildStart: () => onEvent?.('start', 'Start building...'),\n buildEnd: () => onEvent?.('end', 'Build completed!'),\n resolveId: {\n order: 'post',\n handler: source => onEvent?.('resolve', `Resolving ${source}...`)\n },\n load: {\n order: 'post',\n handler: id => onEvent?.('load', `Loading ${id}...`)\n },\n transform: {\n order: 'post',\n handler: (_, id) => onEvent?.('transform', `Transforming ${id}...`)\n }\n }\n}) as PluginImpl<Options>\n","import type { PluginImpl } from 'rollup'\n\ninterface Options {\n patterns?: (string | RegExp)[]\n}\n\nexport default ((options = {}) => {\n return {\n name: 'skip',\n // skip the specified files by `options.patterns`\n load(id) {\n if (\n options.patterns?.some((pattern) =>\n typeof pattern === 'string'\n ? id.includes(pattern)\n : pattern.test(id)\n )\n ) {\n return ''\n }\n }\n }\n}) as PluginImpl<Options>\n","import '../rollup/base'\n\nimport fs from 'node:fs'\nimport { dirname, resolve } from 'node:path'\n\nimport type { Entrypoints2ExportsOptions, RecursiveRecord } from '@jiek/pkger/entrypoints'\nimport {\n DEFAULT_SKIP_VALUES,\n entrypoints2Exports,\n filterLeafs,\n getAllLeafs,\n resolveEntrypoints\n} from '@jiek/pkger/entrypoints'\nimport { dts } from '@jiek/rollup-plugin-dts'\nimport { getWorkspaceDir } from '@jiek/utils/getWorkspaceDir'\nimport json from '@rollup/plugin-json'\nimport { nodeResolve } from '@rollup/plugin-node-resolve'\nimport terser from '@rollup/plugin-terser'\nimport { sendMessage } from 'execa'\nimport { parse } from 'jsonc-parser'\nimport { isMatch } from 'micromatch'\nimport type { OutputOptions, OutputPlugin, RollupOptions } from 'rollup'\nimport esbuild from 'rollup-plugin-esbuild'\nimport ts from 'typescript'\n\nimport { loadConfig } from '../utils/loadConfig'\nimport type { RollupProgressEvent, TemplateOptions } from './base'\nimport progress from './plugins/progress'\nimport skip from './plugins/skip'\nimport externalResolver from './utils/externalResolver'\n\ninterface PackageJSON {\n name?: string\n type?: string\n exports?: Record<string, unknown> | string | string[]\n}\n\nconst {\n JIEK_ROOT,\n JIEK_ENTRIES\n} = process.env\nconst WORKSPACE_ROOT = JIEK_ROOT ?? getWorkspaceDir()\nconst COMMON_OPTIONS = {} satisfies RollupOptions\nconst COMMON_PLUGINS = [\n json()\n]\n\nconst { build } = loadConfig()\nconst jsOutdir = resolve(\n (\n typeof build?.output?.dir === 'object'\n // the outdir only effect js output in this function\n ? build.output.dir.js\n : build?.output?.dir\n ) ?? 'dist'\n)\n\nconst STYLE_REGEXP = /\\.(css|s[ac]ss|less|styl)$/\n\n// eslint-disable-next-line unused-imports/no-unused-vars\nconst debug = (...args: unknown[]) => sendMessage({ type: 'debug', data: args } satisfies RollupProgressEvent)\n\nconst resolveWorkspacePath = (p: string) => resolve(WORKSPACE_ROOT, p)\n\nconst intersection = <T>(a: Set<T>, b: Set<T>) => new Set([...a].filter(i => b.has(i)))\n\nconst pascalCase = (str: string) =>\n str\n .replace(/[@|/-](\\w)/g, (_, $1) => $1.toUpperCase())\n .replace(/(?:^|-)(\\w)/g, (_, $1) => $1.toUpperCase())\n\nconst reveal = (obj: string | Record<string, unknown>, keys: string[]) =>\n keys.reduce((acc, key) => {\n if (typeof acc === 'string') throw new Error('key not found in exports')\n if (!(key in acc)) throw new Error(`key ${key} not found in exports`)\n return acc[key] as string | Record<string, unknown>\n }, obj)\n\nconst withMinify = (\n output: OutputOptions & {\n plugins?: OutputPlugin[]\n },\n minify = build?.output?.minify\n) =>\n minify === false\n ? [output]\n : minify === 'only-minify'\n ? [{\n ...output,\n // TODO replace suffix when pubish to npm and the `build.output.minify` is 'only-minify'\n // TODO resolve dts output file name\n file: output.file?.replace(/(\\.[cm]?js)$/, '.min$1'),\n plugins: [\n ...(output.plugins ?? []),\n terser()\n ]\n }]\n : [\n output,\n {\n ...output,\n file: output.file?.replace(/(\\.[cm]?js)$/, '.min$1'),\n plugins: [\n ...(output.plugins ?? []),\n terser()\n ]\n }\n ]\n\ntype TSConfig = {\n extends?: string | string[]\n compilerOptions?: Record<string, unknown>\n references?: { path: string }[]\n files?: string[]\n include?: string[]\n exclude?: string[]\n}\n\nconst getTSConfig = (p: string): TSConfig =>\n !fs.existsSync(p) || !fs.statSync(p).isFile()\n ? {}\n : parse(fs.readFileSync(p, 'utf-8'), [], { allowTrailingComma: true, allowEmptyContent: true })\n\nconst getExtendTSConfig = (tsconfigPath: string): TSConfig => {\n tsconfigPath = resolve(tsconfigPath)\n const tsconfigPathDirname = dirname(tsconfigPath)\n const { extends: exts, ...tsconfig } = getTSConfig(tsconfigPath)\n const resolvePaths = (paths: string[] | undefined) => paths?.map(p => resolve(tsconfigPathDirname, p)) ?? []\n\n const extendsPaths = resolvePaths(\n exts ? Array.isArray(exts) ? exts : [exts] : []\n )\n if (extendsPaths.length === 0) return tsconfig\n return extendsPaths\n .map(getExtendTSConfig)\n // https://www.typescriptlang.org/tsconfig/#files:~:text=Currently%2C%20the%20only%20top%2Dlevel%20property%20that%20is%20excluded%20from%20inheritance%20is%20references.\n // Currently, the only top-level property that is excluded from inheritance is references.\n .reduce((acc, { compilerOptions = {}, references: _, ...curr }) => ({\n ...acc,\n ...curr,\n compilerOptions: {\n ...acc.compilerOptions,\n ...compilerOptions\n }\n }), tsconfig)\n}\n\nconst getCompilerOptionsByFilePath = (tsconfigPath: string, filePath: string): Record<string, unknown> | undefined => {\n tsconfigPath = resolve(tsconfigPath)\n filePath = resolve(filePath)\n const tsconfigPathDirname = dirname(tsconfigPath)\n // https://www.typescriptlang.org/tsconfig/#files:~:text=It%E2%80%99s%20worth%20noting%20that%20files%2C%20include%2C%20and%20exclude%20from%20the%20inheriting%20config%20file%20overwrite%20those%20from%20the%20base%20config%20file%2C%20and%20that%20circularity%20between%20configuration%20files%20is%20not%20allowed.\n // It’s worth noting that files, include, and exclude from the inheriting config file overwrite\n // those from the base config file, and that circularity between configuration files is not allowed.\n const tsconfig = getExtendTSConfig(tsconfigPath)\n\n const resolvePaths = (paths: string[] | undefined) => paths?.map(p => resolve(tsconfigPathDirname, p)) ?? []\n\n const [\n references,\n files,\n include,\n exclude\n ] = [\n tsconfig.references?.map(({ path }) => path),\n tsconfig.files,\n tsconfig.include,\n tsconfig.exclude\n ].map(resolvePaths)\n if (exclude.length > 0 && exclude.some(i => isMatch(filePath, i))) return\n\n // when files or include is not empty, the tsconfig should be ignored\n if (tsconfig.files?.length === 0 && tsconfig.include?.length === 0) return\n let isInclude = false\n isInclude ||= files.length > 0 && files.includes(filePath)\n isInclude ||= include.length > 0 && include.some(i => isMatch(filePath, i))\n if (isInclude) {\n return tsconfig.compilerOptions ?? {}\n } else {\n // when files or include is not empty, but the file is not matched, the tsconfig should be ignored\n if (\n (tsconfig.files && tsconfig.files.length > 0)\n || (tsconfig.include && tsconfig.include.length > 0)\n ) return\n }\n\n references.reverse()\n for (const ref of references) {\n const compilerOptions = getCompilerOptionsByFilePath(ref, filePath)\n if (compilerOptions) return compilerOptions\n }\n return tsconfig.compilerOptions\n}\n\nconst generateConfigs = ({\n path,\n name,\n input,\n output,\n external,\n pkgIsModule,\n conditionals\n}: {\n path: string\n name: string\n input: string\n output: string\n external: (string | RegExp)[]\n pkgIsModule: boolean\n conditionals: string[]\n}, options: TemplateOptions = {}): RollupOptions[] => {\n const isModule = conditionals.includes('import')\n const isCommonJS = conditionals.includes('require')\n const isBrowser = conditionals.includes('browser')\n const dtsTSConfigPaths = [\n resolveWorkspacePath('tsconfig.json'),\n resolveWorkspacePath('tsconfig.dts.json')\n ]\n let dtsTSConfigPath: string | undefined\n dtsTSConfigPaths.forEach(p => {\n if (fs.existsSync(p) && fs.statSync(p).isFile()) {\n dtsTSConfigPath = p\n }\n })\n let compilerOptions: ts.CompilerOptions = {}\n if (dtsTSConfigPath) {\n const jsonCompilerOptions = getCompilerOptionsByFilePath(dtsTSConfigPath, resolve(input))\n const { options, errors } = ts.convertCompilerOptionsFromJson(\n jsonCompilerOptions,\n dirname(dtsTSConfigPath)\n )\n if (errors.length > 0) {\n throw new Error(errors.map(e => e.messageText).join('\\n'))\n }\n compilerOptions = options\n }\n const exportConditions = [...conditionals, ...(compilerOptions.customConditions ?? [])]\n const throughEventProps: RollupProgressEvent & { type: 'progress' } = {\n type: 'progress',\n data: { name, path, exportConditions, input }\n }\n const outdir = options?.output?.dir\n return [\n {\n input,\n external,\n output: [\n ...withMinify({\n file: output,\n name,\n sourcemap: typeof options?.output?.sourcemap === 'object'\n ? options.output.sourcemap.js\n : options?.output?.sourcemap ?? true,\n format: isModule ? 'esm' : (\n isCommonJS ? 'cjs' : (\n isBrowser ? 'umd' : (\n pkgIsModule ? 'esm' : 'cjs'\n )\n )\n ),\n strict: typeof options?.output?.strict === 'object'\n ? options.output.strict.js\n : options?.output?.strict\n })\n ],\n plugins: [\n nodeResolve({ exportConditions }),\n import('rollup-plugin-postcss')\n .then(({ default: postcss }) =>\n postcss({\n extract: resolve(output.replace(/\\.[cm]?js$/, '.css')),\n minimize: true\n })\n )\n .catch(() => void 0),\n esbuild(),\n progress({\n onEvent: (event, message) =>\n sendMessage(\n {\n ...throughEventProps,\n data: { ...throughEventProps.data, event, message, tags: ['js'] }\n } satisfies RollupProgressEvent\n )\n })\n ]\n },\n {\n input,\n external,\n output: [\n {\n dir: resolve((typeof outdir === 'object' ? outdir.dts : outdir) ?? 'dist'),\n sourcemap: typeof options?.output?.sourcemap === 'object'\n ? options.output.sourcemap.dts\n : options?.output?.sourcemap ?? true,\n entryFileNames: () =>\n output\n .replace(`${jsOutdir}/`, '')\n .replace(/(\\.[cm]?)js$/, '.d$1ts'),\n strict: typeof options?.output?.strict === 'object'\n ? options.output.strict.dts\n : options?.output?.strict\n }\n ],\n plugins: [\n nodeResolve({ exportConditions }),\n skip({ patterns: [STYLE_REGEXP] }),\n dts({\n respectExternal: true,\n compilerOptions\n }),\n progress({\n onEvent: (event, message) =>\n sendMessage(\n {\n ...throughEventProps,\n data: { ...throughEventProps.data, event, message, tags: ['dts'] }\n } satisfies RollupProgressEvent\n )\n })\n ]\n }\n ]\n}\n\nexport function template(packageJSON: PackageJSON): RollupOptions[] {\n const { name, type, exports: entrypoints } = packageJSON\n const pkgIsModule = type === 'module'\n if (!name) throw new Error('package.json name is required')\n if (!entrypoints) throw new Error('package.json exports is required')\n\n const entries = JIEK_ENTRIES\n ?.split(',')\n .map(e => e.trim())\n .map(e => ({\n 'index': '.'\n }[e] ?? e))\n\n const {\n crossModuleConvertor = true\n } = build ?? {}\n\n const packageName = pascalCase(name)\n\n const external = externalResolver(packageJSON as Record<string, unknown>)\n\n const [, resolvedEntrypoints] = resolveEntrypoints(entrypoints)\n if (entries) {\n Object\n .entries(resolvedEntrypoints)\n .forEach(([key]) => {\n if (!entries.some(e => isMatch(key, e, { matchBase: true }))) {\n delete resolvedEntrypoints[key]\n }\n })\n }\n const filteredResolvedEntrypoints = filterLeafs(\n resolvedEntrypoints as RecursiveRecord<string>,\n {\n skipValue: [\n // ignore values that filename starts with `.jk-noentry`\n /(^|\\/)\\.jk-noentry/,\n ...DEFAULT_SKIP_VALUES\n ]\n }\n )\n const crossModuleWithConditional: Entrypoints2ExportsOptions['withConditional'] = crossModuleConvertor\n ? {\n import: opts =>\n !pkgIsModule && intersection(\n new Set(opts.conditionals),\n new Set(['import', 'module'])\n ).size === 0\n ? opts.dist.replace(/\\.js$/, '.mjs')\n : false,\n require: opts => {\n return pkgIsModule && intersection(\n new Set(opts.conditionals),\n new Set(['require', 'node'])\n ).size === 0\n ? opts.dist.replace(/\\.js$/, '.cjs')\n : false\n }\n }\n : {}\n const exports = entrypoints2Exports(filteredResolvedEntrypoints, {\n outdir: jsOutdir,\n withConditional: {\n ...crossModuleWithConditional\n }\n })\n\n const leafMap = new Map<string, string[][]>()\n getAllLeafs(filteredResolvedEntrypoints as RecursiveRecord<string>, ({ keys, value }) => {\n if (typeof value === 'string') {\n const keysArr = leafMap.get(value) ?? []\n leafMap.set(value, keysArr)\n keysArr.push(keys)\n }\n return false\n })\n\n const configs: RollupOptions[] = []\n leafMap.forEach((keysArr, input) =>\n keysArr.forEach((keys) => {\n const [path, ...conditionals] = keys\n\n const name = packageName + (path === '.' ? '' : pascalCase(path))\n const keyExports = reveal(exports, keys)\n const commonOptions = {\n path,\n name,\n input,\n external,\n pkgIsModule\n }\n\n switch (typeof keyExports) {\n case 'string': {\n configs.push(...generateConfigs({\n ...commonOptions,\n output: keyExports,\n conditionals\n }, build))\n break\n }\n case 'object': {\n getAllLeafs(keyExports as RecursiveRecord<string>, ({ keys: nextKeys, value }) => {\n const allConditionals = [...new Set([...conditionals, ...nextKeys])]\n if (typeof value === 'string') {\n configs.push(...generateConfigs({\n ...commonOptions,\n output: value,\n conditionals: allConditionals\n }, build))\n }\n return false\n })\n break\n }\n }\n })\n )\n sendMessage(\n {\n type: 'init',\n data: {\n leafMap,\n targetsLength: configs.length\n }\n } satisfies RollupProgressEvent\n )\n return configs.map(c => ({\n ...COMMON_OPTIONS,\n ...c,\n plugins: [\n ...COMMON_PLUGINS,\n c.plugins\n ]\n }))\n}\n","import fs from 'node:fs'\n\nexport default function(json: Record<string, unknown>): (string | RegExp)[]\nexport default function(path?: string): (string | RegExp)[]\nexport default function(jsonOrPath: string | Record<string, unknown> = process.cwd()): (string | RegExp)[] {\n const pkg = typeof jsonOrPath === 'string'\n ? fs.existsSync(`${jsonOrPath}/package.json`)\n ? JSON.parse(fs.readFileSync(`${jsonOrPath}/package.json`, 'utf-8'))\n : {}\n : jsonOrPath\n const { dependencies = {}, peerDependencies = {}, optionalDependencies = {} } = pkg\n const external = <(string | RegExp)[]> Object\n .keys(dependencies)\n .concat(Object.keys(peerDependencies))\n .concat(Object.keys(optionalDependencies))\n return external\n .map(dep => new RegExp(`^${dep}(/.*)?$`))\n .concat([\n /^node:/\n ])\n}\n"],"names":["root","getRoot","rootOption","program","getOptionValue","path","isAbsolute","resolve","process","cwd","wd","type","require","option","tsRegisterName","notWorkspace","getWD","isWorkspace","isWorkspaceDir","getWorkspaceDir","e","message","packageIsExist","name","registers","env","JIEK_TS_REGISTER","filter","Boolean","register","configName","progress","options","onEvent","buildStart","buildEnd","resolveId","order","handler","source","load","id","transform","_","skip","patterns","some","pattern","includes","test","JIEK_ROOT","JIEK_ENTRIES","WORKSPACE_ROOT","COMMON_OPTIONS","COMMON_PLUGINS","json","build","Error","configPath","fs","existsSync","isSupportTsLoader","configWithExtIsExist","ext","filenames","filename","lstatSync","isFile","getConfigPath","extname","module","readFileSync","default","loadConfig","jsOutdir","output","dir","js","STYLE_REGEXP","resolveWorkspacePath","p","intersection","a","b","Set","i","has","pascalCase","str","replace","$1","toUpperCase","withMinify","minify","file","plugins","terser","getExtendTSConfig","tsconfigPath","tsconfigPathDirname","dirname","extends","exts","tsconfig","statSync","parse","allowTrailingComma","allowEmptyContent","extendsPaths","paths","Array","isArray","map","length","reduce","acc","compilerOptions","references","curr","getCompilerOptionsByFilePath","filePath","files","include","exclude","isMatch","isInclude","reverse","ref","generateConfigs","input","external","pkgIsModule","conditionals","isModule","isCommonJS","isBrowser","dtsTSConfigPath","forEach","jsonCompilerOptions","errors","ts","convertCompilerOptionsFromJson","messageText","join","exportConditions","customConditions","throughEventProps","data","outdir","sourcemap","format","strict","nodeResolve","import","then","postcss","extract","minimize","catch","esbuild","event","sendMessage","tags","dts","entryFileNames","respectExternal","template","packageJSON","exports","entrypoints","entries","split","trim","index","crossModuleConvertor","packageName","jsonOrPath","pkg","JSON","dependencies","peerDependencies","optionalDependencies","Object","keys","concat","dep","RegExp","externalResolver","resolvedEntrypoints","resolveEntrypoints","key","matchBase","filteredResolvedEntrypoints","filterLeafs","skipValue","DEFAULT_SKIP_VALUES","entrypoints2Exports","withConditional","opts","size","dist","leafMap","Map","getAllLeafs","value","keysArr","get","set","push","configs","keyExports","obj","reveal","commonOptions","nextKeys","allConditionals","targetsLength","c"],"mappings":"svBAIA,IAAIA,EACG,SAASC,IACV,GAAAD,EAAa,OAAAA,EAEX,MAAAE,EAAaC,EAAQC,eAAe,QAMnC,OALPJ,EAAOE,EACHG,EAAKC,WAAWJ,GACdA,E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