jiek 0.2.10 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (37) hide show
  1. package/dist/cli.cjs +1 -1
  2. package/dist/cli.cjs.map +1 -1
  3. package/dist/cli.esm.js +1 -2
  4. package/dist/cli.esm.js.map +1 -1
  5. package/dist/cli.esm.min.js +1 -1
  6. package/dist/cli.esm.min.js.map +1 -1
  7. package/dist/commands/base.esm.js +5 -0
  8. package/dist/commands/base.esm.js.map +1 -0
  9. package/dist/commands/base.esm.min.js +2 -0
  10. package/dist/commands/base.esm.min.js.map +1 -0
  11. package/dist/commands/build.esm.js +2 -2
  12. package/dist/commands/build.esm.js.map +1 -1
  13. package/dist/commands/build.esm.min.js +1 -1
  14. package/dist/commands/build.esm.min.js.map +1 -1
  15. package/dist/merge-package-json.esm.js +9 -2
  16. package/dist/merge-package-json.esm.js.map +1 -1
  17. package/dist/merge-package-json.esm.min.js +1 -1
  18. package/dist/merge-package-json.esm.min.js.map +1 -1
  19. package/dist/rollup/utils/commonOptions.esm.js +0 -1
  20. package/dist/rollup/utils/commonOptions.esm.js.map +1 -1
  21. package/dist/rollup/utils/commonOptions.esm.min.js +1 -1
  22. package/dist/rollup/utils/commonOptions.esm.min.js.map +1 -1
  23. package/dist/rollup.cjs +1 -1
  24. package/dist/rollup.cjs.map +1 -1
  25. package/dist/rollup.esm.js +145 -9
  26. package/dist/rollup.esm.js.map +1 -1
  27. package/dist/rollup.esm.min.js +1 -1
  28. package/dist/rollup.esm.min.js.map +1 -1
  29. package/dist/utils/getRoot.esm.js +1 -1
  30. package/dist/utils/getRoot.esm.js.map +1 -1
  31. package/dist/utils/getRoot.esm.min.js +1 -1
  32. package/dist/utils/getRoot.esm.min.js.map +1 -1
  33. package/dist/utils/getWD.esm.js +8 -2
  34. package/dist/utils/getWD.esm.js.map +1 -1
  35. package/dist/utils/getWD.esm.min.js +1 -1
  36. package/dist/utils/getWD.esm.min.js.map +1 -1
  37. package/package.json +5 -6
