jiek 0.4.6 → 0.4.7-alpha.10

Sign up to get free protection for your applications and to get access to all the features.
Files changed (144) hide show
  1. package/README.md +22 -1
  2. package/bin/jiek.js +9 -5
  3. package/dist/cli.cjs +4734 -406
  4. package/dist/cli.d.cts +97 -0
  5. package/dist/cli.d.ts +96 -1
  6. package/dist/cli.js +5006 -0
  7. package/dist/cli.min.cjs +19 -2
  8. package/dist/cli.min.js +19 -0
  9. package/dist/index.cjs +0 -1
  10. package/dist/index.d.cts +58 -0
  11. package/dist/index.d.ts +47 -46
  12. package/dist/{index.esm.js → index.js} +0 -1
  13. package/dist/index.min.cjs +0 -1
  14. package/dist/index.min.js +1 -0
  15. package/dist/rollup/index.cjs +4669 -0
  16. package/dist/rollup/index.d.cts +53 -0
  17. package/dist/rollup/index.d.ts +53 -0
  18. package/dist/rollup/index.js +4666 -0
  19. package/dist/rollup/index.min.cjs +19 -0
  20. package/dist/rollup/index.min.js +19 -0
  21. package/package.json +52 -33
  22. package/src/cli.ts +9 -0
  23. package/src/commands/base.ts +8 -0
  24. package/src/commands/build.ts +159 -0
  25. package/src/commands/init.ts +373 -0
  26. package/src/commands/publish.ts +156 -0
  27. package/src/index.ts +8 -0
  28. package/src/inner.ts +11 -0
  29. package/src/merge-package-json.ts +75 -0
  30. package/src/rollup/base.ts +72 -0
  31. package/src/rollup/index.ts +420 -0
  32. package/src/rollup/plugins/globals.ts +34 -0
  33. package/src/rollup/plugins/progress.ts +26 -0
  34. package/src/rollup/plugins/skip.ts +23 -0
  35. package/src/rollup/utils/commonOptions.ts +9 -0
  36. package/src/rollup/utils/externalResolver.ts +21 -0
  37. package/src/rollup/utils/globalResolver.ts +13 -0
  38. package/src/rollup/utils/withMinify.ts +18 -0
  39. package/src/utils/filterSupport.ts +84 -0
  40. package/src/utils/getExports.ts +100 -0
  41. package/src/utils/getRoot.ts +16 -0
  42. package/src/utils/getWD.ts +31 -0
  43. package/src/utils/loadConfig.ts +93 -0
  44. package/src/utils/tsRegister.ts +22 -0
  45. package/dist/base.esm.d.ts +0 -55
  46. package/dist/cli.cjs.map +0 -1
  47. package/dist/cli.esm.d.ts +0 -2
  48. package/dist/cli.esm.js +0 -9
  49. package/dist/cli.esm.js.map +0 -1
  50. package/dist/cli.esm.min.js +0 -2
  51. package/dist/cli.esm.min.js.map +0 -1
  52. package/dist/cli.min.cjs.map +0 -1
  53. package/dist/commands/base.esm.js +0 -5
  54. package/dist/commands/base.esm.js.map +0 -1
  55. package/dist/commands/base.esm.min.js +0 -2
  56. package/dist/commands/base.esm.min.js.map +0 -1
  57. package/dist/commands/build.esm.js +0 -58
  58. package/dist/commands/build.esm.js.map +0 -1
  59. package/dist/commands/build.esm.min.js +0 -2
  60. package/dist/commands/build.esm.min.js.map +0 -1
  61. package/dist/commands/init.esm.js +0 -271
  62. package/dist/commands/init.esm.js.map +0 -1
  63. package/dist/commands/init.esm.min.js +0 -2
  64. package/dist/commands/init.esm.min.js.map +0 -1
  65. package/dist/commands/publish.esm.js +0 -87
  66. package/dist/commands/publish.esm.js.map +0 -1
  67. package/dist/commands/publish.esm.min.js +0 -2
  68. package/dist/commands/publish.esm.min.js.map +0 -1
  69. package/dist/index.cjs.map +0 -1
  70. package/dist/index.esm.d.ts +0 -6
  71. package/dist/index.esm.js.map +0 -1
  72. package/dist/index.esm.min.js +0 -2
  73. package/dist/index.esm.min.js.map +0 -1
  74. package/dist/index.min.cjs.map +0 -1
  75. package/dist/inner.esm.js +0 -10
  76. package/dist/inner.esm.js.map +0 -1
  77. package/dist/inner.esm.min.js +0 -2
  78. package/dist/inner.esm.min.js.map +0 -1
  79. package/dist/merge-package-json.esm.js +0 -64
  80. package/dist/merge-package-json.esm.js.map +0 -1
  81. package/dist/merge-package-json.esm.min.js +0 -2
  82. package/dist/merge-package-json.esm.min.js.map +0 -1
  83. package/dist/pkg.esm.js +0 -4
  84. package/dist/pkg.esm.js.map +0 -1
  85. package/dist/pkg.esm.min.js +0 -2
  86. package/dist/pkg.esm.min.js.map +0 -1
  87. package/dist/rollup/plugins/globals.esm.js +0 -31
  88. package/dist/rollup/plugins/globals.esm.js.map +0 -1
  89. package/dist/rollup/plugins/globals.esm.min.js +0 -2
  90. package/dist/rollup/plugins/globals.esm.min.js.map +0 -1
  91. package/dist/rollup/plugins/skip.esm.js +0 -16
  92. package/dist/rollup/plugins/skip.esm.js.map +0 -1
  93. package/dist/rollup/plugins/skip.esm.min.js +0 -2
  94. package/dist/rollup/plugins/skip.esm.min.js.map +0 -1
  95. package/dist/rollup/utils/commonOptions.esm.js +0 -9
  96. package/dist/rollup/utils/commonOptions.esm.js.map +0 -1
  97. package/dist/rollup/utils/commonOptions.esm.min.js +0 -2
  98. package/dist/rollup/utils/commonOptions.esm.min.js.map +0 -1
  99. package/dist/rollup/utils/externalResolver.esm.js +0 -12
  100. package/dist/rollup/utils/externalResolver.esm.js.map +0 -1
  101. package/dist/rollup/utils/externalResolver.esm.min.js +0 -2
  102. package/dist/rollup/utils/externalResolver.esm.min.js.map +0 -1
  103. package/dist/rollup/utils/globalResolver.esm.js +0 -9
  104. package/dist/rollup/utils/globalResolver.esm.js.map +0 -1
  105. package/dist/rollup/utils/globalResolver.esm.min.js +0 -2
  106. package/dist/rollup/utils/globalResolver.esm.min.js.map +0 -1
  107. package/dist/rollup/utils/withMinify.esm.js +0 -15
  108. package/dist/rollup/utils/withMinify.esm.js.map +0 -1
  109. package/dist/rollup/utils/withMinify.esm.min.js +0 -2
  110. package/dist/rollup/utils/withMinify.esm.min.js.map +0 -1
  111. package/dist/rollup.cjs +0 -330
  112. package/dist/rollup.cjs.map +0 -1
  113. package/dist/rollup.d.ts +0 -23
  114. package/dist/rollup.esm.d.ts +0 -23
  115. package/dist/rollup.esm.js +0 -248
  116. package/dist/rollup.esm.js.map +0 -1
  117. package/dist/rollup.esm.min.js +0 -2
  118. package/dist/rollup.esm.min.js.map +0 -1
  119. package/dist/rollup.min.cjs +0 -2
  120. package/dist/rollup.min.cjs.map +0 -1
  121. package/dist/utils/commondir.esm.js +0 -25
  122. package/dist/utils/commondir.esm.js.map +0 -1
  123. package/dist/utils/commondir.esm.min.js +0 -2
  124. package/dist/utils/commondir.esm.min.js.map +0 -1
  125. package/dist/utils/filterSupport.esm.js +0 -67
  126. package/dist/utils/filterSupport.esm.js.map +0 -1
  127. package/dist/utils/filterSupport.esm.min.js +0 -2
  128. package/dist/utils/filterSupport.esm.min.js.map +0 -1
  129. package/dist/utils/getRoot.esm.js +0 -14
  130. package/dist/utils/getRoot.esm.js.map +0 -1
  131. package/dist/utils/getRoot.esm.min.js +0 -2
  132. package/dist/utils/getRoot.esm.min.js.map +0 -1
  133. package/dist/utils/getWD.esm.js +0 -31
  134. package/dist/utils/getWD.esm.js.map +0 -1
  135. package/dist/utils/getWD.esm.min.js +0 -2
  136. package/dist/utils/getWD.esm.min.js.map +0 -1
  137. package/dist/utils/loadConfig.esm.js +0 -75
  138. package/dist/utils/loadConfig.esm.js.map +0 -1
  139. package/dist/utils/loadConfig.esm.min.js +0 -2
  140. package/dist/utils/loadConfig.esm.min.js.map +0 -1
  141. package/dist/utils/tsRegister.esm.js +0 -24
  142. package/dist/utils/tsRegister.esm.js.map +0 -1
  143. package/dist/utils/tsRegister.esm.min.js +0 -2
  144. package/dist/utils/tsRegister.esm.min.js.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"file":"rollup.cjs","sources":["../src/rollup/utils/globalResolver.ts","../src/rollup/plugins/globals.ts","../src/rollup/plugins/skip.ts","../src/rollup/utils/commonOptions.ts","../src/rollup/utils/externalResolver.ts","../src/rollup/utils/withMinify.ts","../src/rollup/index.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 { 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","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","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","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(/(\\.c?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 { MultiBar, Presets } from 'cli-progress'\nimport type { InputPluginOption, Plugin, RollupOptions } from 'rollup'\nimport { dts } from '@jiek/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 {\n JIEK_SILENT,\n JIEK_TARGET,\n JIEK_ROOT\n} = process.env\nconst silent = JIEK_SILENT === 'true'\nconst target = JIEK_TARGET ?? 'esm,umd,dts'\nconst ACCEPTED_TARGETS = ['esm', 'umd', 'dts']\nconst targets = (\n target\n .split(',')\n .filter(Boolean)\n .filter(t => ACCEPTED_TARGETS.includes(t))\n) as ('esm' | 'umd' | 'dts')[]\nconst workspaceRoot = JIEK_ROOT ?? getWorkspaceDir()\nfunction resolveWorkspacePath(p: string) {\n return resolve(workspaceRoot, p)\n}\n\nfunction watchProgress(\n entries: string[],\n onProcessing: (entry: 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 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 if (targets.length === 0)\n throw new Error('no target specified')\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 const maxLengthEntry = Math.max(...Object.values(exportsEntries).map(v => v.length))\n function paddingEntry(entry: string) {\n return entry.padEnd(maxLengthEntry)\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 addBarsByEntries = (type: 'esm' | 'umd' | 'dts') => entries\n .reduce((add, entry) => {\n const bar = multiBars.create(100, 0)\n bar.update(0, { type, entry: paddingEntry(entry), message: 'waiting' })\n return { ...add, [entry]: bar }\n }, {} as Record<string, ReturnType<typeof multiBars.create>>)\n const progressState: Partial<Record<'esm' | 'umd' | 'dts', ReturnType<typeof addBarsByEntries>>> = {}\n targets.forEach(target => {\n progressState[target] = addBarsByEntries(target)\n })\n const resolved = entries.reduce((entries, entry) => ({ ...entries, [entry]: false }), {} as Record<string, boolean>)\n const watchingProgress = (\n type: 'esm' | 'umd' | 'dts',\n isLast = false,\n defaultEntry?: string\n ) => {\n const group = progressState[type]\n if (!group) throw new Error(`target ${type} found`)\n return watchProgress(\n Object.values(exportsEntries),\n entry => {\n const e = defaultEntry ?? entry\n const bar = group[e]\n if (!bar) return\n bar.update(0, { type, entry: paddingEntry(e), message: 'processing' })\n },\n (name, fileName) => {\n const e = defaultEntry ?? exportsEntries[name]\n const bar = group[e]\n if (!bar) return\n const endsReg = {\n esm: /\\.min\\.js$/,\n umd: /\\.min\\.c?js$/,\n dts: /\\.esm\\.d\\.ts$/\n }[type]\n if (!endsReg.test(fileName)) {\n bar.update(95, { type, entry: paddingEntry(e), message: 'processed' })\n } else {\n bar.update(100, { type, entry: paddingEntry(e), message: 'finished' })\n }\n if (isLast) {\n resolved[e] = true\n if (Object.values(resolved).every(Boolean)) {\n setTimeout(() => multiBars.stop(), 200)\n }\n }\n }\n )\n }\n const esmOpts: (isLast: boolean) => RollupOptions = isLast => ({\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 watchingProgress('esm', isLast),\n commonPlugins,\n globalsRegister({ external }),\n styled && skip({ patterns: [/\\.s?css$/] }),\n esbuild(),\n indexPlugins\n ]\n })\n const umdOpts: (isLast: boolean) => RollupOptions[] = isLast => 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 watchingProgress('umd', isLast, input),\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 const dtsOpts: (isLast: boolean) => RollupOptions = isLast => ({\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 watchingProgress('dts', isLast),\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 const optionsMap = { esm: esmOpts, umd: umdOpts, dts: dtsOpts }\n return targets.flatMap(target => {\n const optsGen = optionsMap[target as 'esm' | 'umd' | 'dts']\n if (optsGen === undefined)\n throw new Error(`target ${target} is not supported`)\n const opts = optsGen(target === targets[targets.length - 1])\n if (Array.isArray(opts)) return opts\n return [opts]\n })\n}\n"],"names":["terser","getWorkspaceDir","resolve","json","MultiBar","Presets","target","entries","esbuild","postcss","autoprefixer","dts"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA,uBAAA,CAAyB,QAAkB,EAAA;AAOzC,EAAI,IAAA,QAAA,CAAS,UAAW,CAAA,OAAO,CAAG,EAAA;AAChC,IAAO,OAAA,QAAA,CAAS,MAAM,CAAC,CAAA,CAAA;AAAA,GACzB;AACA,EAA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A,CAAA;AACrD,IAAA,MAAM,OAAO,OAAQA,CAAAA,OAAAA,KAAW,QAAQ,OAAQ,CAAA,MAAA,GAAS,CAAC,CAAC,CAAA,CAAA;AAC3D,IAAI,IAAA,KAAA,CAAM,QAAQ,IAAI,CAAA;AAAG,MAAO,OAAA,IAAA,CAAA;AAChC,IAAA,OAAO,CAAC,IAAI,CAAA,CAAA;AAAA,GACb,CAAA,CAAA;AACH;;;;"}
package/dist/rollup.d.ts DELETED
@@ -1,23 +0,0 @@
1
- import { Options } from '@jiek/pkger';
2
- import { InputPluginOption, RollupOptions } from 'rollup';
3
-
4
- declare const template: ({ styled, plugins: { index: indexPlugins, entry: entryPlugins, dts: dtsPlugins } }: {
5
- /**
6
- * include styles files
7
- */
8
- styled?: boolean | undefined;
9
- plugins?: {
10
- index?: InputPluginOption;
11
- entry?: InputPluginOption;
12
- dts?: InputPluginOption;
13
- } | undefined;
14
- } | undefined, pkg: {
15
- name?: string;
16
- jiek?: Options;
17
- exports?: Record<string, string | {
18
- import: string;
19
- 'inner-src': string;
20
- }>;
21
- }) => RollupOptions[];
22
-
23
- export { template };
@@ -1,23 +0,0 @@
1
- import { Options } from '@jiek/pkger';
2
- import { InputPluginOption, RollupOptions } from 'rollup';
3
-
4
- declare const template: ({ styled, plugins: { index: indexPlugins, entry: entryPlugins, dts: dtsPlugins } }: {
5
- /**
6
- * include styles files
7
- */
8
- styled?: boolean | undefined;
9
- plugins?: {
10
- index?: InputPluginOption;
11
- entry?: InputPluginOption;
12
- dts?: InputPluginOption;
13
- } | undefined;
14
- } | undefined, pkg: {
15
- name?: string;
16
- jiek?: Options;
17
- exports?: Record<string, string | {
18
- import: string;
19
- 'inner-src': string;
20
- }>;
21
- }) => RollupOptions[];
22
-
23
- export { template };
@@ -1,248 +0,0 @@
1
- import { resolve } from 'node:path';
2
- import { getWorkspaceDir } from '@jiek/utils/getWorkspaceDir';
3
- import json from '@rollup/plugin-json';
4
- import autoprefixer from 'autoprefixer';
5
- import { MultiBar, Presets } from 'cli-progress';
6
- import { dts } from '@jiek/rollup-plugin-dts';
7
- import esbuild from 'rollup-plugin-esbuild';
8
- import postcss from 'rollup-plugin-postcss';
9
- import { createGlobalsLinkage } from './rollup/plugins/globals.esm.js';
10
- import skip from './rollup/plugins/skip.esm.js';
11
- import { commonOutputOptions } from './rollup/utils/commonOptions.esm.js';
12
- import externalResolver from './rollup/utils/externalResolver.esm.js';
13
- import withMinify from './rollup/utils/withMinify.esm.js';
14
-
15
- const {
16
- JIEK_SILENT,
17
- JIEK_TARGET,
18
- JIEK_ROOT
19
- } = process.env;
20
- const target = JIEK_TARGET ?? "esm,umd,dts";
21
- const ACCEPTED_TARGETS = ["esm", "umd", "dts"];
22
- const targets = target.split(",").filter(Boolean).filter((t) => ACCEPTED_TARGETS.includes(t));
23
- const workspaceRoot = JIEK_ROOT ?? getWorkspaceDir();
24
- function resolveWorkspacePath(p) {
25
- return resolve(workspaceRoot, p);
26
- }
27
- function watchProgress(entries, onProcessing, onProcessed) {
28
- return {
29
- name: "progress",
30
- resolveId(source, importer) {
31
- if (entries.includes(source) || importer === void 0)
32
- onProcessing(source);
33
- },
34
- writeBundle(options, bundle) {
35
- Object.entries(bundle).forEach(([key, value]) => {
36
- if (value.name === void 0 || !("isEntry" in value))
37
- return;
38
- onProcessed(value.name, value.fileName);
39
- });
40
- }
41
- };
42
- }
43
- const template = ({
44
- styled = false,
45
- plugins: {
46
- index: indexPlugins = [],
47
- entry: entryPlugins = [],
48
- dts: dtsPlugins = []
49
- } = {}
50
- } = {}, pkg) => {
51
- if (targets.length === 0)
52
- throw new Error("no target specified");
53
- const { jiek: {
54
- noBrowser = false,
55
- outdir = "dist"
56
- } = {} } = pkg;
57
- const outputOptions = {
58
- ...commonOutputOptions,
59
- dir: outdir
60
- };
61
- if (!pkg.name) {
62
- throw new Error("pkg.name is required");
63
- }
64
- const namePrefix = pkg.name.replace(/[@|/-](\w)/g, (_, $1) => $1.toUpperCase());
65
- const exportsEntries = Object.fromEntries(
66
- 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]) => [
67
- key.replace(/^\.$/, "index").replace(/^\.\//, ""),
68
- typeof value === "string" ? value : value["inner-src"]
69
- ])
70
- );
71
- const maxLengthEntry = Math.max(...Object.values(exportsEntries).map((v) => v.length));
72
- function paddingEntry(entry) {
73
- return entry.padEnd(maxLengthEntry);
74
- }
75
- const [globalsRegister, globalsOutput] = createGlobalsLinkage();
76
- const external = externalResolver();
77
- const commonOptions = {};
78
- const commonPlugins = [
79
- json()
80
- ];
81
- const multiBars = new MultiBar({
82
- clearOnComplete: false,
83
- hideCursor: true,
84
- format: "- {bar} | {type} | {entry} | {message}"
85
- }, Presets.shades_classic);
86
- const entries = Object.values(exportsEntries);
87
- const addBarsByEntries = (type) => entries.reduce((add, entry) => {
88
- const bar = multiBars.create(100, 0);
89
- bar.update(0, { type, entry: paddingEntry(entry), message: "waiting" });
90
- return { ...add, [entry]: bar };
91
- }, {});
92
- const progressState = {};
93
- targets.forEach((target2) => {
94
- progressState[target2] = addBarsByEntries(target2);
95
- });
96
- const resolved = entries.reduce((entries2, entry) => ({ ...entries2, [entry]: false }), {});
97
- const watchingProgress = (type, isLast = false, defaultEntry) => {
98
- const group = progressState[type];
99
- if (!group)
100
- throw new Error(`target ${type} found`);
101
- return watchProgress(
102
- Object.values(exportsEntries),
103
- (entry) => {
104
- const e = defaultEntry ?? entry;
105
- const bar = group[e];
106
- if (!bar)
107
- return;
108
- bar.update(0, { type, entry: paddingEntry(e), message: "processing" });
109
- },
110
- (name, fileName) => {
111
- const e = defaultEntry ?? exportsEntries[name];
112
- const bar = group[e];
113
- if (!bar)
114
- return;
115
- const endsReg = {
116
- esm: /\.min\.js$/,
117
- umd: /\.min\.c?js$/,
118
- dts: /\.esm\.d\.ts$/
119
- }[type];
120
- if (!endsReg.test(fileName)) {
121
- bar.update(95, { type, entry: paddingEntry(e), message: "processed" });
122
- } else {
123
- bar.update(100, { type, entry: paddingEntry(e), message: "finished" });
124
- }
125
- if (isLast) {
126
- resolved[e] = true;
127
- if (Object.values(resolved).every(Boolean)) {
128
- setTimeout(() => multiBars.stop(), 200);
129
- }
130
- }
131
- }
132
- );
133
- };
134
- const esmOpts = (isLast) => ({
135
- ...commonOptions,
136
- input: exportsEntries,
137
- output: [
138
- ...withMinify({
139
- ...outputOptions,
140
- format: "esm",
141
- entryFileNames: "[name].esm.js",
142
- preserveModules: true
143
- })
144
- ],
145
- plugins: [
146
- watchingProgress("esm", isLast),
147
- commonPlugins,
148
- globalsRegister({ external }),
149
- styled && skip({ patterns: [/\.s?css$/] }),
150
- esbuild(),
151
- indexPlugins
152
- ]
153
- });
154
- const umdOpts = (isLast) => Object.entries(exportsEntries).map(([name, input]) => {
155
- const outputName = namePrefix + (name === "index" ? "" : name.replace(/[@|/-](\w)/g, (_, $1) => $1.toUpperCase()));
156
- return {
157
- ...commonOptions,
158
- input,
159
- output: noBrowser ? [
160
- ...withMinify({
161
- ...outputOptions,
162
- name: outputName,
163
- format: "cjs",
164
- entryFileNames: `${name}.cjs`
165
- })
166
- ] : [
167
- ...withMinify({
168
- ...outputOptions,
169
- name: outputName,
170
- format: "iife",
171
- entryFileNames: `${name}.iife.js`
172
- }),
173
- ...withMinify({
174
- ...outputOptions,
175
- name: outputName,
176
- format: "umd",
177
- entryFileNames: `${name}.umd.js`
178
- })
179
- ],
180
- plugins: [
181
- watchingProgress("umd", isLast, input),
182
- commonPlugins,
183
- globalsOutput,
184
- styled && postcss({
185
- plugins: [autoprefixer],
186
- minimize: true,
187
- sourceMap: true,
188
- extract: `${name}.css`
189
- }),
190
- esbuild(),
191
- entryPlugins
192
- ],
193
- external
194
- };
195
- });
196
- const dtsOpts = (isLast) => ({
197
- ...commonOptions,
198
- input: exportsEntries,
199
- output: [
200
- {
201
- dir: "dist"
202
- },
203
- {
204
- dir: "dist",
205
- entryFileNames: ({ name }) => `${name.replace(/^src\//, "")}.esm.d.ts`,
206
- preserveModules: true
207
- }
208
- ],
209
- plugins: [
210
- watchingProgress("dts", isLast),
211
- commonPlugins,
212
- styled && skip({ patterns: [/\.s?css$/] }),
213
- dts({ tsconfig: resolveWorkspacePath("tsconfig.dts.json") }),
214
- {
215
- name: "rollup-plugin-declare-module-replacer",
216
- /**
217
- * replace relative path `declare module './xxx'` to `declare module '{{package name}}'`
218
- * in output file generated
219
- */
220
- generateBundle(_, bundle) {
221
- for (const file of Object.values(bundle)) {
222
- if (!("code" in file))
223
- continue;
224
- file.code = file.code.replace(
225
- /declare module ['|"]\..*['|"]/g,
226
- `declare module '${pkg.name}'`
227
- );
228
- }
229
- }
230
- },
231
- dtsPlugins
232
- ],
233
- external
234
- });
235
- const optionsMap = { esm: esmOpts, umd: umdOpts, dts: dtsOpts };
236
- return targets.flatMap((target2) => {
237
- const optsGen = optionsMap[target2];
238
- if (optsGen === void 0)
239
- throw new Error(`target ${target2} is not supported`);
240
- const opts = optsGen(target2 === targets[targets.length - 1]);
241
- if (Array.isArray(opts))
242
- return opts;
243
- return [opts];
244
- });
245
- };
246
-
247
- export { template };
248
- //# sourceMappingURL=rollup.esm.js.map
@@ -1 +0,0 @@
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 { MultiBar, Presets } from 'cli-progress'\nimport type { InputPluginOption, Plugin, RollupOptions } from 'rollup'\nimport { dts } from '@jiek/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 {\n JIEK_SILENT,\n JIEK_TARGET,\n JIEK_ROOT\n} = process.env\nconst silent = JIEK_SILENT === 'true'\nconst target = JIEK_TARGET ?? 'esm,umd,dts'\nconst ACCEPTED_TARGETS = ['esm', 'umd', 'dts']\nconst targets = (\n target\n .split(',')\n .filter(Boolean)\n .filter(t => ACCEPTED_TARGETS.includes(t))\n) as ('esm' | 'umd' | 'dts')[]\nconst workspaceRoot = JIEK_ROOT ?? getWorkspaceDir()\nfunction resolveWorkspacePath(p: string) {\n return resolve(workspaceRoot, p)\n}\n\nfunction watchProgress(\n entries: string[],\n onProcessing: (entry: 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 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 if (targets.length === 0)\n throw new Error('no target specified')\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 const maxLengthEntry = Math.max(...Object.values(exportsEntries).map(v => v.length))\n function paddingEntry(entry: string) {\n return entry.padEnd(maxLengthEntry)\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 addBarsByEntries = (type: 'esm' | 'umd' | 'dts') => entries\n .reduce((add, entry) => {\n const bar = multiBars.create(100, 0)\n bar.update(0, { type, entry: paddingEntry(entry), message: 'waiting' })\n return { ...add, [entry]: bar }\n }, {} as Record<string, ReturnType<typeof multiBars.create>>)\n const progressState: Partial<Record<'esm' | 'umd' | 'dts', ReturnType<typeof addBarsByEntries>>> = {}\n targets.forEach(target => {\n progressState[target] = addBarsByEntries(target)\n })\n const resolved = entries.reduce((entries, entry) => ({ ...entries, [entry]: false }), {} as Record<string, boolean>)\n const watchingProgress = (\n type: 'esm' | 'umd' | 'dts',\n isLast = false,\n defaultEntry?: string\n ) => {\n const group = progressState[type]\n if (!group) throw new Error(`target ${type} found`)\n return watchProgress(\n Object.values(exportsEntries),\n entry => {\n const e = defaultEntry ?? entry\n const bar = group[e]\n if (!bar) return\n bar.update(0, { type, entry: paddingEntry(e), message: 'processing' })\n },\n (name, fileName) => {\n const e = defaultEntry ?? exportsEntries[name]\n const bar = group[e]\n if (!bar) return\n const endsReg = {\n esm: /\\.min\\.js$/,\n umd: /\\.min\\.c?js$/,\n dts: /\\.esm\\.d\\.ts$/\n }[type]\n if (!endsReg.test(fileName)) {\n bar.update(95, { type, entry: paddingEntry(e), message: 'processed' })\n } else {\n bar.update(100, { type, entry: paddingEntry(e), message: 'finished' })\n }\n if (isLast) {\n resolved[e] = true\n if (Object.values(resolved).every(Boolean)) {\n setTimeout(() => multiBars.stop(), 200)\n }\n }\n }\n )\n }\n const esmOpts: (isLast: boolean) => RollupOptions = isLast => ({\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 watchingProgress('esm', isLast),\n commonPlugins,\n globalsRegister({ external }),\n styled && skip({ patterns: [/\\.s?css$/] }),\n esbuild(),\n indexPlugins\n ]\n })\n const umdOpts: (isLast: boolean) => RollupOptions[] = isLast => 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 watchingProgress('umd', isLast, input),\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 const dtsOpts: (isLast: boolean) => RollupOptions = isLast => ({\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 watchingProgress('dts', isLast),\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 const optionsMap = { esm: esmOpts, umd: umdOpts, dts: dtsOpts }\n return targets.flatMap(target => {\n const optsGen = optionsMap[target as 'esm' | 'umd' | 'dts']\n if (optsGen === undefined)\n throw new Error(`target ${target} is not supported`)\n const opts = optsGen(target === targets[targets.length - 1])\n if (Array.isArray(opts)) return opts\n return [opts]\n })\n}\n"],"names":["target","entries"],"mappings":";;;;;;;;;;;;;;AAkBA,MAAM;AAAA,EACJ,WAAA;AAAA,EACA,WAAA;AAAA,EACA,SAAA;AACF,CAAA,GAAI,OAAQ,CAAA,GAAA,CAAA;AAEZ,MAAM,SAAS,WAAe,IAAA,aAAA,CAAA;AAC9B,MAAM,gBAAmB,GAAA,CAAC,KAAO,EAAA,KAAA,EAAO,KAAK,CAAA,CAAA;AAC7C,MAAM,OACJ,GAAA,MAAA,CACG,KAAM,CAAA,GAAG,CACT,CAAA,MAAA,CAAO,OAAO,CAAA,CACd,MAAO,CAAA,CAAA,CAAA,KAAK,gBAAiB,CAAA,QAAA,CAAS,CAAC,CAAC,CAAA,CAAA;AAE7C,MAAM,aAAA,GAAgB,aAAa,eAAgB,EAAA,CAAA;AACnD,SAAS,qBAAqB,CAAW,EAAA;AACvC,EAAO,OAAA,OAAA,CAAQ,eAAe,CAAC,CAAA,CAAA;AACjC,CAAA;AAEA,SAAS,aAAA,CACP,OACA,EAAA,YAAA,EACA,WACQ,EAAA;AACR,EAAO,OAAA;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AAa,EAAE,GAAA,EAAK,SAAS,GAAK,EAAA,OAAA,EAAS,KAAK,OAAQ,EAAA,CAAA;AAC9D,EAAO,OAAA,OAAA,CAAQ,OAAQ,CAAA,CAAAD,OAAU,KAAA;AAC/B,IAAM,MAAA,OAAA,GAAU,WAAWA,OAA+B,CAAA,CAAA;AAC1D,IAAA,IAAI,OAAY,KAAA,KAAA,CAAA;AACd,MAAA,MAAM,IAAI,KAAA,CAAM,CAAUA,OAAAA,EAAAA,OAAM,CAAmB,iBAAA,CAAA,CAAA,CAAA;AACrD,IAAA,MAAM,OAAO,OAAQA,CAAAA,OAAAA,KAAW,QAAQ,OAAQ,CAAA,MAAA,GAAS,CAAC,CAAC,CAAA,CAAA;AAC3D,IAAI,IAAA,KAAA,CAAM,QAAQ,IAAI,CAAA;AAAG,MAAO,OAAA,IAAA,CAAA;AAChC,IAAA,OAAO,CAAC,IAAI,CAAA,CAAA;AAAA,GACb,CAAA,CAAA;AACH;;;;"}
@@ -1,2 +0,0 @@
1
- import{resolve as e}from"node:path";import{getWorkspaceDir as r}from"@jiek/utils/getWorkspaceDir";import t from"@rollup/plugin-json";import s from"autoprefixer";import{MultiBar as n,Presets as o}from"cli-progress";import{dts as i}from"@jiek/rollup-plugin-dts";import m from"rollup-plugin-esbuild";import p from"rollup-plugin-postcss";import{createGlobalsLinkage as l}from"./rollup/plugins/globals.esm.min.js";import a from"./rollup/plugins/skip.esm.min.js";import{commonOutputOptions as u}from"./rollup/utils/commonOptions.esm.min.js";import c from"./rollup/utils/externalResolver.esm.min.js";import d from"./rollup/utils/withMinify.esm.min.js";const{JIEK_SILENT:f,JIEK_TARGET:g,JIEK_ROOT:j}=process.env,y=["esm","umd","dts"],h=(g??"esm,umd,dts").split(",").filter(Boolean).filter((e=>y.includes(e))),v=j??r();const $=({styled:r=!1,plugins:{index:f=[],entry:g=[],dts:j=[]}={}}={},y)=>{if(0===h.length)throw new Error("no target specified");const{jiek:{noBrowser:$=!1,outdir:w="dist"}={}}=y,E={...u,dir:w};if(!y.name)throw new Error("pkg.name is required");const b=y.name.replace(/[@|/-](\w)/g,((e,r)=>r.toUpperCase())),O=Object.fromEntries(Object.entries(y.exports??{}).filter((([e])=>!e.startsWith(`./${w}`)&&!e.startsWith(w))).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"]]))),x=Math.max(...Object.values(O).map((e=>e.length)));function N(e){return e.padEnd(x)}const[k,M]=l(),B=c(),F={},I=[t()],T=new n({clearOnComplete:!1,hideCursor:!0,format:"- {bar} | {type} | {entry} | {message}"},o.shades_classic),C=Object.values(O),_={};h.forEach((e=>{var r;_[e]=(r=e,C.reduce(((e,t)=>{const s=T.create(100,0);return s.update(0,{type:r,entry:N(t),message:"waiting"}),{...e,[t]:s}}),{}))}));const A=C.reduce(((e,r)=>({...e,[r]:!1})),{}),J=(e,r=!1,t)=>{const s=_[e];if(!s)throw new Error(`target ${e} found`);return function(e,r,t){return{name:"progress",resolveId(t,s){(e.includes(t)||void 0===s)&&r(t)},writeBundle(e,r){Object.entries(r).forEach((([e,r])=>{void 0!==r.name&&"isEntry"in r&&t(r.name,r.fileName)}))}}}(Object.values(O),(r=>{const n=t??r,o=s[n];o&&o.update(0,{type:e,entry:N(n),message:"processing"})}),((n,o)=>{const i=t??O[n],m=s[i];if(!m)return;({esm:/\.min\.js$/,umd:/\.min\.c?js$/,dts:/\.esm\.d\.ts$/})[e].test(o)?m.update(100,{type:e,entry:N(i),message:"finished"}):m.update(95,{type:e,entry:N(i),message:"processed"}),r&&(A[i]=!0,Object.values(A).every(Boolean)&&setTimeout((()=>T.stop()),200))}))},K={esm:e=>({...F,input:O,output:[...d({...E,format:"esm",entryFileNames:"[name].esm.js",preserveModules:!0})],plugins:[J("esm",e),I,k({external:B}),r&&a({patterns:[/\.s?css$/]}),m(),f]}),umd:e=>Object.entries(O).map((([t,n])=>{const o=b+("index"===t?"":t.replace(/[@|/-](\w)/g,((e,r)=>r.toUpperCase())));return{...F,input:n,output:$?[...d({...E,name:o,format:"cjs",entryFileNames:`${t}.cjs`})]:[...d({...E,name:o,format:"iife",entryFileNames:`${t}.iife.js`}),...d({...E,name:o,format:"umd",entryFileNames:`${t}.umd.js`})],plugins:[J("umd",e,n),I,M,r&&p({plugins:[s],minimize:!0,sourceMap:!0,extract:`${t}.css`}),m(),g],external:B}})),dts:t=>{return{...F,input:O,output:[{dir:"dist"},{dir:"dist",entryFileNames:({name:e})=>`${e.replace(/^src\//,"")}.esm.d.ts`,preserveModules:!0}],plugins:[J("dts",t),I,r&&a({patterns:[/\.s?css$/]}),i({tsconfig:(s="tsconfig.dts.json",e(v,s))}),{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 '${y.name}'`))}},j],external:B};var s}};return h.flatMap((e=>{const r=K[e];if(void 0===r)throw new Error(`target ${e} is not supported`);const t=r(e===h[h.length-1]);return Array.isArray(t)?t:[t]}))};export{$ as template};
2
- //# sourceMappingURL=rollup.esm.min.js.map
@@ -1 +0,0 @@
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 { MultiBar, Presets } from 'cli-progress'\nimport type { InputPluginOption, Plugin, RollupOptions } from 'rollup'\nimport { dts } from '@jiek/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 {\n JIEK_SILENT,\n JIEK_TARGET,\n JIEK_ROOT\n} = process.env\nconst silent = JIEK_SILENT === 'true'\nconst target = JIEK_TARGET ?? 'esm,umd,dts'\nconst ACCEPTED_TARGETS = ['esm', 'umd', 'dts']\nconst targets = (\n target\n .split(',')\n .filter(Boolean)\n .filter(t => ACCEPTED_TARGETS.includes(t))\n) as ('esm' | 'umd' | 'dts')[]\nconst workspaceRoot = JIEK_ROOT ?? getWorkspaceDir()\nfunction resolveWorkspacePath(p: string) {\n return resolve(workspaceRoot, p)\n}\n\nfunction watchProgress(\n entries: string[],\n onProcessing: (entry: 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 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 if (targets.length === 0)\n throw new Error('no target specified')\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 const maxLengthEntry = Math.max(...Object.values(exportsEntries).map(v => v.length))\n function paddingEntry(entry: string) {\n return entry.padEnd(maxLengthEntry)\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 addBarsByEntries = (type: 'esm' | 'umd' | 'dts') => entries\n .reduce((add, entry) => {\n const bar = multiBars.create(100, 0)\n bar.update(0, { type, entry: paddingEntry(entry), message: 'waiting' })\n return { ...add, [entry]: bar }\n }, {} as Record<string, ReturnType<typeof multiBars.create>>)\n const progressState: Partial<Record<'esm' | 'umd' | 'dts', ReturnType<typeof addBarsByEntries>>> = {}\n targets.forEach(target => {\n progressState[target] = addBarsByEntries(target)\n })\n const resolved = entries.reduce((entries, entry) => ({ ...entries, [entry]: false }), {} as Record<string, boolean>)\n const watchingProgress = (\n type: 'esm' | 'umd' | 'dts',\n isLast = false,\n defaultEntry?: string\n ) => {\n const group = progressState[type]\n if (!group) throw new Error(`target ${type} found`)\n return watchProgress(\n Object.values(exportsEntries),\n entry => {\n const e = defaultEntry ?? entry\n const bar = group[e]\n if (!bar) return\n bar.update(0, { type, entry: paddingEntry(e), message: 'processing' })\n },\n (name, fileName) => {\n const e = defaultEntry ?? exportsEntries[name]\n const bar = group[e]\n if (!bar) return\n const endsReg = {\n esm: /\\.min\\.js$/,\n umd: /\\.min\\.c?js$/,\n dts: /\\.esm\\.d\\.ts$/\n }[type]\n if (!endsReg.test(fileName)) {\n bar.update(95, { type, entry: paddingEntry(e), message: 'processed' })\n } else {\n bar.update(100, { type, entry: paddingEntry(e), message: 'finished' })\n }\n if (isLast) {\n resolved[e] = true\n if (Object.values(resolved).every(Boolean)) {\n setTimeout(() => multiBars.stop(), 200)\n }\n }\n }\n )\n }\n const esmOpts: (isLast: boolean) => RollupOptions = isLast => ({\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 watchingProgress('esm', isLast),\n commonPlugins,\n globalsRegister({ external }),\n styled && skip({ patterns: [/\\.s?css$/] }),\n esbuild(),\n indexPlugins\n ]\n })\n const umdOpts: (isLast: boolean) => RollupOptions[] = isLast => 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 watchingProgress('umd', isLast, input),\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 const dtsOpts: (isLast: boolean) => RollupOptions = isLast => ({\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 watchingProgress('dts', isLast),\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 const optionsMap = { esm: esmOpts, umd: umdOpts, dts: dtsOpts }\n return targets.flatMap(target => {\n const optsGen = optionsMap[target as 'esm' | 'umd' | 'dts']\n if (optsGen === undefined)\n throw new Error(`target ${target} is not supported`)\n const opts = optsGen(target === targets[targets.length - 1])\n if (Array.isArray(opts)) return opts\n return [opts]\n })\n}\n"],"names":["JIEK_SILENT","JIEK_TARGET","JIEK_ROOT","process","env","ACCEPTED_TARGETS","targets","split","filter","Boolean","t","includes","workspaceRoot","getWorkspaceDir","template","styled","plugins","index","indexPlugins","entry","entryPlugins","dts","dtsPlugins","pkg","length","Error","jiek","noBrowser","outdir","outputOptions","commonOutputOptions","dir","name","namePrefix","replace","_","$1","toUpperCase","exportsEntries","Object","fromEntries","entries","exports","key","startsWith","test","value","map","maxLengthEntry","Math","max","values","v","paddingEntry","padEnd","globalsRegister","globalsOutput","createGlobalsLinkage","external","externalResolver","commonOptions","commonPlugins","json","multiBars","MultiBar","clearOnComplete","hideCursor","format","Presets","shades_classic","progressState","forEach","target","type","reduce","add","bar","create","update","message","resolved","watchingProgress","isLast","defaultEntry","group","onProcessing","onProcessed","resolveId","source","importer","writeBundle","options","bundle","fileName","watchProgress","e","esm","umd","every","setTimeout","stop","optionsMap","input","output","withMinify","entryFileNames","preserveModules","skip","patterns","esbuild","outputName","postcss","autoprefixer","minimize","sourceMap","extract","tsconfig","p","resolve","generateBundle","file","code","flatMap","optsGen","opts","Array","isArray"],"mappings":"qoBAkB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vCc6D,IAAA,UAC1DtB,EACH0C,MAAOhE,EACPiE,OAAQ,CACN,CACExE,IAAK,QAEP,CACEA,IAAK,OACL0E,eAAgB,EAAGzE,UAAW,GAAGA,EAAKE,QAAQ,SAAU,eACxDwE,iBAAiB,IAGrB1F,QAAS,CACPiE,EAAiB,MAAOC,GACxBrB,EACA9C,GAAU4F,EAAK,CAAEC,SAAU,CAAC,cAC5BvF,EAAI,CAAE+F,UA3OkBC,EA2Oa,oBA1OlCC,EAAQ1G,EAAeyG,MA2O1B,CACErF,KAAM,wCAKN,cAAAuF,CAAepF,EAAGyD,GAChB,IAAA,MAAW4B,KAAQjF,OAAOY,OAAOyC,GACzB,SAAU4B,IAEXA,EAAAC,KAAOD,EAAKC,KAAKvF,QACpB,iCACA,mBAAmBX,EAAIS,SAG7B,GAEFV,GAEFoC,YA/PJ,IAA8B2D,CAgQ5B,GAEO,OAAA/G,EAAQoH,SAAQlD,IACf,MAAAmD,EAAUtB,EAAW7B,GAC3B,QAAgB,IAAZmD,EACF,MAAM,IAAIlG,MAAM,UAAU+C,sBAC5B,MAAMoD,EAAOD,EAAQnD,IAAWlE,EAAQA,EAAQkB,OAAS,IACrD,OAAAqG,MAAMC,QAAQF,GAAcA,EACzB,CAACA,EAAI,GACb"}
@@ -1,2 +0,0 @@
1
- "use strict";var e=require("node:path"),t=require("@jiek/utils/getWorkspaceDir"),r=require("@rollup/plugin-json"),s=require("autoprefixer"),n=require("cli-progress"),i=require("@jiek/rollup-plugin-dts"),o=require("rollup-plugin-esbuild"),a=require("rollup-plugin-postcss"),u=require("@rollup/plugin-terser");function l(e){return e&&e.__esModule?e:{default:e}}var c=l(r),p=l(s),d=l(o),m=l(a),f=l(u);function g(e){return e.startsWith("node:")?e.slice(5):e.replace(/[@|/-](\w)/g,((e,t)=>t.toUpperCase()))}var y=(e={})=>({name:"skip",load(t){if(e.patterns?.some((e=>"string"==typeof e?t.includes(e):e.test(t))))return""}});const j={exports:"named",interop:"auto",sourcemap:!0};function $(e){return[e,{...e,entryFileNames:e.entryFileNames?.replace(/(\.c?js)$/,".min$1"),plugins:[...e.plugins??[],f.default()]}]}const{JIEK_SILENT:v,JIEK_TARGET:b,JIEK_ROOT:w}=process.env,h=["esm","umd","dts"],O=(b??"esm,umd,dts").split(",").filter(Boolean).filter((e=>h.includes(e))),x=w??t.getWorkspaceDir();exports.template=({styled:t=!1,plugins:{index:r=[],entry:s=[],dts:o=[]}={}}={},a)=>{if(0===O.length)throw new Error("no target specified");const{jiek:{noBrowser:u=!1,outdir:l="dist"}={}}=a,f={...j,dir:l};if(!a.name)throw new Error("pkg.name is required");const v=a.name.replace(/[@|/-](\w)/g,((e,t)=>t.toUpperCase())),b=Object.fromEntries(Object.entries(a.exports??{}).filter((([e])=>!e.startsWith(`./${l}`)&&!e.startsWith(l))).filter((([e])=>!/\.(json|css|scss)$/.test(e))).filter((([,e])=>"object"==typeof e&&e["inner-src"]&&e.import)).map((([e,t])=>[e.replace(/^\.$/,"index").replace(/^\.\//,""),"string"==typeof t?t:t["inner-src"]]))),w=Math.max(...Object.values(b).map((e=>e.length)));function h(e){return e.padEnd(w)}const[E,k]=function(){let e={};const t=new Set([]);return[({external:r}={})=>({name:"globals",resolveId:e=>r?.some((t=>t instanceof RegExp?t.test(e):t===e))?(t.add(e),{id:e,external:!0}):null,outputOptions:r=>(e=[...t].reduce(((e,t)=>({...e,[t]:g(t)})),{}),{...r,globals:e})}),{outputOptions:t=>({...t,globals:e})}]}(),q=function(){const e=process.cwd(),t=require(`${e}/package.json`),{dependencies:r={},peerDependencies:s={},optionalDependencies:n={}}=t;return Object.keys(r).concat(Object.keys(s)).concat(Object.keys(n)).map((e=>new RegExp(`^${e}(/.*)?$`))).concat([/^node:/])}(),N={},F=[c.default()],M=new n.MultiBar({clearOnComplete:!1,hideCursor:!0,format:"- {bar} | {type} | {entry} | {message}"},n.Presets.shades_classic),B=Object.values(b),I={};O.forEach((e=>{var t;I[e]=(t=e,B.reduce(((e,r)=>{const s=M.create(100,0);return s.update(0,{type:t,entry:h(r),message:"waiting"}),{...e,[r]:s}}),{}))}));const _=B.reduce(((e,t)=>({...e,[t]:!1})),{}),C=(e,t=!1,r)=>{const s=I[e];if(!s)throw new Error(`target ${e} found`);return function(e,t,r){return{name:"progress",resolveId(r,s){(e.includes(r)||void 0===s)&&t(r)},writeBundle(e,t){Object.entries(t).forEach((([e,t])=>{void 0!==t.name&&"isEntry"in t&&r(t.name,t.fileName)}))}}}(Object.values(b),(t=>{const n=r??t,i=s[n];i&&i.update(0,{type:e,entry:h(n),message:"processing"})}),((n,i)=>{const o=r??b[n],a=s[o];if(!a)return;({esm:/\.min\.js$/,umd:/\.min\.c?js$/,dts:/\.esm\.d\.ts$/})[e].test(i)?a.update(100,{type:e,entry:h(o),message:"finished"}):a.update(95,{type:e,entry:h(o),message:"processed"}),t&&(_[o]=!0,Object.values(_).every(Boolean)&&setTimeout((()=>M.stop()),200))}))},T={esm:e=>({...N,input:b,output:[...$({...f,format:"esm",entryFileNames:"[name].esm.js",preserveModules:!0})],plugins:[C("esm",e),F,E({external:q}),t&&y({patterns:[/\.s?css$/]}),d.default(),r]}),umd:e=>Object.entries(b).map((([r,n])=>{const i=v+("index"===r?"":r.replace(/[@|/-](\w)/g,((e,t)=>t.toUpperCase())));return{...N,input:n,output:u?[...$({...f,name:i,format:"cjs",entryFileNames:`${r}.cjs`})]:[...$({...f,name:i,format:"iife",entryFileNames:`${r}.iife.js`}),...$({...f,name:i,format:"umd",entryFileNames:`${r}.umd.js`})],plugins:[C("umd",e,n),F,k,t&&m.default({plugins:[p.default],minimize:!0,sourceMap:!0,extract:`${r}.css`}),d.default(),s],external:q}})),dts:r=>{return{...N,input:b,output:[{dir:"dist"},{dir:"dist",entryFileNames:({name:e})=>`${e.replace(/^src\//,"")}.esm.d.ts`,preserveModules:!0}],plugins:[C("dts",r),F,t&&y({patterns:[/\.s?css$/]}),i.dts({tsconfig:(s="tsconfig.dts.json",e.resolve(x,s))}),{name:"rollup-plugin-declare-module-replacer",generateBundle(e,t){for(const e of Object.values(t))"code"in e&&(e.code=e.code.replace(/declare module ['|"]\..*['|"]/g,`declare module '${a.name}'`))}},o],external:q};var s}};return O.flatMap((e=>{const t=T[e];if(void 0===t)throw new Error(`target ${e} is not supported`);const r=t(e===O[O.length-1]);return Array.isArray(r)?r:[r]}))};
2
- //# sourceMappingURL=rollup.min.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"rollup.min.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(/(\\.c?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 { MultiBar, Presets } from 'cli-progress'\nimport type { InputPluginOption, Plugin, RollupOptions } from 'rollup'\nimport { dts } from '@jiek/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 {\n JIEK_SILENT,\n JIEK_TARGET,\n JIEK_ROOT\n} = process.env\nconst silent = JIEK_SILENT === 'true'\nconst target = JIEK_TARGET ?? 'esm,umd,dts'\nconst ACCEPTED_TARGETS = ['esm', 'umd', 'dts']\nconst targets = (\n target\n .split(',')\n .filter(Boolean)\n .filter(t => ACCEPTED_TARGETS.includes(t))\n) as ('esm' | 'umd' | 'dts')[]\nconst workspaceRoot = JIEK_ROOT ?? getWorkspaceDir()\nfunction resolveWorkspacePath(p: string) {\n return resolve(workspaceRoot, p)\n}\n\nfunction watchProgress(\n entries: string[],\n onProcessing: (entry: 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 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 if (targets.length === 0)\n throw new Error('no target specified')\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 const maxLengthEntry = Math.max(...Object.values(exportsEntries).map(v => v.length))\n function paddingEntry(entry: string) {\n return entry.padEnd(maxLengthEntry)\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 addBarsByEntries = (type: 'esm' | 'umd' | 'dts') => entries\n .reduce((add, entry) => {\n const bar = multiBars.create(100, 0)\n bar.update(0, { type, entry: paddingEntry(entry), message: 'waiting' })\n return { ...add, [entry]: bar }\n }, {} as Record<string, ReturnType<typeof multiBars.create>>)\n const progressState: Partial<Record<'esm' | 'umd' | 'dts', ReturnType<typeof addBarsByEntries>>> = {}\n targets.forEach(target => {\n progressState[target] = addBarsByEntries(target)\n })\n const resolved = entries.reduce((entries, entry) => ({ ...entries, [entry]: false }), {} as Record<string, boolean>)\n const watchingProgress = (\n type: 'esm' | 'umd' | 'dts',\n isLast = false,\n defaultEntry?: string\n ) => {\n const group = progressState[type]\n if (!group) throw new Error(`target ${type} found`)\n return watchProgress(\n Object.values(exportsEntries),\n entry => {\n const e = defaultEntry ?? entry\n const bar = group[e]\n if (!bar) return\n bar.update(0, { type, entry: paddingEntry(e), message: 'processing' })\n },\n (name, fileName) => {\n const e = defaultEntry ?? exportsEntries[name]\n const bar = group[e]\n if (!bar) return\n const endsReg = {\n esm: /\\.min\\.js$/,\n umd: /\\.min\\.c?js$/,\n dts: /\\.esm\\.d\\.ts$/\n }[type]\n if (!endsReg.test(fileName)) {\n bar.update(95, { type, entry: paddingEntry(e), message: 'processed' })\n } else {\n bar.update(100, { type, entry: paddingEntry(e), message: 'finished' })\n }\n if (isLast) {\n resolved[e] = true\n if (Object.values(resolved).every(Boolean)) {\n setTimeout(() => multiBars.stop(), 200)\n }\n }\n }\n )\n }\n const esmOpts: (isLast: boolean) => RollupOptions = isLast => ({\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 watchingProgress('esm', isLast),\n commonPlugins,\n globalsRegister({ external }),\n styled && skip({ patterns: [/\\.s?css$/] }),\n esbuild(),\n indexPlugins\n ]\n })\n const umdOpts: (isLast: boolean) => RollupOptions[] = isLast => 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 watchingProgress('umd', isLast, input),\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 const dtsOpts: (isLast: boolean) => RollupOptions = isLast => ({\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 watchingProgress('dts', isLast),\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 const optionsMap = { esm: esmOpts, umd: umdOpts, dts: dtsOpts }\n return targets.flatMap(target => {\n const optsGen = optionsMap[target as 'esm' | 'umd' | 'dts']\n if (optsGen === undefined)\n throw new Error(`target ${target} is not supported`)\n const opts = optsGen(target === targets[targets.length - 1])\n if (Array.isArray(opts)) return opts\n return [opts]\n })\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","JIEK_SILENT","JIEK_TARGET","JIEK_ROOT","process","env","ACCEPTED_TARGETS","targets","split","filter","Boolean","t","workspaceRoot","getWorkspaceDir","styled","index","indexPlugins","entry","entryPlugins","dts","dtsPlugins","pkg","length","Error","jiek","noBrowser","outdir","outputOptions","dir","namePrefix","exportsEntries","Object","fromEntries","entries","key","value","map","maxLengthEntry","Math","max","values","v","paddingEntry","padEnd","globalsRegister","globalsOutput","globals","dependencies","Set","resolveId","dep","RegExp","add","reduce","acc","createGlobalsLinkage","cwd","require","peerDependencies","optionalDependencies","keys","concat","externalResolver","commonOptions","commonPlugins","json","multiBars","MultiBar","clearOnComplete","hideCursor","format","Presets","shades_classic","progressState","forEach","target","type","bar","create","update","message","resolved","watchingProgress","isLast","defaultEntry","group","onProcessing","onProcessed","source","importer","writeBundle","bundle","fileName","watchProgress","e","esm","umd","every","setTimeout","stop","optionsMap","input","preserveModules","esbuild","outputName","postcss","autoprefixer","minimize","sourceMap","extract","tsconfig","p","resolve","generateBundle","file","code","flatMap","optsGen","opts","Array","isArray"],"mappings":"8YAAA,SAAAA,EAAyBC,GAO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SACVC,UAAU,EACVC,WAAW,EACXC,QAAS,GAAG7H,UAEduH,YACArF,GAEF3C,WACF,IAyC+C4C,IAvCcgE,IAAA,UAC1DpB,EACHsC,MAAOvE,EACPjC,OAAQ,CACN,CACE+B,IAAK,QAEP,CACEA,IAAK,OACL9B,eAAgB,EAAGd,UAAW,GAAGA,EAAKN,QAAQ,SAAU,eACxD4H,iBAAiB,IAGrBvG,QAAS,CACPmF,EAAiB,MAAOC,GACxBnB,EACAlD,GAAUhC,EAAK,CAAEK,SAAU,CAAC,cAC5BgC,EAAAA,IAAI,CAAE2F,UA3OkBC,EA2Oa,oBA1OlCC,EAAAA,QAAQpG,EAAemG,MA2O1B,CACE/H,KAAM,wCAKN,cAAAiI,CAAetI,EAAGgH,GAChB,IAAA,MAAWuB,KAAQnF,OAAOS,OAAOmD,GACzB,SAAUuB,IAEXA,EAAAC,KAAOD,EAAKC,KAAKzI,QACpB,iCACA,mBAAmB2C,EAAIrC,SAG7B,GAEFoC,GAEF7C,YA/PJ,IAA8BwI,CAgQ5B,GAEO,OAAAxG,EAAQ6G,SAAQzC,IACf,MAAA0C,EAAUjB,EAAWzB,GAC3B,QAAgB,IAAZ0C,EACF,MAAM,IAAI9F,MAAM,UAAUoD,sBAC5B,MAAM2C,EAAOD,EAAQ1C,IAAWpE,EAAQA,EAAQe,OAAS,IACrD,OAAAiG,MAAMC,QAAQF,GAAcA,EACzB,CAACA,EAAI,GACb"}
@@ -1,25 +0,0 @@
1
- import path from 'node:path';
2
-
3
- function commondir(files, cwd = process.cwd()) {
4
- const resolvedFiles = files.map((file) => {
5
- if (path.isAbsolute(file))
6
- return file;
7
- return path.resolve(cwd, file);
8
- });
9
- const sep = "/";
10
- const [first = ""] = resolvedFiles;
11
- const parts = first.split(sep);
12
- let common = "";
13
- for (let i = 0; i < parts.length; i++) {
14
- const segment = parts[i];
15
- if (resolvedFiles.every((file) => file.startsWith(common + segment))) {
16
- common += segment + sep;
17
- } else {
18
- break;
19
- }
20
- }
21
- return common;
22
- }
23
-
24
- export { commondir };
25
- //# sourceMappingURL=commondir.esm.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"commondir.esm.js","sources":["../../src/utils/commondir.ts"],"sourcesContent":["import path from 'node:path'\n\nexport function commondir(files: string[], cwd = process.cwd()): string {\n const resolvedFiles = files.map(file => {\n if (path.isAbsolute(file)) return file\n return path.resolve(cwd, file)\n })\n const sep = '/'\n const [first = ''] = resolvedFiles\n const parts = first.split(sep)\n let common = ''\n for (let i = 0; i < parts.length; i++) {\n const segment = parts[i]\n if (resolvedFiles.every(file => file.startsWith(common + segment))) {\n common += segment + sep\n } else {\n break\n }\n }\n return common\n}\n"],"names":[],"mappings":";;AAEO,SAAS,SAAU,CAAA,KAAA,EAAiB,GAAM,GAAA,OAAA,CAAQ,KAAe,EAAA;AACtE,EAAM,MAAA,aAAA,GAAgB,KAAM,CAAA,GAAA,CAAI,CAAQ,IAAA,KAAA;AACtC,IAAI,IAAA,IAAA,CAAK,WAAW,IAAI,CAAA;AAAG,MAAO,OAAA,IAAA,CAAA;AAClC,IAAO,OAAA,IAAA,CAAK,OAAQ,CAAA,GAAA,EAAK,IAAI,CAAA,CAAA;AAAA,GAC9B,CAAA,CAAA;AACD,EAAA,MAAM,GAAM,GAAA,GAAA,CAAA;AACZ,EAAM,MAAA,CAAC,KAAQ,GAAA,EAAE,CAAI,GAAA,aAAA,CAAA;AACrB,EAAM,MAAA,KAAA,GAAQ,KAAM,CAAA,KAAA,CAAM,GAAG,CAAA,CAAA;AAC7B,EAAA,IAAI,MAAS,GAAA,EAAA,CAAA;AACb,EAAA,KAAA,IAAS,CAAI,GAAA,CAAA,EAAG,CAAI,GAAA,KAAA,CAAM,QAAQ,CAAK,EAAA,EAAA;AACrC,IAAM,MAAA,OAAA,GAAU,MAAM,CAAC,CAAA,CAAA;AACvB,IAAI,IAAA,aAAA,CAAc,MAAM,CAAQ,IAAA,KAAA,IAAA,CAAK,WAAW,MAAS,GAAA,OAAO,CAAC,CAAG,EAAA;AAClE,MAAA,MAAA,IAAU,OAAU,GAAA,GAAA,CAAA;AAAA,KACf,MAAA;AACL,MAAA,MAAA;AAAA,KACF;AAAA,GACF;AACA,EAAO,OAAA,MAAA,CAAA;AACT;;;;"}
@@ -1,2 +0,0 @@
1
- import t from"node:path";function e(e,o=process.cwd()){const r=e.map((e=>t.isAbsolute(e)?e:t.resolve(o,e))),[s=""]=r,n=s.split("/");let i="";for(let t=0;t<n.length;t++){const e=n[t];if(!r.every((t=>t.startsWith(i+e))))break;i+=e+"/"}return i}export{e as commondir};
2
- //# sourceMappingURL=commondir.esm.min.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"commondir.esm.min.js","sources":["../../src/utils/commondir.ts"],"sourcesContent":["import path from 'node:path'\n\nexport function commondir(files: string[], cwd = process.cwd()): string {\n const resolvedFiles = files.map(file => {\n if (path.isAbsolute(file)) return file\n return path.resolve(cwd, file)\n })\n const sep = '/'\n const [first = ''] = resolvedFiles\n const parts = first.split(sep)\n let common = ''\n for (let i = 0; i < parts.length; i++) {\n const segment = parts[i]\n if (resolvedFiles.every(file => file.startsWith(common + segment))) {\n common += segment + sep\n } else {\n break\n }\n }\n return common\n}\n"],"names":["commondir","files","cwd","process","resolvedFiles","map","file","path","isAbsolute","resolve","first","parts","split","common","i","length","segment","every","startsWith"],"mappings":"yBAEO,SAASA,EAAUC,EAAiBC,EAAMC,QAAQD,OACjD,MAAAE,EAAgBH,EAAMI,KAAYC,GAClCC,EAAKC,WAAWF,GAAcA,EAC3BC,EAAKE,QAAQP,EAAKI,MAGpBI,EAAQ,IAAMN,EACfO,EAAQD,EAAME,MAFR,KAGZ,IAAIC,EAAS,GACb,IAAA,IAASC,EAAI,EAAGA,EAAIH,EAAMI,OAAQD,IAAK,CAC/B,MAAAE,EAAUL,EAAMG,GAClB,IAAAV,EAAca,OAAcX,GAAAA,EAAKY,WAAWL,EAASG,KAGvD,MAFAH,GAAUG,EAPF,GAWZ,CACO,OAAAH,CACT"}
@@ -1,67 +0,0 @@
1
- import fs from 'node:fs';
2
- import path from 'node:path';
3
- import { filterPackagesFromDir } from '@pnpm/filter-workspace-packages';
4
- import { program } from 'commander';
5
- import { load } from 'js-yaml';
6
- import { getRoot } from './getRoot.esm.js';
7
- import { getWD } from './getWD.esm.js';
8
-
9
- let type = "";
10
- try {
11
- require.resolve("@pnpm/filter-workspace-packages");
12
- type = "pnpm";
13
- } catch {
14
- }
15
- if (type !== "") {
16
- program.option("-f, --filter <filter>", "filter packages");
17
- }
18
- async function getSelectedProjectsGraph() {
19
- let filter = program.getOptionValue("filter");
20
- const root = getRoot();
21
- const { wd, notWorkspace } = getWD();
22
- if (!notWorkspace && type === "pnpm") {
23
- const pnpmWorkspaceFilePath = path.resolve(wd, "pnpm-workspace.yaml");
24
- const pnpmWorkspaceFileContent = fs.readFileSync(pnpmWorkspaceFilePath, "utf-8");
25
- const pnpmWorkspace = load(pnpmWorkspaceFileContent);
26
- if (root === wd && !filter) {
27
- throw new Error("root path is workspace root, please provide a filter");
28
- }
29
- if (root !== wd && !filter) {
30
- const packageJSONIsExist = fs.existsSync(path.resolve(root, "package.json"));
31
- if (!packageJSONIsExist) {
32
- throw new Error("root path is not workspace root, please provide a filter");
33
- }
34
- const packageJSON = JSON.parse(fs.readFileSync(path.resolve(root, "package.json"), "utf-8"));
35
- if (!packageJSON.name) {
36
- throw new Error("root path is not workspace root, please provide a filter");
37
- }
38
- filter = packageJSON.name;
39
- }
40
- const { selectedProjectsGraph } = await filterPackagesFromDir(wd, [{
41
- filter: filter ?? "",
42
- followProdDepsOnly: true
43
- }], {
44
- prefix: root,
45
- workspaceDir: wd,
46
- patterns: pnpmWorkspace.packages
47
- });
48
- return {
49
- wd,
50
- root,
51
- value: Object.entries(selectedProjectsGraph).reduce((acc, [key, value]) => {
52
- acc[key] = value.package.manifest;
53
- return acc;
54
- }, {})
55
- };
56
- }
57
- return {
58
- wd,
59
- root,
60
- value: {
61
- [wd]: JSON.parse(fs.readFileSync(path.resolve(wd, "package.json"), "utf-8"))
62
- }
63
- };
64
- }
65
-
66
- export { getSelectedProjectsGraph, type };
67
- //# sourceMappingURL=filterSupport.esm.js.map