@@ -1 +1 @@
1
- {"version":3,"file":"rollup.cjs","sources":["../src/rollup/utils/globalResolver.ts","../src/rollup/plugins/skip.ts","../src/rollup/utils/commonOptions.ts","../src/rollup/utils/withMinify.ts","../src/rollup/index.ts","../src/rollup/plugins/globals.ts","../src/rollup/utils/externalResolver.ts"],"sourcesContent":["export default function (external: string) {\n // a/b => AB\n // a-b => AB\n // a@b => AB\n // a@b/c => ABC\n // node:a => a\n // node:a_b => a_b\n if (external.startsWith('node:')) {\n return external.slice(5)\n }\n return external\n .replace(/[@|/-](\\w)/g, (_, $1) => $1.toUpperCase())\n}\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 type { OutputOptions } from 'rollup'\n\nconst defineOutput = <O extends OutputOptions>(output: O) => output\n\nexport const commonOutputOptions = defineOutput({\n dir: 'dist',\n exports: 'named',\n interop: 'auto',\n sourcemap: true\n})\n","import terser from '@rollup/plugin-terser'\nimport type { OutputOptions, OutputPlugin } from 'rollup'\n\nexport default function (output: OutputOptions & {\n entryFileNames?: string\n plugins?: OutputPlugin[]\n}): OutputOptions[] {\n return [\n output,\n {\n ...output,\n entryFileNames: output.entryFileNames?.replace(/(\\.js)$/, '.min$1'),\n plugins: [...(output.plugins ?? []), terser()]\n }\n ]\n}\n","import { resolve } from 'node:path'\n\nimport type { Options } from '@jiek/pkger'\nimport { getWorkspaceDir } from '@jiek/utils/getWorkspaceDir'\nimport json from '@rollup/plugin-json'\nimport autoprefixer from 'autoprefixer'\nimport type { InputPluginOption, RollupOptions } from 'rollup'\nimport { dts } from 'rollup-plugin-dts'\nimport esbuild from 'rollup-plugin-esbuild'\nimport postcss from 'rollup-plugin-postcss'\n\nimport { createGlobalsLinkage } from './plugins/globals'\nimport skip from './plugins/skip'\nimport { commonOutputOptions } from './utils/commonOptions'\nimport externalResolver from './utils/externalResolver'\nimport withMinify from './utils/withMinify'\n\nconst workspaceRoot = getWorkspaceDir()\nfunction resolveWorkspacePath(p: string) {\n return resolve(workspaceRoot, p)\n}\n\nexport const template = (\n {\n styled = false,\n plugins: {\n index: indexPlugins = [],\n entry: entryPlugins = [],\n dts: dtsPlugins = []\n } = {}\n }: {\n /**\n * include styles files\n */\n styled?: boolean\n plugins?: {\n index?: InputPluginOption\n entry?: InputPluginOption\n dts?: InputPluginOption\n }\n } = {},\n pkg: {\n name?: string\n jiek?: Options\n exports?: Record<string, string | {\n import: string\n 'inner-src': string\n }>\n }\n) => {\n const { jiek: {\n noBrowser = false\n } = {} } = pkg\n if (!pkg.name) {\n throw new Error('pkg.name is required')\n }\n const namePrefix = pkg\n .name\n .replace(/[@|/-](\\w)/g, (_, $1) => $1.toUpperCase())\n const exportsEntries = Object.fromEntries(\n Object.entries(pkg.exports ?? {})\n // filter static files\n .filter(([key]) => !/\\.(json|css|scss)$/.test(key))\n // filter no `inner-src` or `import` field entries\n .filter(([, value]) => typeof value === 'object' && value['inner-src'] && value['import'])\n .map(([key, value]) => [\n key\n .replace(/^\\.$/, 'index')\n .replace(/^\\.\\//, ''),\n typeof value === 'string' ? value : value['inner-src']\n ])\n )\n\n const [globalsRegister, globalsOutput] = createGlobalsLinkage()\n const external = externalResolver()\n\n const commonPlugins = [\n json()\n ]\n return [\n {\n input: exportsEntries,\n output: [\n ...withMinify({\n ...commonOutputOptions,\n format: 'esm',\n entryFileNames: '[name].esm.js',\n preserveModules: true\n })\n ],\n plugins: [\n commonPlugins,\n globalsRegister({ external }),\n styled && skip({ patterns: [/\\.s?css$/] }),\n esbuild(),\n indexPlugins\n ]\n },\n ...Object.entries(exportsEntries).map(([name, input]) => {\n const outputName = namePrefix + (\n name === 'index' ? '' : (\n name.replace(/[@|/-](\\w)/g, (_, $1) => $1.toUpperCase())\n )\n )\n return {\n input: input,\n output: noBrowser ? [\n ...withMinify({\n ...commonOutputOptions,\n name: outputName,\n format: 'cjs',\n entryFileNames: `${name}.cjs`\n })\n ] : [\n ...withMinify({\n ...commonOutputOptions,\n name: outputName,\n format: 'iife',\n entryFileNames: `${name}.iife.js`\n }),\n ...withMinify({\n ...commonOutputOptions,\n name: outputName,\n format: 'umd',\n entryFileNames: `${name}.umd.js`\n })\n ],\n plugins: [\n commonPlugins,\n globalsOutput,\n styled && postcss({\n plugins: [autoprefixer],\n minimize: true,\n sourceMap: true,\n extract: `${name}.css`\n }),\n esbuild(),\n entryPlugins\n ],\n external\n }\n }),\n {\n input: exportsEntries,\n output: [\n {\n dir: 'dist',\n entryFileNames: ({ name }) => `${name.replace(/^src\\//, '')}.esm.d.ts`,\n preserveModules: true\n },\n {\n dir: 'dist'\n }\n ],\n plugins: [\n commonPlugins,\n styled && skip({ patterns: [/\\.s?css$/] }),\n dts({ tsconfig: resolveWorkspacePath('tsconfig.dts.json') }),\n {\n name: 'rollup-plugin-declare-module-replacer',\n /**\n * replace relative path `declare module './xxx'` to `declare module '{{package name}}'`\n * in output file generated\n */\n generateBundle(_, bundle) {\n for (const file of Object.values(bundle)) {\n if (!('code' in file)) continue\n\n file.code = file.code.replace(\n /declare module ['|\"]\\..*['|\"]/g,\n `declare module '${pkg.name}'`\n )\n }\n }\n },\n dtsPlugins\n ],\n external\n }\n ] as RollupOptions[]\n}\n","import type { Plugin, PluginImpl } from 'rollup'\n\nimport globalResolver from '../utils/globalResolver'\n\ninterface GlobalsOptions {\n external?: (string | RegExp)[]\n}\n\nexport function createGlobalsLinkage() {\n let globals = {}\n const dependencies = new Set<string>([])\n return [\n (({ external } = {}) => {\n return {\n name: 'globals',\n resolveId(id) {\n if (external?.some(dep => dep instanceof RegExp ? dep.test(id) : dep === id)) {\n dependencies.add(id)\n return { id, external: true }\n }\n return null\n },\n outputOptions(options) {\n globals = [...dependencies].reduce((acc, value) => ({\n ...acc,\n [value]: globalResolver(value)\n }), {})\n return { ...options, globals }\n }\n }\n }) as PluginImpl<GlobalsOptions>,\n { outputOptions: options => ({ ...options, globals }) } as Plugin\n ] as const\n}\n","export default function () {\n const cwd = process.cwd()\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n const pkg = require(`${cwd}/package.json`)\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":["globalResolver","external","startsWith","slice","replace","_","$1","toUpperCase","skip","options","name","load","id","patterns","some","pattern","includes","test","commonOutputOptions","dir","exports","interop","sourcemap","withMinify","output","entryFileNames","plugins","terser","workspaceRoot","getWorkspaceDir","styled","index","indexPlugins","entry","entryPlugins","dts","dtsPlugins","pkg","jiek","noBrowser","Error","namePrefix","exportsEntries","Object","fromEntries","entries","filter","key","value","map","globalsRegister","globalsOutput","globals","dependencies","Set","resolveId","dep","RegExp","add","outputOptions","reduce","acc","createGlobalsLinkage","cwd","process","require","peerDependencies","optionalDependencies","keys","concat","externalResolver","commonPlugins","json","input","format","preserveModules","esbuild","outputName","postcss","autoprefixer","minimize","sourceMap","extract","tsconfig","p","resolve","generateBundle","bundle","file","values","code"],"mappings":"8WAAA,SAAAA,EAAyBC,GAOnB,OAAAA,EAASC,WAAW,SACfD,EAASE,MAAM,GAEjBF,EACJG,QAAQ,eAAe,CAACC,EAAGC,IAAOA,EAAGC,eAC1C,CCNA,IAAAC,EAAgB,CAACC,EAAU,CAAA,KAClB,CACLC,KAAM,OAEN,IAAAC,CAAKC,GACH,GACEH,EAAQI,UAAUC,MAAMC,GACH,iBAAZA,EACHH,EAAGI,SAASD,GACZA,EAAQE,KAAKL,KAGZ,MAAA,EAEX,IClBJ,MAEaM,EAAmC,CAC9CC,IAAK,OACLC,QAAS,QACTC,QAAS,OACTC,WAAW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eAAgB,EAAGf,UAAW,GAAGA,EAAKN,QAAQ,SAAU,eACxDuE,iBAAiB,GAEnB,CACExD,IAAK,SAGTO,QAAS,CACP6C,EACAzC,GAAUtB,EAAK,CAAEK,SAAU,CAAC,cAC5BsB,EAAAA,IAAI,CAAEgD,UA3IgBC,EA2Ie,oBA1IpCC,EAAAA,QAAQzD,EAAewD,MA2IxB,CACE1E,KAAM,wCAKN,cAAA4E,CAAejF,EAAGkF,GAChB,IAAA,MAAWC,KAAQ7C,OAAO8C,OAAOF,GACzB,SAAUC,IAEXA,EAAAE,KAAOF,EAAKE,KAAKtF,QACpB,iCACA,mBAAmBiC,EAAI3B,SAG7B,GAEF0B,GAEFnC,aA/JN,IAA8BmF,CAiK5B"}
1
+ {"version":3,"file":"rollup.cjs","sources":["../src/rollup/utils/globalResolver.ts","../src/rollup/plugins/skip.ts","../src/rollup/utils/commonOptions.ts","../src/rollup/utils/withMinify.ts","../src/rollup/index.ts","../src/rollup/plugins/globals.ts","../src/rollup/utils/externalResolver.ts"],"sourcesContent":["export default function (external: string) {\n // a/b => AB\n // a-b => AB\n // a@b => AB\n // a@b/c => ABC\n // node:a => a\n // node:a_b => a_b\n if (external.startsWith('node:')) {\n return external.slice(5)\n }\n return external\n .replace(/[@|/-](\\w)/g, (_, $1) => $1.toUpperCase())\n}\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 type { OutputOptions } from 'rollup'\n\nconst defineOutput = <O extends OutputOptions>(output: O) => output\n\nexport const commonOutputOptions = defineOutput({\n exports: 'named',\n interop: 'auto',\n sourcemap: true\n})\n","import terser from '@rollup/plugin-terser'\nimport type { OutputOptions, OutputPlugin } from 'rollup'\n\nexport default function (output: OutputOptions & {\n entryFileNames?: string\n plugins?: OutputPlugin[]\n}): OutputOptions[] {\n return [\n output,\n {\n ...output,\n entryFileNames: output.entryFileNames?.replace(/(\\.js)$/, '.min$1'),\n plugins: [...(output.plugins ?? []), terser()]\n }\n ]\n}\n","import { resolve } from 'node:path'\n\nimport type { Options } from '@jiek/pkger'\nimport { getWorkspaceDir } from '@jiek/utils/getWorkspaceDir'\nimport json from '@rollup/plugin-json'\nimport autoprefixer from 'autoprefixer'\nimport { InputPluginOption, Plugin, RollupOptions } from 'rollup'\nimport { dts } from 'rollup-plugin-dts'\nimport esbuild from 'rollup-plugin-esbuild'\nimport postcss from 'rollup-plugin-postcss'\nimport { MultiBar, Presets } from 'cli-progress'\n\nimport { createGlobalsLinkage } from './plugins/globals'\nimport skip from './plugins/skip'\nimport { commonOutputOptions } from './utils/commonOptions'\nimport externalResolver from './utils/externalResolver'\nimport withMinify from './utils/withMinify'\n\nconst workspaceRoot = getWorkspaceDir()\nfunction resolveWorkspacePath(p: string) {\n return resolve(workspaceRoot, p)\n}\n\nfunction progress(\n entries: string[],\n onProcessing: (entry: string) => void,\n onTransforming: (id: string) => void,\n onProcessed: (name: string, fileName: string) => void\n): Plugin {\n return {\n name: 'progress',\n resolveId(source, importer) {\n if (entries.includes(source) || importer === undefined)\n onProcessing(source)\n },\n transform(_, id) {\n onTransforming(id)\n },\n writeBundle(options, bundle) {\n Object.entries(bundle).forEach(([key, value]) => {\n if (value.name === undefined || !('isEntry' in value)) return\n onProcessed(value.name, value.fileName)\n })\n }\n }\n}\n\nexport const template = (\n {\n styled = false,\n plugins: {\n index: indexPlugins = [],\n entry: entryPlugins = [],\n dts: dtsPlugins = []\n } = {}\n }: {\n /**\n * include styles files\n */\n styled?: boolean\n plugins?: {\n index?: InputPluginOption\n entry?: InputPluginOption\n dts?: InputPluginOption\n }\n } = {},\n pkg: {\n name?: string\n jiek?: Options\n exports?: Record<string, string | {\n import: string\n 'inner-src': string\n }>\n }\n) => {\n const { jiek: {\n noBrowser = false,\n outdir = 'dist'\n } = {} } = pkg\n const outputOptions = {\n ...commonOutputOptions,\n dir: outdir\n }\n if (!pkg.name) {\n throw new Error('pkg.name is required')\n }\n const namePrefix = pkg\n .name\n .replace(/[@|/-](\\w)/g, (_, $1) => $1.toUpperCase())\n const exportsEntries = Object.fromEntries(\n Object.entries(pkg.exports ?? {})\n // filter outdir entries\n .filter(([key]) => !key.startsWith(`./${outdir}`) && !key.startsWith(outdir))\n // filter static files\n .filter(([key]) => !/\\.(json|css|scss)$/.test(key))\n // filter no `inner-src` or `import` field entries\n .filter(([, value]) => typeof value === 'object' && value['inner-src'] && value['import'])\n .map(([key, value]) => [\n key\n .replace(/^\\.$/, 'index')\n .replace(/^\\.\\//, ''),\n typeof value === 'string' ? value : value['inner-src']\n ])\n )\n\n const [globalsRegister, globalsOutput] = createGlobalsLinkage()\n const external = externalResolver()\n\n const commonOptions = {\n } satisfies RollupOptions\n const commonPlugins = [\n json()\n ]\n const multiBars = new MultiBar({\n clearOnComplete: false,\n hideCursor: true,\n format: '- {bar} | {type} | {entry} | {message}'\n }, Presets.shades_classic)\n const entries = Object.values(exportsEntries)\n const progressState = {\n esm: entries.reduce((add, entry) => {\n const bar = multiBars.create(100, 0)\n bar.update(0, { type: 'esm', entry, message: 'waiting' })\n return { ...add, [entry]: bar }\n }, {} as Record<string, ReturnType<typeof multiBars.create>>),\n umd: entries.reduce((add, entry) => {\n const bar = multiBars.create(100, 0)\n bar.update(0, { type: 'umd', entry, message: 'waiting' })\n return { ...add, [entry]: bar }\n }, {} as Record<string, ReturnType<typeof multiBars.create>>),\n dts: entries.reduce((add, entry) => {\n const bar = multiBars.create(100, 0)\n bar.update(0, { type: 'dts', entry, message: 'waiting' })\n return { ...add, [entry]: bar }\n }, {} as Record<string, ReturnType<typeof multiBars.create>>)\n }\n const resolved = entries.reduce((entries, entry) => ({ ...entries, [entry]: false }), {} as Record<string, boolean>)\n return [\n {\n ...commonOptions,\n input: exportsEntries,\n output: [\n ...withMinify({\n ...outputOptions,\n format: 'esm',\n entryFileNames: '[name].esm.js',\n preserveModules: true\n })\n ],\n plugins: [\n progress(\n Object.values(exportsEntries),\n entry => {\n const bar = progressState.esm[entry]\n if (!bar) return\n bar.update(0, { type: 'esm', entry, message: 'processing' })\n },\n id => {\n const bar = progressState.esm[id]\n if (!bar) return\n bar.update(50, { type: 'esm', entry: id, message: `transforming ${id}` })\n },\n (name, fileName) => {\n const entry = exportsEntries[name]\n const bar = progressState.esm[entry]\n if (!bar) return\n if (!fileName.endsWith('.min.js')) {\n bar.update(95, { type: 'esm', entry, message: `processed` })\n } else {\n bar.update(100, { type: 'esm', entry, message: `finished` })\n }\n }\n ),\n commonPlugins,\n globalsRegister({ external }),\n styled && skip({ patterns: [/\\.s?css$/] }),\n esbuild(),\n indexPlugins\n ]\n },\n ...Object.entries(exportsEntries).map(([name, input]) => {\n const outputName = namePrefix + (\n name === 'index' ? '' : (\n name.replace(/[@|/-](\\w)/g, (_, $1) => $1.toUpperCase())\n )\n )\n return {\n ...commonOptions,\n input: input,\n output: noBrowser ? [\n ...withMinify({\n ...outputOptions,\n name: outputName,\n format: 'cjs',\n entryFileNames: `${name}.cjs`\n })\n ] : [\n ...withMinify({\n ...outputOptions,\n name: outputName,\n format: 'iife',\n entryFileNames: `${name}.iife.js`\n }),\n ...withMinify({\n ...outputOptions,\n name: outputName,\n format: 'umd',\n entryFileNames: `${name}.umd.js`\n })\n ],\n plugins: [\n progress(\n [input],\n entry => {\n const bar = progressState.umd[entry]\n if (!bar) return\n bar.update(0, { type: 'umd', entry, message: 'processing' })\n },\n id => {\n const bar = progressState.umd[input]\n if (!bar) return\n bar.update(50, { type: 'umd', input, message: `transforming ${id}` })\n },\n (name, fileName) => {\n const bar = progressState.umd[input]\n if (!bar) return\n if (!fileName.endsWith('.min.js')) {\n bar.update(95, { type: 'umd', input, message: `processed` })\n } else {\n bar.update(100, { type: 'umd', input, message: `finished` })\n }\n }\n ),\n commonPlugins,\n globalsOutput,\n styled && postcss({\n plugins: [autoprefixer],\n minimize: true,\n sourceMap: true,\n extract: `${name}.css`\n }),\n esbuild(),\n entryPlugins\n ],\n external\n }\n }),\n {\n ...commonOptions,\n input: exportsEntries,\n output: [\n {\n dir: 'dist'\n },\n {\n dir: 'dist',\n entryFileNames: ({ name }) => `${name.replace(/^src\\//, '')}.esm.d.ts`,\n preserveModules: true\n }\n ],\n plugins: [\n progress(\n Object.values(exportsEntries),\n entry => {\n const bar = progressState.dts[entry]\n if (!bar) return\n bar.update(0, { type: 'dts', entry, message: 'processing' })\n },\n id => {\n const bar = progressState.dts[id]\n if (!bar) return\n bar.update(50, { type: 'dts', entry: id, message: `transforming ${id}` })\n },\n (name, fileName) => {\n const entry = exportsEntries[name]\n const bar = progressState.dts[entry]\n if (!bar) return\n if (!fileName.endsWith('.esm.d.ts')) {\n bar.update(95, { type: 'dts', entry, message: `processed` })\n } else {\n bar.update(100, { type: 'dts', entry, message: `finished` })\n resolved[entry] = true\n }\n if (Object.values(resolved).every(Boolean)) {\n setTimeout(() => {\n multiBars.stop()\n }, 100)\n }\n }\n ),\n commonPlugins,\n styled && skip({ patterns: [/\\.s?css$/] }),\n dts({ tsconfig: resolveWorkspacePath('tsconfig.dts.json') }),\n {\n name: 'rollup-plugin-declare-module-replacer',\n /**\n * replace relative path `declare module './xxx'` to `declare module '{{package name}}'`\n * in output file generated\n */\n generateBundle(_, bundle) {\n for (const file of Object.values(bundle)) {\n if (!('code' in file)) continue\n\n file.code = file.code.replace(\n /declare module ['|\"]\\..*['|\"]/g,\n `declare module '${pkg.name}'`\n )\n }\n }\n },\n dtsPlugins\n ],\n external\n }\n ] as RollupOptions[]\n}\n","import type { Plugin, PluginImpl } from 'rollup'\n\nimport globalResolver from '../utils/globalResolver'\n\ninterface GlobalsOptions {\n external?: (string | RegExp)[]\n}\n\nexport function createGlobalsLinkage() {\n let globals = {}\n const dependencies = new Set<string>([])\n return [\n (({ external } = {}) => {\n return {\n name: 'globals',\n resolveId(id) {\n if (external?.some(dep => dep instanceof RegExp ? dep.test(id) : dep === id)) {\n dependencies.add(id)\n return { id, external: true }\n }\n return null\n },\n outputOptions(options) {\n globals = [...dependencies].reduce((acc, value) => ({\n ...acc,\n [value]: globalResolver(value)\n }), {})\n return { ...options, globals }\n }\n }\n }) as PluginImpl<GlobalsOptions>,\n { outputOptions: options => ({ ...options, globals }) } as Plugin\n ] as const\n}\n","export default function () {\n const cwd = process.cwd()\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n const pkg = require(`${cwd}/package.json`)\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":["globalResolver","external","startsWith","slice","replace","_","$1","toUpperCase","skip","options","name","load","id","patterns","some","pattern","includes","test","commonOutputOptions","exports","interop","sourcemap","withMinify","output","entryFileNames","plugins","terser","workspaceRoot","getWorkspaceDir","progress","entries","onProcessing","onTransforming","onProcessed","resolveId","source","importer","transform","writeBundle","bundle","Object","forEach","key","value","fileName","styled","index","indexPlugins","entry","entryPlugins","dts","dtsPlugins","pkg","jiek","noBrowser","outdir","outputOptions","dir","Error","namePrefix","exportsEntries","fromEntries","filter","map","globalsRegister","globalsOutput","globals","dependencies","Set","dep","RegExp","add","reduce","acc","createGlobalsLinkage","cwd","process","require","peerDependencies","optionalDependencies","keys","concat","externalResolver","commonOptions","commonPlugins","json","multiBars","MultiBar","clearOnComplete","hideCursor","format","Presets","shades_classic","values","progressState","esm","bar","create","update","type","message","umd","resolved","input","preserveModules","endsWith","esbuild","outputName","postcss","autoprefixer","minimize","sourceMap","extract","every","Boolean","setTimeout","stop","tsconfig","p","resolve","generateBundle","file","code"],"mappings":"wYAAA,SAAAA,EAAyBC,GAOnB,OAAAA,EAAS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A,MAAWkF,KAAQjF,OAAOqD,OAAOtD,GACzB,SAAUkF,IAEXA,EAAAC,KAAOD,EAAKC,KAAKtH,QACpB,iCACA,mBAAmBgD,EAAI1C,SAG7B,GAEFyC,GAEFlD,aArSN,IAA8BqH,CAuS5B"}
@@ -5,6 +5,7 @@ import autoprefixer from 'autoprefixer';
5
5
  import { dts } from 'rollup-plugin-dts';
6
6
  import esbuild from 'rollup-plugin-esbuild';
7
7
  import postcss from 'rollup-plugin-postcss';
8
+ import { MultiBar, Presets } from 'cli-progress';
8
9
  import { createGlobalsLinkage } from './rollup/plugins/globals.esm.js';
9
10
  import skip from './rollup/plugins/skip.esm.js';
10
11
  import { commonOutputOptions } from './rollup/utils/commonOptions.esm.js';
@@ -15,6 +16,25 @@ const workspaceRoot = getWorkspaceDir();
15
16
  function resolveWorkspacePath(p) {
16
17
  return resolve(workspaceRoot, p);
17
18
  }
19
+ function progress(entries, onProcessing, onTransforming, onProcessed) {
20
+ return {
21
+ name: "progress",
22
+ resolveId(source, importer) {
23
+ if (entries.includes(source) || importer === void 0)
24
+ onProcessing(source);
25
+ },
26
+ transform(_, id) {
27
+ onTransforming(id);
28
+ },
29
+ writeBundle(options, bundle) {
30
+ Object.entries(bundle).forEach(([key, value]) => {
31
+ if (value.name === void 0 || !("isEntry" in value))
32
+ return;
33
+ onProcessed(value.name, value.fileName);
34
+ });
35
+ }
36
+ };
37
+ }
18
38
  const template = ({
19
39
  styled = false,
20
40
  plugins: {
@@ -24,35 +44,92 @@ const template = ({
24
44
  } = {}
25
45
  } = {}, pkg) => {
26
46
  const { jiek: {
27
- noBrowser = false
47
+ noBrowser = false,
48
+ outdir = "dist"
28
49
  } = {} } = pkg;
50
+ const outputOptions = {
51
+ ...commonOutputOptions,
52
+ dir: outdir
53
+ };
29
54
  if (!pkg.name) {
30
55
  throw new Error("pkg.name is required");
31
56
  }
32
57
  const namePrefix = pkg.name.replace(/[@|/-](\w)/g, (_, $1) => $1.toUpperCase());
33
58
  const exportsEntries = Object.fromEntries(
34
- Object.entries(pkg.exports ?? {}).filter(([key]) => !/\.(json|css|scss)$/.test(key)).filter(([, value]) => typeof value === "object" && value["inner-src"] && value["import"]).map(([key, value]) => [
59
+ Object.entries(pkg.exports ?? {}).filter(([key]) => !key.startsWith(`./${outdir}`) && !key.startsWith(outdir)).filter(([key]) => !/\.(json|css|scss)$/.test(key)).filter(([, value]) => typeof value === "object" && value["inner-src"] && value["import"]).map(([key, value]) => [
35
60
  key.replace(/^\.$/, "index").replace(/^\.\//, ""),
36
61
  typeof value === "string" ? value : value["inner-src"]
37
62
  ])
38
63
  );
39
64
  const [globalsRegister, globalsOutput] = createGlobalsLinkage();
40
65
  const external = externalResolver();
66
+ const commonOptions = {};
41
67
  const commonPlugins = [
42
68
  json()
43
69
  ];
70
+ const multiBars = new MultiBar({
71
+ clearOnComplete: false,
72
+ hideCursor: true,
73
+ format: "- {bar} | {type} | {entry} | {message}"
74
+ }, Presets.shades_classic);
75
+ const entries = Object.values(exportsEntries);
76
+ const progressState = {
77
+ esm: entries.reduce((add, entry) => {
78
+ const bar = multiBars.create(100, 0);
79
+ bar.update(0, { type: "esm", entry, message: "waiting" });
80
+ return { ...add, [entry]: bar };
81
+ }, {}),
82
+ umd: entries.reduce((add, entry) => {
83
+ const bar = multiBars.create(100, 0);
84
+ bar.update(0, { type: "umd", entry, message: "waiting" });
85
+ return { ...add, [entry]: bar };
86
+ }, {}),
87
+ dts: entries.reduce((add, entry) => {
88
+ const bar = multiBars.create(100, 0);
89
+ bar.update(0, { type: "dts", entry, message: "waiting" });
90
+ return { ...add, [entry]: bar };
91
+ }, {})
92
+ };
93
+ const resolved = entries.reduce((entries2, entry) => ({ ...entries2, [entry]: false }), {});
44
94
  return [
45
95
  {
96
+ ...commonOptions,
46
97
  input: exportsEntries,
47
98
  output: [
48
99
  ...withMinify({
49
- ...commonOutputOptions,
100
+ ...outputOptions,
50
101
  format: "esm",
51
102
  entryFileNames: "[name].esm.js",
52
103
  preserveModules: true
53
104
  })
54
105
  ],
55
106
  plugins: [
107
+ progress(
108
+ Object.values(exportsEntries),
109
+ (entry) => {
110
+ const bar = progressState.esm[entry];
111
+ if (!bar)
112
+ return;
113
+ bar.update(0, { type: "esm", entry, message: "processing" });
114
+ },
115
+ (id) => {
116
+ const bar = progressState.esm[id];
117
+ if (!bar)
118
+ return;
119
+ bar.update(50, { type: "esm", entry: id, message: `transforming ${id}` });
120
+ },
121
+ (name, fileName) => {
122
+ const entry = exportsEntries[name];
123
+ const bar = progressState.esm[entry];
124
+ if (!bar)
125
+ return;
126
+ if (!fileName.endsWith(".min.js")) {
127
+ bar.update(95, { type: "esm", entry, message: `processed` });
128
+ } else {
129
+ bar.update(100, { type: "esm", entry, message: `finished` });
130
+ }
131
+ }
132
+ ),
56
133
  commonPlugins,
57
134
  globalsRegister({ external }),
58
135
  styled && skip({ patterns: [/\.s?css$/] }),
@@ -63,29 +140,55 @@ const template = ({
63
140
  ...Object.entries(exportsEntries).map(([name, input]) => {
64
141
  const outputName = namePrefix + (name === "index" ? "" : name.replace(/[@|/-](\w)/g, (_, $1) => $1.toUpperCase()));
65
142
  return {
143
+ ...commonOptions,
66
144
  input,
67
145
  output: noBrowser ? [
68
146
  ...withMinify({
69
- ...commonOutputOptions,
147
+ ...outputOptions,
70
148
  name: outputName,
71
149
  format: "cjs",
72
150
  entryFileNames: `${name}.cjs`
73
151
  })
74
152
  ] : [
75
153
  ...withMinify({
76
- ...commonOutputOptions,
154
+ ...outputOptions,
77
155
  name: outputName,
78
156
  format: "iife",
79
157
  entryFileNames: `${name}.iife.js`
80
158
  }),
81
159
  ...withMinify({
82
- ...commonOutputOptions,
160
+ ...outputOptions,
83
161
  name: outputName,
84
162
  format: "umd",
85
163
  entryFileNames: `${name}.umd.js`
86
164
  })
87
165
  ],
88
166
  plugins: [
167
+ progress(
168
+ [input],
169
+ (entry) => {
170
+ const bar = progressState.umd[entry];
171
+ if (!bar)
172
+ return;
173
+ bar.update(0, { type: "umd", entry, message: "processing" });
174
+ },
175
+ (id) => {
176
+ const bar = progressState.umd[input];
177
+ if (!bar)
178
+ return;
179
+ bar.update(50, { type: "umd", input, message: `transforming ${id}` });
180
+ },
181
+ (name2, fileName) => {
182
+ const bar = progressState.umd[input];
183
+ if (!bar)
184
+ return;
185
+ if (!fileName.endsWith(".min.js")) {
186
+ bar.update(95, { type: "umd", input, message: `processed` });
187
+ } else {
188
+ bar.update(100, { type: "umd", input, message: `finished` });
189
+ }
190
+ }
191
+ ),
89
192
  commonPlugins,
90
193
  globalsOutput,
91
194
  styled && postcss({
@@ -101,18 +204,51 @@ const template = ({
101
204
  };
102
205
  }),
103
206
  {
207
+ ...commonOptions,
104
208
  input: exportsEntries,
105
209
  output: [
210
+ {
211
+ dir: "dist"
212
+ },
106
213
  {
107
214
  dir: "dist",
108
215
  entryFileNames: ({ name }) => `${name.replace(/^src\//, "")}.esm.d.ts`,
109
216
  preserveModules: true
110
- },
111
- {
112
- dir: "dist"
113
217
  }
114
218
  ],
115
219
  plugins: [
220
+ progress(
221
+ Object.values(exportsEntries),
222
+ (entry) => {
223
+ const bar = progressState.dts[entry];
224
+ if (!bar)
225
+ return;
226
+ bar.update(0, { type: "dts", entry, message: "processing" });
227
+ },
228
+ (id) => {
229
+ const bar = progressState.dts[id];
230
+ if (!bar)
231
+ return;
232
+ bar.update(50, { type: "dts", entry: id, message: `transforming ${id}` });
233
+ },
234
+ (name, fileName) => {
235
+ const entry = exportsEntries[name];
236
+ const bar = progressState.dts[entry];
237
+ if (!bar)
238
+ return;
239
+ if (!fileName.endsWith(".esm.d.ts")) {
240
+ bar.update(95, { type: "dts", entry, message: `processed` });
241
+ } else {
242
+ bar.update(100, { type: "dts", entry, message: `finished` });
243
+ resolved[entry] = true;
244
+ }
245
+ if (Object.values(resolved).every(Boolean)) {
246
+ setTimeout(() => {
247
+ multiBars.stop();
248
+ }, 100);
249
+ }
250
+ }
251
+ ),
116
252
  commonPlugins,
117
253
  styled && skip({ patterns: [/\.s?css$/] }),
118
254
  dts({ tsconfig: resolveWorkspacePath("tsconfig.dts.json") }),
@@ -1 +1 @@
1
- {"version":3,"file":"rollup.esm.js","sources":["../src/rollup/index.ts"],"sourcesContent":["import { resolve } from 'node:path'\n\nimport type { Options } from '@jiek/pkger'\nimport { getWorkspaceDir } from '@jiek/utils/getWorkspaceDir'\nimport json from '@rollup/plugin-json'\nimport autoprefixer from 'autoprefixer'\nimport type { InputPluginOption, RollupOptions } from 'rollup'\nimport { dts } from 'rollup-plugin-dts'\nimport esbuild from 'rollup-plugin-esbuild'\nimport postcss from 'rollup-plugin-postcss'\n\nimport { createGlobalsLinkage } from './plugins/globals'\nimport skip from './plugins/skip'\nimport { commonOutputOptions } from './utils/commonOptions'\nimport externalResolver from './utils/externalResolver'\nimport withMinify from './utils/withMinify'\n\nconst workspaceRoot = getWorkspaceDir()\nfunction resolveWorkspacePath(p: string) {\n return resolve(workspaceRoot, p)\n}\n\nexport const template = (\n {\n styled = false,\n plugins: {\n index: indexPlugins = [],\n entry: entryPlugins = [],\n dts: dtsPlugins = []\n } = {}\n }: {\n /**\n * include styles files\n */\n styled?: boolean\n plugins?: {\n index?: InputPluginOption\n entry?: InputPluginOption\n dts?: InputPluginOption\n }\n } = {},\n pkg: {\n name?: string\n jiek?: Options\n exports?: Record<string, string | {\n import: string\n 'inner-src': string\n }>\n }\n) => {\n const { jiek: {\n noBrowser = false\n } = {} } = pkg\n if (!pkg.name) {\n throw new Error('pkg.name is required')\n }\n const namePrefix = pkg\n .name\n .replace(/[@|/-](\\w)/g, (_, $1) => $1.toUpperCase())\n const exportsEntries = Object.fromEntries(\n Object.entries(pkg.exports ?? {})\n // filter static files\n .filter(([key]) => !/\\.(json|css|scss)$/.test(key))\n // filter no `inner-src` or `import` field entries\n .filter(([, value]) => typeof value === 'object' && value['inner-src'] && value['import'])\n .map(([key, value]) => [\n key\n .replace(/^\\.$/, 'index')\n .replace(/^\\.\\//, ''),\n typeof value === 'string' ? value : value['inner-src']\n ])\n )\n\n const [globalsRegister, globalsOutput] = createGlobalsLinkage()\n const external = externalResolver()\n\n const commonPlugins = [\n json()\n ]\n return [\n {\n input: exportsEntries,\n output: [\n ...withMinify({\n ...commonOutputOptions,\n format: 'esm',\n entryFileNames: '[name].esm.js',\n preserveModules: true\n })\n ],\n plugins: [\n commonPlugins,\n globalsRegister({ external }),\n styled && skip({ patterns: [/\\.s?css$/] }),\n esbuild(),\n indexPlugins\n ]\n },\n ...Object.entries(exportsEntries).map(([name, input]) => {\n const outputName = namePrefix + (\n name === 'index' ? '' : (\n name.replace(/[@|/-](\\w)/g, (_, $1) => $1.toUpperCase())\n )\n )\n return {\n input: input,\n output: noBrowser ? [\n ...withMinify({\n ...commonOutputOptions,\n name: outputName,\n format: 'cjs',\n entryFileNames: `${name}.cjs`\n })\n ] : [\n ...withMinify({\n ...commonOutputOptions,\n name: outputName,\n format: 'iife',\n entryFileNames: `${name}.iife.js`\n }),\n ...withMinify({\n ...commonOutputOptions,\n name: outputName,\n format: 'umd',\n entryFileNames: `${name}.umd.js`\n })\n ],\n plugins: [\n commonPlugins,\n globalsOutput,\n styled && postcss({\n plugins: [autoprefixer],\n minimize: true,\n sourceMap: true,\n extract: `${name}.css`\n }),\n esbuild(),\n entryPlugins\n ],\n external\n }\n }),\n {\n input: exportsEntries,\n output: [\n {\n dir: 'dist',\n entryFileNames: ({ name }) => `${name.replace(/^src\\//, '')}.esm.d.ts`,\n preserveModules: true\n },\n {\n dir: 'dist'\n }\n ],\n plugins: [\n commonPlugins,\n styled && skip({ patterns: [/\\.s?css$/] }),\n dts({ tsconfig: resolveWorkspacePath('tsconfig.dts.json') }),\n {\n name: 'rollup-plugin-declare-module-replacer',\n /**\n * replace relative path `declare module './xxx'` to `declare module '{{package name}}'`\n * in output file generated\n */\n generateBundle(_, bundle) {\n for (const file of Object.values(bundle)) {\n if (!('code' in file)) continue\n\n file.code = file.code.replace(\n /declare module ['|\"]\\..*['|\"]/g,\n `declare module '${pkg.name}'`\n )\n }\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MAAA;AAAA,SACP;AAAA,OACF;AAAA,MACA,OAAS,EAAA;AAAA,QACP,aAAA;AAAA,QACA,UAAU,IAAK,CAAA,EAAE,UAAU,CAAC,UAAU,GAAG,CAAA;AAAA,QACzC,IAAI,EAAE,QAAA,EAAU,oBAAqB,CAAA,mBAAmB,GAAG,CAAA;AAAA,QAC3D;AAAA,UACE,IAAM,EAAA,uCAAA;AAAA;AAAA;AAAA;AAAA;AAAA,UAKN,cAAA,CAAe,GAAG,MAAQ,EAAA;AACxB,YAAA,KAAA,MAAW,IAAQ,IAAA,MAAA,CAAO,MAAO,CAAA,MAAM,CAAG,EAAA;AACxC,cAAA,IAAI,EAAE,MAAU,IAAA,IAAA,CAAA;AAAO,gBAAA,SAAA;AAEvB,cAAK,IAAA,CAAA,IAAA,GAAO,KAAK,IAAK,CAAA,OAAA;AAAA,gBACpB,gCAAA;AAAA,gBACA,CAAA,gBAAA,EAAmB,IAAI,IAAI,CAAA,CAAA,CAAA;AAAA,eAC7B,CAAA;AAAA,aACF;AAAA,WACF;AAAA,SACF;AAAA,QACA,UAAA;AAAA,OACF;AAAA,MACA,QAAA;AAAA,KACF;AAAA,GACF,CAAA;AACF;;;;"}
1
+ {"version":3,"file":"rollup.esm.js","sources":["../src/rollup/index.ts"],"sourcesContent":["import { resolve } from 'node:path'\n\nimport type { Options } from '@jiek/pkger'\nimport { getWorkspaceDir } from '@jiek/utils/getWorkspaceDir'\nimport json from '@rollup/plugin-json'\nimport autoprefixer from 'autoprefixer'\nimport { InputPluginOption, Plugin, RollupOptions } from 'rollup'\nimport { dts } from 'rollup-plugin-dts'\nimport esbuild from 'rollup-plugin-esbuild'\nimport postcss from 'rollup-plugin-postcss'\nimport { MultiBar, Presets } from 'cli-progress'\n\nimport { createGlobalsLinkage } from './plugins/globals'\nimport skip from './plugins/skip'\nimport { commonOutputOptions } from './utils/commonOptions'\nimport externalResolver from './utils/externalResolver'\nimport withMinify from './utils/withMinify'\n\nconst workspaceRoot = getWorkspaceDir()\nfunction resolveWorkspacePath(p: string) {\n return resolve(workspaceRoot, p)\n}\n\nfunction progress(\n entries: string[],\n onProcessing: (entry: string) => void,\n onTransforming: (id: string) => void,\n onProcessed: (name: string, fileName: string) => void\n): Plugin {\n return {\n name: 'progress',\n resolveId(source, importer) {\n if (entries.includes(source) || importer === undefined)\n onProcessing(source)\n },\n transform(_, id) {\n onTransforming(id)\n },\n writeBundle(options, bundle) {\n Object.entries(bundle).forEach(([key, value]) => {\n if (value.name === undefined || !('isEntry' in value)) return\n onProcessed(value.name, value.fileName)\n })\n }\n }\n}\n\nexport const template = (\n {\n styled = false,\n plugins: {\n index: indexPlugins = [],\n entry: entryPlugins = [],\n dts: dtsPlugins = []\n } = {}\n }: {\n /**\n * include styles files\n */\n styled?: boolean\n plugins?: {\n index?: InputPluginOption\n entry?: InputPluginOption\n dts?: InputPluginOption\n }\n } = {},\n pkg: {\n name?: string\n jiek?: Options\n exports?: Record<string, string | {\n import: string\n 'inner-src': string\n }>\n }\n) => {\n const { jiek: {\n noBrowser = false,\n outdir = 'dist'\n } = {} } = pkg\n const outputOptions = {\n ...commonOutputOptions,\n dir: outdir\n }\n if (!pkg.name) {\n throw new Error('pkg.name is required')\n }\n const namePrefix = pkg\n .name\n .replace(/[@|/-](\\w)/g, (_, $1) => $1.toUpperCase())\n const exportsEntries = Object.fromEntries(\n Object.entries(pkg.exports ?? {})\n // filter outdir entries\n .filter(([key]) => !key.startsWith(`./${outdir}`) && !key.startsWith(outdir))\n // filter static files\n .filter(([key]) => !/\\.(json|css|scss)$/.test(key))\n // filter no `inner-src` or `import` field entries\n .filter(([, value]) => typeof value === 'object' && value['inner-src'] && value['import'])\n .map(([key, value]) => [\n key\n .replace(/^\\.$/, 'index')\n .replace(/^\\.\\//, ''),\n typeof value === 'string' ? value : value['inner-src']\n ])\n )\n\n const [globalsRegister, globalsOutput] = createGlobalsLinkage()\n const external = externalResolver()\n\n const commonOptions = {\n } satisfies RollupOptions\n const commonPlugins = [\n json()\n ]\n const multiBars = new MultiBar({\n clearOnComplete: false,\n hideCursor: true,\n format: '- {bar} | {type} | {entry} | {message}'\n }, Presets.shades_classic)\n const entries = Object.values(exportsEntries)\n const progressState = {\n esm: entries.reduce((add, entry) => {\n const bar = multiBars.create(100, 0)\n bar.update(0, { type: 'esm', entry, message: 'waiting' })\n return { ...add, [entry]: bar }\n }, {} as Record<string, ReturnType<typeof multiBars.create>>),\n umd: entries.reduce((add, entry) => {\n const bar = multiBars.create(100, 0)\n bar.update(0, { type: 'umd', entry, message: 'waiting' })\n return { ...add, [entry]: bar }\n }, {} as Record<string, ReturnType<typeof multiBars.create>>),\n dts: entries.reduce((add, entry) => {\n const bar = multiBars.create(100, 0)\n bar.update(0, { type: 'dts', entry, message: 'waiting' })\n return { ...add, [entry]: bar }\n }, {} as Record<string, ReturnType<typeof multiBars.create>>)\n }\n const resolved = entries.reduce((entries, entry) => ({ ...entries, [entry]: false }), {} as Record<string, boolean>)\n return [\n {\n ...commonOptions,\n input: exportsEntries,\n output: [\n ...withMinify({\n ...outputOptions,\n format: 'esm',\n entryFileNames: '[name].esm.js',\n preserveModules: true\n })\n ],\n plugins: [\n progress(\n Object.values(exportsEntries),\n entry => {\n const bar = progressState.esm[entry]\n if (!bar) return\n bar.update(0, { type: 'esm', entry, message: 'processing' })\n },\n id => {\n const bar = progressState.esm[id]\n if (!bar) return\n bar.update(50, { type: 'esm', entry: id, message: `transforming ${id}` })\n },\n (name, fileName) => {\n const entry = exportsEntries[name]\n const bar = progressState.esm[entry]\n if (!bar) return\n if (!fileName.endsWith('.min.js')) {\n bar.update(95, { type: 'esm', entry, message: `processed` })\n } else {\n bar.update(100, { type: 'esm', entry, message: `finished` })\n }\n }\n ),\n commonPlugins,\n globalsRegister({ external }),\n styled && skip({ patterns: [/\\.s?css$/] }),\n esbuild(),\n indexPlugins\n ]\n },\n ...Object.entries(exportsEntries).map(([name, input]) => {\n const outputName = namePrefix + (\n name === 'index' ? '' : (\n name.replace(/[@|/-](\\w)/g, (_, $1) => $1.toUpperCase())\n )\n )\n return {\n ...commonOptions,\n input: input,\n output: noBrowser ? [\n ...withMinify({\n ...outputOptions,\n name: outputName,\n format: 'cjs',\n entryFileNames: `${name}.cjs`\n })\n ] : [\n ...withMinify({\n ...outputOptions,\n name: outputName,\n format: 'iife',\n entryFileNames: `${name}.iife.js`\n }),\n ...withMinify({\n ...outputOptions,\n name: outputName,\n format: 'umd',\n entryFileNames: `${name}.umd.js`\n })\n ],\n plugins: [\n progress(\n [input],\n entry => {\n const bar = progressState.umd[entry]\n if (!bar) return\n bar.update(0, { type: 'umd', entry, message: 'processing' })\n },\n id => {\n const bar = progressState.umd[input]\n if (!bar) return\n bar.update(50, { type: 'umd', input, message: `transforming ${id}` })\n },\n (name, fileName) => {\n const bar = progressState.umd[input]\n if (!bar) return\n if (!fileName.endsWith('.min.js')) {\n bar.update(95, { type: 'umd', input, message: `processed` })\n } else {\n bar.update(100, { type: 'umd', input, message: `finished` })\n }\n }\n ),\n commonPlugins,\n globalsOutput,\n styled && postcss({\n plugins: [autoprefixer],\n minimize: true,\n sourceMap: true,\n extract: `${name}.css`\n }),\n esbuild(),\n entryPlugins\n ],\n external\n }\n }),\n {\n ...commonOptions,\n input: exportsEntries,\n output: [\n {\n dir: 'dist'\n },\n {\n dir: 'dist',\n entryFileNames: ({ name }) => `${name.replace(/^src\\//, '')}.esm.d.ts`,\n preserveModules: true\n }\n ],\n plugins: [\n progress(\n Object.values(exportsEntries),\n entry => {\n const bar = progressState.dts[entry]\n if (!bar) return\n bar.update(0, { type: 'dts', entry, message: 'processing' })\n },\n id => {\n const bar = progressState.dts[id]\n if (!bar) return\n bar.update(50, { type: 'dts', entry: id, message: `transforming ${id}` })\n },\n (name, fileName) => {\n const entry = exportsEntries[name]\n const bar = progressState.dts[entry]\n if (!bar) return\n if (!fileName.endsWith('.esm.d.ts')) {\n bar.update(95, { type: 'dts', entry, message: `processed` })\n } else {\n bar.update(100, { type: 'dts', entry, message: `finished` })\n resolved[entry] = true\n }\n if (Object.values(resolved).every(Boolean)) {\n setTimeout(() => {\n multiBars.stop()\n }, 100)\n }\n }\n ),\n commonPlugins,\n styled && skip({ patterns: [/\\.s?css$/] }),\n dts({ tsconfig: resolveWorkspacePath('tsconfig.dts.json') }),\n {\n name: 'rollup-plugin-declare-module-replacer',\n /**\n * replace relative path `declare module './xxx'` to `declare module '{{package name}}'`\n * in output file generated\n */\n generateBundle(_, bundle) {\n for (const file of Object.values(bundle)) {\n if (!('code' in file)) continue\n\n file.code = file.code.replace(\n /declare module ['|\"]\\..*['|\"]/g,\n `declare module '${pkg.name}'`\n )\n }\n }\n },\n dtsPlugins\n ],\n external\n }\n ] as RollupOptions[]\n}\n"],"names":["entries","name"],"mappings":";;;;;;;;;;;;;;AAkBA,MAAM,gBAAgB,eAAgB,EAAA,CAAA;AACtC,SAAS,qBAAqB,CAAW,EAAA;AACvC,EAAO,OAAA,OAAA,CAAQ,eAAe,CAAC,CAAA,CAAA;AACjC,CAAA;AAEA,SAAS,QACP,CAAA,OAAA,EACA,YACA,EAAA,cAAA,EACA,WACQ,EAAA;AACR,EAAO,OAAA;AAAA,IACL,IAAM,EAAA,UAAA;AAAA,IACN,SAAA,CAAU,QAAQ,QAAU,EAAA;AAC1B,MAAA,IAAI,OAAQ,CAAA,QAAA,CAAS,MAAM,CAAA,IAAK,QAAa,KAAA,KAAA,CAAA;AAC3C,QAAA,YAAA,CAAa,MAAM,CAAA,CAAA;AAAA,KACvB;AAAA,IACA,SAAA,CAAU,GAAG,EAAI,EAAA;AACf,MAAA,cAAA,CAAe,EAAE,CAAA,CAAA;AAAA,KACnB;AAAA,IACA,WAAA,CAAY,SAAS,MAAQ,EAAA;AAC3B,MAAO,MAAA,CAAA,OAAA,CAAQ,MAAM,CAAE,CAAA,OAAA,CAAQ,CAAC,CAAC,GAAA,EAAK,KAAK,CAAM,KAAA;AAC/C,QAAA,IAAI,KAAM,CAAA,IAAA,KAAS,KAAa,CAAA,IAAA,EAAE,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AACxC,cAAA,IAAI,EAAE,MAAU,IAAA,IAAA,CAAA;AAAO,gBAAA,SAAA;AAEvB,cAAK,IAAA,CAAA,IAAA,GAAO,KAAK,IAAK,CAAA,OAAA;AAAA,gBACpB,gCAAA;AAAA,gBACA,CAAA,gBAAA,EAAmB,IAAI,IAAI,CAAA,CAAA,CAAA;AAAA,eAC7B,CAAA;AAAA,aACF;AAAA,WACF;AAAA,SACF;AAAA,QACA,UAAA;AAAA,OACF;AAAA,MACA,QAAA;AAAA,KACF;AAAA,GACF,CAAA;AACF;;;;"}
@@ -1,2 +1,2 @@
1
- import{resolve as e}from"node:path";import{getWorkspaceDir as r}from"@jiek/utils/getWorkspaceDir";import s from"@rollup/plugin-json";import t from"autoprefixer";import{dts as o}from"rollup-plugin-dts";import i from"rollup-plugin-esbuild";import n from"rollup-plugin-postcss";import{createGlobalsLinkage as p}from"./rollup/plugins/globals.esm.min.js";import l from"./rollup/plugins/skip.esm.min.js";import{commonOutputOptions as m}from"./rollup/utils/commonOptions.esm.min.js";import u from"./rollup/utils/externalResolver.esm.min.js";import a from"./rollup/utils/withMinify.esm.min.js";const c=r();const f=({styled:r=!1,plugins:{index:f=[],entry:d=[],dts:g=[]}={}}={},j)=>{const{jiek:{noBrowser:x=!1}={}}=j;if(!j.name)throw new Error("pkg.name is required");const y=j.name.replace(/[@|/-](\w)/g,((e,r)=>r.toUpperCase())),$=Object.fromEntries(Object.entries(j.exports??{}).filter((([e])=>!/\.(json|css|scss)$/.test(e))).filter((([,e])=>"object"==typeof e&&e["inner-src"]&&e.import)).map((([e,r])=>[e.replace(/^\.$/,"index").replace(/^\.\//,""),"string"==typeof r?r:r["inner-src"]]))),[b,w]=p(),k=u(),v=[s()];return[{input:$,output:[...a({...m,format:"esm",entryFileNames:"[name].esm.js",preserveModules:!0})],plugins:[v,b({external:k}),r&&l({patterns:[/\.s?css$/]}),i(),f]},...Object.entries($).map((([e,s])=>{const o=y+("index"===e?"":e.replace(/[@|/-](\w)/g,((e,r)=>r.toUpperCase())));return{input:s,output:x?[...a({...m,name:o,format:"cjs",entryFileNames:`${e}.cjs`})]:[...a({...m,name:o,format:"iife",entryFileNames:`${e}.iife.js`}),...a({...m,name:o,format:"umd",entryFileNames:`${e}.umd.js`})],plugins:[v,w,r&&n({plugins:[t],minimize:!0,sourceMap:!0,extract:`${e}.css`}),i(),d],external:k}})),{input:$,output:[{dir:"dist",entryFileNames:({name:e})=>`${e.replace(/^src\//,"")}.esm.d.ts`,preserveModules:!0},{dir:"dist"}],plugins:[v,r&&l({patterns:[/\.s?css$/]}),o({tsconfig:(F="tsconfig.dts.json",e(c,F))}),{name:"rollup-plugin-declare-module-replacer",generateBundle(e,r){for(const e of Object.values(r))"code"in e&&(e.code=e.code.replace(/declare module ['|"]\..*['|"]/g,`declare module '${j.name}'`))}},g],external:k}];var F};export{f as template};
1
+ import{resolve as e}from"node:path";import{getWorkspaceDir as s}from"@jiek/utils/getWorkspaceDir";import t from"@rollup/plugin-json";import r from"autoprefixer";import{dts as n}from"rollup-plugin-dts";import i from"rollup-plugin-esbuild";import o from"rollup-plugin-postcss";import{MultiBar as m,Presets as p}from"cli-progress";import{createGlobalsLinkage as a}from"./rollup/plugins/globals.esm.min.js";import u from"./rollup/plugins/skip.esm.min.js";import{commonOutputOptions as d}from"./rollup/utils/commonOptions.esm.min.js";import l from"./rollup/utils/externalResolver.esm.min.js";import c from"./rollup/utils/withMinify.esm.min.js";const g=s();function f(e,s,t,r){return{name:"progress",resolveId(t,r){(e.includes(t)||void 0===r)&&s(t)},transform(e,s){t(s)},writeBundle(e,s){Object.entries(s).forEach((([e,s])=>{void 0!==s.name&&"isEntry"in s&&r(s.name,s.fileName)}))}}}const y=({styled:s=!1,plugins:{index:y=[],entry:j=[],dts:h=[]}={}}={},$)=>{const{jiek:{noBrowser:b=!1,outdir:v="dist"}={}}=$,w={...d,dir:v};if(!$.name)throw new Error("pkg.name is required");const x=$.name.replace(/[@|/-](\w)/g,((e,s)=>s.toUpperCase())),O=Object.fromEntries(Object.entries($.exports??{}).filter((([e])=>!e.startsWith(`./${v}`)&&!e.startsWith(v))).filter((([e])=>!/\.(json|css|scss)$/.test(e))).filter((([,e])=>"object"==typeof e&&e["inner-src"]&&e.import)).map((([e,s])=>[e.replace(/^\.$/,"index").replace(/^\.\//,""),"string"==typeof s?s:s["inner-src"]]))),[N,W]=a(),k=l(),F={},B=[t()],C=new m({clearOnComplete:!1,hideCursor:!0,format:"- {bar} | {type} | {entry} | {message}"},p.shades_classic),E=Object.values(O),M={esm:E.reduce(((e,s)=>{const t=C.create(100,0);return t.update(0,{type:"esm",entry:s,message:"waiting"}),{...e,[s]:t}}),{}),umd:E.reduce(((e,s)=>{const t=C.create(100,0);return t.update(0,{type:"umd",entry:s,message:"waiting"}),{...e,[s]:t}}),{}),dts:E.reduce(((e,s)=>{const t=C.create(100,0);return t.update(0,{type:"dts",entry:s,message:"waiting"}),{...e,[s]:t}}),{})},U=E.reduce(((e,s)=>({...e,[s]:!1})),{});return[{...F,input:O,output:[...c({...w,format:"esm",entryFileNames:"[name].esm.js",preserveModules:!0})],plugins:[f(Object.values(O),(e=>{const s=M.esm[e];s&&s.update(0,{type:"esm",entry:e,message:"processing"})}),(e=>{const s=M.esm[e];s&&s.update(50,{type:"esm",entry:e,message:`transforming ${e}`})}),((e,s)=>{const t=O[e],r=M.esm[t];r&&(s.endsWith(".min.js")?r.update(100,{type:"esm",entry:t,message:"finished"}):r.update(95,{type:"esm",entry:t,message:"processed"}))})),B,N({external:k}),s&&u({patterns:[/\.s?css$/]}),i(),y]},...Object.entries(O).map((([e,t])=>{const n=x+("index"===e?"":e.replace(/[@|/-](\w)/g,((e,s)=>s.toUpperCase())));return{...F,input:t,output:b?[...c({...w,name:n,format:"cjs",entryFileNames:`${e}.cjs`})]:[...c({...w,name:n,format:"iife",entryFileNames:`${e}.iife.js`}),...c({...w,name:n,format:"umd",entryFileNames:`${e}.umd.js`})],plugins:[f([t],(e=>{const s=M.umd[e];s&&s.update(0,{type:"umd",entry:e,message:"processing"})}),(e=>{const s=M.umd[t];s&&s.update(50,{type:"umd",input:t,message:`transforming ${e}`})}),((e,s)=>{const r=M.umd[t];r&&(s.endsWith(".min.js")?r.update(100,{type:"umd",input:t,message:"finished"}):r.update(95,{type:"umd",input:t,message:"processed"}))})),B,W,s&&o({plugins:[r],minimize:!0,sourceMap:!0,extract:`${e}.css`}),i(),j],external:k}})),{...F,input:O,output:[{dir:"dist"},{dir:"dist",entryFileNames:({name:e})=>`${e.replace(/^src\//,"")}.esm.d.ts`,preserveModules:!0}],plugins:[f(Object.values(O),(e=>{const s=M.dts[e];s&&s.update(0,{type:"dts",entry:e,message:"processing"})}),(e=>{const s=M.dts[e];s&&s.update(50,{type:"dts",entry:e,message:`transforming ${e}`})}),((e,s)=>{const t=O[e],r=M.dts[t];r&&(s.endsWith(".esm.d.ts")?(r.update(100,{type:"dts",entry:t,message:"finished"}),U[t]=!0):r.update(95,{type:"dts",entry:t,message:"processed"}),Object.values(U).every(Boolean)&&setTimeout((()=>{C.stop()}),100))})),B,s&&u({patterns:[/\.s?css$/]}),n({tsconfig:(q="tsconfig.dts.json",e(g,q))}),{name:"rollup-plugin-declare-module-replacer",generateBundle(e,s){for(const e of Object.values(s))"code"in e&&(e.code=e.code.replace(/declare module ['|"]\..*['|"]/g,`declare module '${$.name}'`))}},h],external:k}];var q};export{y as template};
2
2
  //# sourceMappingURL=rollup.esm.min.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"rollup.esm.min.js","sources":["../src/rollup/index.ts"],"sourcesContent":["import { resolve } from 'node:path'\n\nimport type { Options } from '@jiek/pkger'\nimport { getWorkspaceDir } from '@jiek/utils/getWorkspaceDir'\nimport json from '@rollup/plugin-json'\nimport autoprefixer from 'autoprefixer'\nimport type { InputPluginOption, RollupOptions } from 'rollup'\nimport { dts } from 'rollup-plugin-dts'\nimport esbuild from 'rollup-plugin-esbuild'\nimport postcss from 'rollup-plugin-postcss'\n\nimport { createGlobalsLinkage } from './plugins/globals'\nimport skip from './plugins/skip'\nimport { commonOutputOptions } from './utils/commonOptions'\nimport externalResolver from './utils/externalResolver'\nimport withMinify from './utils/withMinify'\n\nconst workspaceRoot = getWorkspaceDir()\nfunction resolveWorkspacePath(p: string) {\n return resolve(workspaceRoot, p)\n}\n\nexport const template = (\n {\n styled = false,\n plugins: {\n index: indexPlugins = [],\n entry: entryPlugins = [],\n dts: dtsPlugins = []\n } = {}\n }: {\n /**\n * include styles files\n */\n styled?: boolean\n plugins?: {\n index?: InputPluginOption\n entry?: InputPluginOption\n dts?: InputPluginOption\n }\n } = {},\n pkg: {\n name?: string\n jiek?: Options\n exports?: Record<string, string | {\n import: string\n 'inner-src': string\n }>\n }\n) => {\n const { jiek: {\n noBrowser = false\n } = {} } = pkg\n if (!pkg.name) {\n throw new Error('pkg.name is required')\n }\n const namePrefix = pkg\n .name\n .replace(/[@|/-](\\w)/g, (_, $1) => $1.toUpperCase())\n const exportsEntries = Object.fromEntries(\n Object.entries(pkg.exports ?? {})\n // filter static files\n .filter(([key]) => !/\\.(json|css|scss)$/.test(key))\n // filter no `inner-src` or `import` field entries\n .filter(([, value]) => typeof value === 'object' && value['inner-src'] && value['import'])\n .map(([key, value]) => [\n key\n .replace(/^\\.$/, 'index')\n .replace(/^\\.\\//, ''),\n typeof value === 'string' ? value : value['inner-src']\n ])\n )\n\n const [globalsRegister, globalsOutput] = createGlobalsLinkage()\n const external = externalResolver()\n\n const commonPlugins = [\n json()\n ]\n return [\n {\n input: exportsEntries,\n output: [\n ...withMinify({\n ...commonOutputOptions,\n format: 'esm',\n entryFileNames: '[name].esm.js',\n preserveModules: true\n })\n ],\n plugins: [\n commonPlugins,\n globalsRegister({ external }),\n styled && skip({ patterns: [/\\.s?css$/] }),\n esbuild(),\n indexPlugins\n ]\n },\n ...Object.entries(exportsEntries).map(([name, input]) => {\n const outputName = namePrefix + (\n name === 'index' ? '' : (\n name.replace(/[@|/-](\\w)/g, (_, $1) => $1.toUpperCase())\n )\n )\n return {\n input: input,\n output: noBrowser ? [\n ...withMinify({\n ...commonOutputOptions,\n name: outputName,\n format: 'cjs',\n entryFileNames: `${name}.cjs`\n })\n ] : [\n ...withMinify({\n ...commonOutputOptions,\n name: outputName,\n format: 'iife',\n entryFileNames: `${name}.iife.js`\n }),\n ...withMinify({\n ...commonOutputOptions,\n name: outputName,\n format: 'umd',\n entryFileNames: `${name}.umd.js`\n })\n ],\n plugins: [\n commonPlugins,\n globalsOutput,\n styled && postcss({\n plugins: [autoprefixer],\n minimize: true,\n sourceMap: true,\n extract: `${name}.css`\n }),\n esbuild(),\n entryPlugins\n ],\n external\n }\n }),\n {\n input: exportsEntries,\n output: [\n {\n dir: 'dist',\n entryFileNames: ({ name }) => `${name.replace(/^src\\//, '')}.esm.d.ts`,\n preserveModules: true\n },\n {\n dir: 'dist'\n }\n ],\n plugins: [\n commonPlugins,\n styled && skip({ patterns: [/\\.s?css$/] }),\n dts({ tsconfig: resolveWorkspacePath('tsconfig.dts.json') }),\n {\n name: 'rollup-plugin-declare-module-replacer',\n /**\n * replace relative path `declare module './xxx'` to `declare module '{{package name}}'`\n * in output file generated\n */\n generateBundle(_, bundle) {\n for (const file of Object.values(bundle)) {\n if (!('code' in file)) continue\n\n file.code = file.code.replace(\n /declare module ['|\"]\\..*['|\"]/g,\n `declare module '${pkg.name}'`\n )\n }\n }\n },\n dtsPlugins\n ],\n external\n }\n ] as RollupOptions[]\n}\n"],"names":["workspaceRoot","getWorkspaceDir","template","styled","plugins","index","indexPlugins","entry","entryPlugins","dts","dtsPlugins","pkg","jiek","noBrowser","name","Error","namePrefix","replace","_","$1","toUpperCase","exportsEntries","Object","fromEntries","entries","exports","filter","key","test","value","map","globalsRegister","globalsOutput","createGlobalsLinkage","external","externalResolver","commonPlugins","json","input","output","withMinify","commonOutputOptions","format","entryFileNames","preserveModules","skip","patterns","esbuild","outputName","postcss","autoprefixer","minimize","sourceMap","extract","dir","tsconfig","p","resolve","generateBundle","bundle","file","values","code"],"mappings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7B,iBAElB0B,EAAW,IACTC,EACH3B,KAAMkC,EACNN,OAAQ,MACRC,eAAgB,GAAG7B,cAGvBV,QAAS,CACPgC,EACAJ,EACA7B,GAAU8C,EAAQ,CAChB7C,QAAS,CAAC8C,GACVC,UAAU,EACVC,WAAW,EACXC,QAAS,GAAGvC,UAEdiC,IACAvC,GAEF0B,WACF,IAEF,CACEI,MAAOjB,EACPkB,OAAQ,CACN,CACEe,IAAK,OACLX,eAAgB,EAAG7B,UAAW,GAAGA,EAAKG,QAAQ,SAAU,eACxD2B,iBAAiB,GAEnB,CACEU,IAAK,SAGTlD,QAAS,CACPgC,EACAjC,GAAU0C,EAAK,CAAEC,SAAU,CAAC,cAC5BrC,EAAI,CAAE8C,UA3IgBC,EA2Ie,oBA1IpCC,EAAQzD,EAAewD,MA2IxB,CACE1C,KAAM,wCAKN,cAAA4C,CAAexC,EAAGyC,GAChB,IAAA,MAAWC,KAAQtC,OAAOuC,OAAOF,GACzB,SAAUC,IAEXA,EAAAE,KAAOF,EAAKE,KAAK7C,QACpB,iCACA,mBAAmBN,EAAIG,SAG7B,GAEFJ,GAEFwB,aA/JN,IAA8BsB,CAiK5B"}
1
+ {"version":3,"file":"rollup.esm.min.js","sources":["../src/rollup/index.ts"],"sourcesContent":["import { resolve } from 'node:path'\n\nimport type { Options } from '@jiek/pkger'\nimport { getWorkspaceDir } from '@jiek/utils/getWorkspaceDir'\nimport json from '@rollup/plugin-json'\nimport autoprefixer from 'autoprefixer'\nimport { InputPluginOption, Plugin, RollupOptions } from 'rollup'\nimport { dts } from 'rollup-plugin-dts'\nimport esbuild from 'rollup-plugin-esbuild'\nimport postcss from 'rollup-plugin-postcss'\nimport { MultiBar, Presets } from 'cli-progress'\n\nimport { createGlobalsLinkage } from './plugins/globals'\nimport skip from './plugins/skip'\nimport { commonOutputOptions } from './utils/commonOptions'\nimport externalResolver from './utils/externalResolver'\nimport withMinify from './utils/withMinify'\n\nconst workspaceRoot = getWorkspaceDir()\nfunction resolveWorkspacePath(p: string) {\n return resolve(workspaceRoot, p)\n}\n\nfunction progress(\n entries: string[],\n onProcessing: (entry: string) => void,\n onTransforming: (id: string) => void,\n onProcessed: (name: string, fileName: string) => void\n): Plugin {\n return {\n name: 'progress',\n resolveId(source, importer) {\n if (entries.includes(source) || importer === undefined)\n onProcessing(source)\n },\n transform(_, id) {\n onTransforming(id)\n },\n writeBundle(options, bundle) {\n Object.entries(bundle).forEach(([key, value]) => {\n if (value.name === undefined || !('isEntry' in value)) return\n onProcessed(value.name, value.fileName)\n })\n }\n }\n}\n\nexport const template = (\n {\n styled = false,\n plugins: {\n index: indexPlugins = [],\n entry: entryPlugins = [],\n dts: dtsPlugins = []\n } = {}\n }: {\n /**\n * include styles files\n */\n styled?: boolean\n plugins?: {\n index?: InputPluginOption\n entry?: InputPluginOption\n dts?: InputPluginOption\n }\n } = {},\n pkg: {\n name?: string\n jiek?: Options\n exports?: Record<string, string | {\n import: string\n 'inner-src': string\n }>\n }\n) => {\n const { jiek: {\n noBrowser = false,\n outdir = 'dist'\n } = {} } = pkg\n const outputOptions = {\n ...commonOutputOptions,\n dir: outdir\n }\n if (!pkg.name) {\n throw new Error('pkg.name is required')\n }\n const namePrefix = pkg\n .name\n .replace(/[@|/-](\\w)/g, (_, $1) => $1.toUpperCase())\n const exportsEntries = Object.fromEntries(\n Object.entries(pkg.exports ?? {})\n // filter outdir entries\n .filter(([key]) => !key.startsWith(`./${outdir}`) && !key.startsWith(outdir))\n // filter static files\n .filter(([key]) => !/\\.(json|css|scss)$/.test(key))\n // filter no `inner-src` or `import` field entries\n .filter(([, value]) => typeof value === 'object' && value['inner-src'] && value['import'])\n .map(([key, value]) => [\n key\n .replace(/^\\.$/, 'index')\n .replace(/^\\.\\//, ''),\n typeof value === 'string' ? value : value['inner-src']\n ])\n )\n\n const [globalsRegister, globalsOutput] = createGlobalsLinkage()\n const external = externalResolver()\n\n const commonOptions = {\n } satisfies RollupOptions\n const commonPlugins = [\n json()\n ]\n const multiBars = new MultiBar({\n clearOnComplete: false,\n hideCursor: true,\n format: '- {bar} | {type} | {entry} | {message}'\n }, Presets.shades_classic)\n const entries = Object.values(exportsEntries)\n const progressState = {\n esm: entries.reduce((add, entry) => {\n const bar = multiBars.create(100, 0)\n bar.update(0, { type: 'esm', entry, message: 'waiting' })\n return { ...add, [entry]: bar }\n }, {} as Record<string, ReturnType<typeof multiBars.create>>),\n umd: entries.reduce((add, entry) => {\n const bar = multiBars.create(100, 0)\n bar.update(0, { type: 'umd', entry, message: 'waiting' })\n return { ...add, [entry]: bar }\n }, {} as Record<string, ReturnType<typeof multiBars.create>>),\n dts: entries.reduce((add, entry) => {\n const bar = multiBars.create(100, 0)\n bar.update(0, { type: 'dts', entry, message: 'waiting' })\n return { ...add, [entry]: bar }\n }, {} as Record<string, ReturnType<typeof multiBars.create>>)\n }\n const resolved = entries.reduce((entries, entry) => ({ ...entries, [entry]: false }), {} as Record<string, boolean>)\n return [\n {\n ...commonOptions,\n input: exportsEntries,\n output: [\n ...withMinify({\n ...outputOptions,\n format: 'esm',\n entryFileNames: '[name].esm.js',\n preserveModules: true\n })\n ],\n plugins: [\n progress(\n Object.values(exportsEntries),\n entry => {\n const bar = progressState.esm[entry]\n if (!bar) return\n bar.update(0, { type: 'esm', entry, message: 'processing' })\n },\n id => {\n const bar = progressState.esm[id]\n if (!bar) return\n bar.update(50, { type: 'esm', entry: id, message: `transforming ${id}` })\n },\n (name, fileName) => {\n const entry = exportsEntries[name]\n const bar = progressState.esm[entry]\n if (!bar) return\n if (!fileName.endsWith('.min.js')) {\n bar.update(95, { type: 'esm', entry, message: `processed` })\n } else {\n bar.update(100, { type: 'esm', entry, message: `finished` })\n }\n }\n ),\n commonPlugins,\n globalsRegister({ external }),\n styled && skip({ patterns: [/\\.s?css$/] }),\n esbuild(),\n indexPlugins\n ]\n },\n ...Object.entries(exportsEntries).map(([name, input]) => {\n const outputName = namePrefix + (\n name === 'index' ? '' : (\n name.replace(/[@|/-](\\w)/g, (_, $1) => $1.toUpperCase())\n )\n )\n return {\n ...commonOptions,\n input: input,\n output: noBrowser ? [\n ...withMinify({\n ...outputOptions,\n name: outputName,\n format: 'cjs',\n entryFileNames: `${name}.cjs`\n })\n ] : [\n ...withMinify({\n ...outputOptions,\n name: outputName,\n format: 'iife',\n entryFileNames: `${name}.iife.js`\n }),\n ...withMinify({\n ...outputOptions,\n name: outputName,\n format: 'umd',\n entryFileNames: `${name}.umd.js`\n })\n ],\n plugins: [\n progress(\n [input],\n entry => {\n const bar = progressState.umd[entry]\n if (!bar) return\n bar.update(0, { type: 'umd', entry, message: 'processing' })\n },\n id => {\n const bar = progressState.umd[input]\n if (!bar) return\n bar.update(50, { type: 'umd', input, message: `transforming ${id}` })\n },\n (name, fileName) => {\n const bar = progressState.umd[input]\n if (!bar) return\n if (!fileName.endsWith('.min.js')) {\n bar.update(95, { type: 'umd', input, message: `processed` })\n } else {\n bar.update(100, { type: 'umd', input, message: `finished` })\n }\n }\n ),\n commonPlugins,\n globalsOutput,\n styled && postcss({\n plugins: [autoprefixer],\n minimize: true,\n sourceMap: true,\n extract: `${name}.css`\n }),\n esbuild(),\n entryPlugins\n ],\n external\n }\n }),\n {\n ...commonOptions,\n input: exportsEntries,\n output: [\n {\n dir: 'dist'\n },\n {\n dir: 'dist',\n entryFileNames: ({ name }) => `${name.replace(/^src\\//, '')}.esm.d.ts`,\n preserveModules: true\n }\n ],\n plugins: [\n progress(\n Object.values(exportsEntries),\n entry => {\n const bar = progressState.dts[entry]\n if (!bar) return\n bar.update(0, { type: 'dts', entry, message: 'processing' })\n },\n id => {\n const bar = progressState.dts[id]\n if (!bar) return\n bar.update(50, { type: 'dts', entry: id, message: `transforming ${id}` })\n },\n (name, fileName) => {\n const entry = exportsEntries[name]\n const bar = progressState.dts[entry]\n if (!bar) return\n if (!fileName.endsWith('.esm.d.ts')) {\n bar.update(95, { type: 'dts', entry, message: `processed` })\n } else {\n bar.update(100, { type: 'dts', entry, message: `finished` })\n resolved[entry] = true\n }\n if (Object.values(resolved).every(Boolean)) {\n setTimeout(() => {\n multiBars.stop()\n }, 100)\n }\n }\n ),\n commonPlugins,\n styled && skip({ patterns: [/\\.s?css$/] }),\n dts({ tsconfig: resolveWorkspacePath('tsconfig.dts.json') }),\n {\n name: 'rollup-plugin-declare-module-replacer',\n /**\n * replace relative path `declare module './xxx'` to `declare module '{{package name}}'`\n * in output file generated\n */\n generateBundle(_, bundle) {\n for (const file of Object.values(bundle)) {\n if (!('code' in file)) continue\n\n file.code = file.code.replace(\n /declare module ['|\"]\\..*['|\"]/g,\n `declare module '${pkg.name}'`\n )\n }\n }\n },\n dtsPlugins\n ],\n external\n }\n ] as RollupOptions[]\n}\n"],"names":["workspaceRoot","getWorkspaceDir","progress","entries","onProcessing","onTransforming","onProcessed","name","resolveId","source","importer","includes","transform","_","id","writeBundle","options","bundle","Object","forEach","key","value","fileName","template","styled","plugins","index","indexPlugins","entry","entryPlugins","dts","dtsPlugins","pkg","jiek","noBrowser","outdir","outputOptions","commonOutputOptions","dir","Error","namePrefix","replace","$1","toUpperCase","exportsEntries","fromEntries","exports","filter","startsWith","test","map","globalsRegister","globalsOutput","createGlobalsLinkage","external","externalResolver","commonOptions","commonPlugins","json","multiBars","MultiBar","clearOnComplete","hideCursor","format","Presets","shades_classic","values","progressState","esm","reduce","add","bar","create","update","type","message","umd","resolved","input","output","withMinify","entryFileNames","preserveModules","endsWith","skip","patterns","esbuild","outputName","postcss","autoprefixer","minimize","sourceMap","extract","every","Boolean","setTimeout","stop","tsconfig","p","resolve","generateBundle","file","code"],"mappings":"+nBAkBA,MAAMA,EAAgBC,IAKtB,SAASC,EACPC,EACAC,EACAC,EACAC,GAEO,MAAA,CACLC,KAAM,WACN,SAAAC,CAAUC,EAAQC,IACZP,EAAQQ,SAASF,SAAwB,IAAbC,IAC9BN,EAAaK,EACjB,EACA,SAAAG,CAAUC,EAAGC,GACXT,EAAeS,EACjB,EACA,WAAAC,CAAYC,EAASC,GACZC,OAAAf,QAAQc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AK,OACL2C,eAAgB,EAAG1E,UAAW,GAAGA,EAAKkC,QAAQ,SAAU,eACxDyC,iBAAiB,IAGrBzD,QAAS,CACPvB,EACEgB,OAAOgD,OAAOtB,IACLhB,IACD,MAAA2C,EAAMJ,EAAcrC,IAAIF,GACzB2C,GACDA,EAAAE,OAAO,EAAG,CAAEC,KAAM,MAAO9C,QAAO+C,QAAS,cAAc,IAEvD7D,IACE,MAAAyD,EAAMJ,EAAcrC,IAAIhB,GACzByD,GACDA,EAAAE,OAAO,GAAI,CAAEC,KAAM,MAAO9C,MAAOd,EAAI6D,QAAS,gBAAgB7D,KAAM,IAE1E,CAACP,EAAMe,KACC,MAAAM,EAAQgB,EAAerC,GACvBgE,EAAMJ,EAAcrC,IAAIF,GACzB2C,IACAjD,EAAS6D,SAAS,cAGjBZ,EAAAE,OAAO,IAAK,CAAEC,KAAM,MAAO9C,QAAO+C,QAAS,aAC/CE,EAASjD,IAAS,GAHd2C,EAAAE,OAAO,GAAI,CAAEC,KAAM,MAAO9C,QAAO+C,QAAS,cAK5CzD,OAAOgD,OAAOW,GAAUgB,MAAMC,UAChCC,YAAW,KACTpC,EAAUqC,MAAK,GACd,KACL,IAGJvC,EACAjC,GAAU4D,EAAK,CAAEC,SAAU,CAAC,cAC5BvD,EAAI,CAAEmE,UAjRgBC,EAiRe,oBAhRpCC,EAAQnG,EAAekG,MAiRxB,CACE3F,KAAM,wCAKN,cAAA6F,CAAevF,EAAGI,GAChB,IAAA,MAAWoF,KAAQnF,OAAOgD,OAAOjD,GACzB,SAAUoF,IAEXA,EAAAC,KAAOD,EAAKC,KAAK7D,QACpB,iCACA,mBAAmBT,EAAIzB,SAG7B,GAEFwB,GAEFuB,aArSN,IAA8B4C,CAuS5B"}
@@ -6,7 +6,7 @@ function getRoot() {
6
6
  if (root)
7
7
  return root;
8
8
  const rootOption = program.getOptionValue("root");
9
- root = rootOption ? path.isAbsolute(rootOption) ? rootOption : path.resolve(process.cwd(), rootOption) : process.cwd();
9
+ root = rootOption ? path.isAbsolute(rootOption) ? rootOption : path.resolve(process.cwd(), rootOption) : void 0;
10
10
  return root;
11
11
  }
12
12
 
@@ -1 +1 @@
1
- {"version":3,"file":"getRoot.esm.js","sources":["../../src/utils/getRoot.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 : process.cwd()\n return root\n}\n"],"names":[],"mappings":";;;AAIA,IAAI,IAAA,CAAA;AACG,SAAS,OAAU,GAAA;AACxB,EAAI,IAAA,IAAA;AAAM,IAAO,OAAA,IAAA,CAAA;AAEjB,EAAM,MAAA,UAAA,GAAa,OAAQ,CAAA,cAAA,CAAe,MAAM,CAAA,CAAA;AAChD,EAAA,IAAA,GAAO,UACH,GAAA,IAAA,CAAK,UAAW,CAAA,UAAU,IACxB,UACA,GAAA,IAAA,CAAK,OAAQ,CAAA,OAAA,CAAQ,GAAI,EAAA,EAAG,UAAU,CAAA,GACxC,QAAQ,GAAI,EAAA,CAAA;AAChB,EAAO,OAAA,IAAA,CAAA;AACT;;;;"}
1
+ {"version":3,"file":"getRoot.esm.js","sources":["../../src/utils/getRoot.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"],"names":[],"mappings":";;;AAIA,IAAI,IAAA,CAAA;AACG,SAAS,OAAU,GAAA;AACxB,EAAI,IAAA,IAAA;AAAM,IAAO,OAAA,IAAA,CAAA;AAEjB,EAAM,MAAA,UAAA,GAAa,OAAQ,CAAA,cAAA,CAAe,MAAM,CAAA,CAAA;AAChD,EAAA,IAAA,GAAO,UACH,GAAA,IAAA,CAAK,UAAW,CAAA,UAAU,CACxB,GAAA,UAAA,GACA,IAAK,CAAA,OAAA,CAAQ,OAAQ,CAAA,GAAA,EAAO,EAAA,UAAU,CACxC,GAAA,KAAA,CAAA,CAAA;AACJ,EAAO,OAAA,IAAA,CAAA;AACT;;;;"}
@@ -1,2 +1,2 @@
1
- import o from"node:path";import{program as r}from"commander";let e;function t(){if(e)return e;const t=r.getOptionValue("root");return e=t?o.isAbsolute(t)?t:o.resolve(process.cwd(),t):process.cwd(),e}export{t as getRoot};
1
+ import o from"node:path";import{program as r}from"commander";let t;function e(){if(t)return t;const e=r.getOptionValue("root");return t=e?o.isAbsolute(e)?e:o.resolve(process.cwd(),e):void 0,t}export{e as getRoot};
2
2
  //# sourceMappingURL=getRoot.esm.min.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"getRoot.esm.min.js","sources":["../../src/utils/getRoot.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 : process.cwd()\n return root\n}\n"],"names":["root","getRoot","rootOption","program","getOptionValue","path","isAbsolute","resolve","process","cwd"],"mappings":"6DAIA,IAAIA,EACG,SAASC,IACV,GAAAD,EAAa,OAAAA,EAEX,MAAAE,EAAaC,EAAQC,eAAe,QAMnC,OALPJ,EAAOE,EACHG,EAAKC,WAAWJ,GACdA,EACAG,EAAKE,QAAQC,QAAQC,MAAOP,GAC9BM,QAAQC,MACLT,CACT"}
1
+ {"version":3,"file":"getRoot.esm.min.js","sources":["../../src/utils/getRoot.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"],"names":["root","getRoot","rootOption","program","getOptionValue","path","isAbsolute","resolve","process","cwd"],"mappings":"6DAIA,IAAIA,EACG,SAASC,IACV,GAAAD,EAAa,OAAAA,EAEX,MAAAE,EAAaC,EAAQC,eAAe,QAMnC,OALPJ,EAAOE,EACHG,EAAKC,WAAWJ,GACdA,EACAG,EAAKE,QAAQC,QAAQC,MAAOP,QAC9B,EACGF,CACT"}
@@ -1,4 +1,4 @@
1
- import { getWorkspaceDir } from '@jiek/utils/getWorkspaceDir';
1
+ import { isWorkspaceDir, getWorkspaceDir } from '@jiek/utils/getWorkspaceDir';
2
2
  import { type } from './filterSupport.esm.js';
3
3
  import { getRoot } from './getRoot.esm.js';
4
4
 
@@ -8,8 +8,14 @@ function getWD() {
8
8
  if (wd)
9
9
  return { wd, notWorkspace };
10
10
  const root = getRoot();
11
+ if (root !== void 0) {
12
+ const isWorkspace = isWorkspaceDir(root, type);
13
+ notWorkspace = !isWorkspace;
14
+ wd = root;
15
+ return { wd, notWorkspace };
16
+ }
11
17
  try {
12
- wd = getWorkspaceDir(root, type);
18
+ wd = getWorkspaceDir(type);
13
19
  } catch (e) {
14
20
  if ("message" in e && e.message === "workspace root not found") {
15
21
  wd = root;
@@ -1 +1 @@
1
- {"version":3,"file":"getWD.esm.js","sources":["../../src/utils/getWD.ts"],"sourcesContent":["import { getWorkspaceDir } 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 try {\n wd = getWorkspaceDir(root, 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"],"names":[],"mappings":";;;;AAKA,IAAI,EAAA,CAAA;AACJ,IAAI,YAAe,GAAA,KAAA,CAAA;AAEZ,SAAS,KAAQ,GAAA;AACtB,EAAI,IAAA,EAAA;AAAI,IAAO,OAAA,EAAE,IAAI,YAAa,EAAA,CAAA;AAElC,EAAA,MAAM,OAAO,OAAQ,EAAA,CAAA;AACrB,EAAI,IAAA;AACF,IAAK,EAAA,GAAA,eAAA,CAAgB,MAAM,IAAI,CAAA,CAAA;AAAA,WACxB,CAAG,EAAA;AAEV,IAAA,IAAI,SAAa,IAAA,CAAA,IAAK,CAAE,CAAA,OAAA,KAAY,0BAA4B,EAAA;AAC9D,MAAK,EAAA,GAAA,IAAA,CAAA;AACL,MAAe,YAAA,GAAA,IAAA,CAAA;AAAA,KACV,MAAA;AACL,MAAM,MAAA,CAAA,CAAA;AAAA,KACR;AAAA,GACF;AACA,EAAO,OAAA,EAAE,IAAI,YAAa,EAAA,CAAA;AAC5B;;;;"}
1
+ {"version":3,"file":"getWD.esm.js","sources":["../../src/utils/getWD.ts"],"sourcesContent":["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"],"names":[],"mappings":";;;;AAKA,IAAI,EAAA,CAAA;AACJ,IAAI,YAAe,GAAA,KAAA,CAAA;AAEZ,SAAS,KAAQ,GAAA;AACtB,EAAI,IAAA,EAAA;AAAI,IAAO,OAAA,EAAE,IAAI,YAAa,EAAA,CAAA;AAElC,EAAA,MAAM,OAAO,OAAQ,EAAA,CAAA;AACrB,EAAA,IAAI,SAAS,KAAW,CAAA,EAAA;AACtB,IAAM,MAAA,WAAA,GAAc,cAAe,CAAA,IAAA,EAAM,IAAI,CAAA,CAAA;AAC7C,IAAA,YAAA,GAAe,CAAC,WAAA,CAAA;AAChB,IAAK,EAAA,GAAA,IAAA,CAAA;AACL,IAAO,OAAA,EAAE,IAAI,YAAa,EAAA,CAAA;AAAA,GAC5B;AACA,EAAI,IAAA;AACF,IAAA,EAAA,GAAK,gBAAgB,IAAI,CAAA,CAAA;AAAA,WAClB,CAAG,EAAA;AAEV,IAAA,IAAI,SAAa,IAAA,CAAA,IAAK,CAAE,CAAA,OAAA,KAAY,0BAA4B,EAAA;AAC9D,MAAK,EAAA,GAAA,IAAA,CAAA;AACL,MAAe,YAAA,GAAA,IAAA,CAAA;AAAA,KACV,MAAA;AACL,MAAM,MAAA,CAAA,CAAA;AAAA,KACR;AAAA,GACF;AACA,EAAO,OAAA,EAAE,IAAI,YAAa,EAAA,CAAA;AAC5B;;;;"}
@@ -1,2 +1,2 @@
1
- import{getWorkspaceDir as o}from"@jiek/utils/getWorkspaceDir";import{type as t}from"./filterSupport.esm.min.js";import{getRoot as r}from"./getRoot.esm.min.js";let e,s=!1;function i(){if(e)return{wd:e,notWorkspace:s};const i=r();try{e=o(i,t)}catch(o){if(!("message"in o)||"workspace root not found"!==o.message)throw o;e=i,s=!0}return{wd:e,notWorkspace:s}}export{i as getWD};
1
+ import{isWorkspaceDir as o,getWorkspaceDir as t}from"@jiek/utils/getWorkspaceDir";import{type as r}from"./filterSupport.esm.min.js";import{getRoot as e}from"./getRoot.esm.min.js";let s,i=!1;function n(){if(s)return{wd:s,notWorkspace:i};const n=e();if(void 0!==n){const t=o(n,r);return i=!t,s=n,{wd:s,notWorkspace:i}}try{s=t(r)}catch(o){if(!("message"in o)||"workspace root not found"!==o.message)throw o;s=n,i=!0}return{wd:s,notWorkspace:i}}export{n as getWD};
2
2
  //# sourceMappingURL=getWD.esm.min.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"getWD.esm.min.js","sources":["../../src/utils/getWD.ts"],"sourcesContent":["import { getWorkspaceDir } 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 try {\n wd = getWorkspaceDir(root, 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"],"names":["wd","notWorkspace","getWD","root","getRoot","getWorkspaceDir","type","e","message"],"mappings":"+JAKA,IAAIA,EACAC,GAAe,EAEZ,SAASC,IACV,GAAAF,EAAW,MAAA,CAAEA,KAAIC,gBAErB,MAAME,EAAOC,IACT,IACGJ,EAAAK,EAAgBF,EAAMG,SACpBC,GAEP,KAAI,YAAaA,IAAmB,6BAAdA,EAAEC,QAIhB,MAAAD,EAHDP,EAAAG,EACUF,GAAA,CAInB,CACO,MAAA,CAAED,KAAIC,eACf"}
1
+ {"version":3,"file":"getWD.esm.min.js","sources":["../../src/utils/getWD.ts"],"sourcesContent":["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"],"names":["wd","notWorkspace","getWD","root","getRoot","isWorkspace","isWorkspaceDir","type","getWorkspaceDir","e","message"],"mappings":"mLAKA,IAAIA,EACAC,GAAe,EAEZ,SAASC,IACV,GAAAF,EAAW,MAAA,CAAEA,KAAIC,gBAErB,MAAME,EAAOC,IACb,QAAa,IAATD,EAAoB,CAChB,MAAAE,EAAcC,EAAeH,EAAMI,GAGlC,OAFPN,GAAgBI,EACXL,EAAAG,EACE,CAAEH,KAAIC,eACf,CACI,IACFD,EAAKQ,EAAgBD,SACdE,GAEP,KAAI,YAAaA,IAAmB,6BAAdA,EAAEC,QAIhB,MAAAD,EAHDT,EAAAG,EACUF,GAAA,CAInB,CACO,MAAA,CAAED,KAAIC,eACf"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jiek",
3
- "version": "0.2.10",
3
+ "version": "0.3.0",
4
4
  "description": "YiJie's personal kits.",
5
5
  "bin": {
6
6
  "jiek": "bin/jiek.js",
@@ -37,12 +37,13 @@
37
37
  "@rollup/plugin-json": "^6.0.1",
38
38
  "@rollup/plugin-terser": "^0.4.4",
39
39
  "autoprefixer": "^10.4.16",
40
+ "cli-progress": "^3.12.0",
40
41
  "commander": "^12.0.0",
41
42
  "detect-indent": "^6.1.0",
42
43
  "inquirer": "^8.2.6",
43
- "micromatch": "^4.0.5",
44
44
  "js-yaml": "^4.1.0",
45
45
  "jsonc-parser": "^3.2.1",
46
+ "micromatch": "^4.0.5",
46
47
  "rollup": "^4.1.5",
47
48
  "rollup-plugin-copy": "^3.5.0",
48
49
  "rollup-plugin-dts": "^6.1.0",
@@ -59,14 +60,12 @@
59
60
  "@npm/types": "^1.0.2",
60
61
  "@pnpm/filter-workspace-packages": "^7.2.13",
61
62
  "@pnpm/workspace.pkgs-graph": "^2.0.15",
62
- "@types/js-yaml": "^4.0.9",
63
+ "@types/cli-progress": "^3.11.5",
63
64
  "@types/inquirer": "^9.0.7",
65
+ "@types/js-yaml": "^4.0.9",
64
66
  "@types/micromatch": "^4.0.6",
65
67
  "esbuild-register": "^3.5.0"
66
68
  },
67
- "scripts": {
68
- "build": "jiek-dev build"
69
- },
70
69
  "types": "./dist/index.d.ts",
71
70
  "main": "./dist/index.cjs",
72
71
  "module": "./dist/index.esm.js",