jiek 0.4.0 → 0.4.2
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/cli.cjs +682 -1
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.min.cjs +2 -0
- package/dist/cli.min.cjs.map +1 -0
- package/dist/commands/base.esm.js +1 -1
- package/dist/commands/base.esm.js.map +1 -1
- package/dist/commands/base.esm.min.js +1 -1
- package/dist/commands/base.esm.min.js.map +1 -1
- package/dist/index.cjs +5 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.min.cjs +2 -0
- package/dist/index.min.cjs.map +1 -0
- package/dist/pkg.esm.js +2 -2
- package/dist/pkg.esm.js.map +1 -1
- package/dist/pkg.esm.min.js +1 -1
- package/dist/pkg.esm.min.js.map +1 -1
- package/dist/rollup/utils/withMinify.esm.js +1 -1
- package/dist/rollup/utils/withMinify.esm.js.map +1 -1
- package/dist/rollup/utils/withMinify.esm.min.js +1 -1
- package/dist/rollup/utils/withMinify.esm.min.js.map +1 -1
- package/dist/rollup.cjs +310 -1
- package/dist/rollup.cjs.map +1 -1
- package/dist/rollup.esm.js +52 -103
- package/dist/rollup.esm.js.map +1 -1
- package/dist/rollup.esm.min.js +1 -1
- package/dist/rollup.esm.min.js.map +1 -1
- package/dist/rollup.min.cjs +2 -0
- package/dist/rollup.min.cjs.map +1 -0
- package/package.json +1 -1
package/dist/rollup.esm.js.map
CHANGED
@@ -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 { 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,CA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AA;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 { MultiBar, Presets } from 'cli-progress'\nimport type { InputPluginOption, Plugin, 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\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 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 = {\n esm: addBarsByEntries('esm'),\n umd: addBarsByEntries('umd'),\n dts: addBarsByEntries('dts')\n }\n const resolved = entries.reduce((entries, entry) => ({ ...entries, [entry]: false }), {} as Record<string, boolean>)\n const watchingProgress = (\n type: 'esm' | 'umd' | 'dts',\n defaultEntry?: string\n ) => {\n const group = progressState[type]\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 (type === 'dts') {\n resolved[e] = true\n if (Object.values(resolved).every(Boolean)) {\n setTimeout(() => multiBars.stop(), 200)\n }\n }\n }\n )\n }\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 watchingProgress('esm'),\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 watchingProgress('umd', 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 {\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'),\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"],"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,aAAA,CACP,OACA,EAAA,YAAA,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,YA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A,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;;;;"}
|
package/dist/rollup.esm.min.js
CHANGED
@@ -1,2 +1,2 @@
|
|
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{
|
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{MultiBar as n,Presets as o}from"cli-progress";import{dts as i}from"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 f=s();const g=({styled:s=!1,plugins:{index:g=[],entry:j=[],dts:y=[]}={}}={},$)=>{const{jiek:{noBrowser:b=!1,outdir:v="dist"}={}}=$,x={...u,dir:v};if(!$.name)throw new Error("pkg.name is required");const h=$.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"]]))),w=Math.max(...Object.values(O).map((e=>e.length)));function N(e){return e.padEnd(w)}const[k,E]=l(),F=c(),M={},B=[t()],C=new n({clearOnComplete:!1,hideCursor:!0,format:"- {bar} | {type} | {entry} | {message}"},o.shades_classic),W=Object.values(O),U=e=>W.reduce(((s,t)=>{const r=C.create(100,0);return r.update(0,{type:e,entry:N(t),message:"waiting"}),{...s,[t]:r}}),{}),q={esm:U("esm"),umd:U("umd"),dts:U("dts")},z=W.reduce(((e,s)=>({...e,[s]:!1})),{}),D=(e,s)=>{const t=q[e];return function(e,s,t){return{name:"progress",resolveId(t,r){(e.includes(t)||void 0===r)&&s(t)},writeBundle(e,s){Object.entries(s).forEach((([e,s])=>{void 0!==s.name&&"isEntry"in s&&t(s.name,s.fileName)}))}}}(Object.values(O),(r=>{const n=s??r,o=t[n];o&&o.update(0,{type:e,entry:N(n),message:"processing"})}),((r,n)=>{const o=s??O[r],i=t[o];if(!i)return;({esm:/\.min\.js$/,umd:/\.min\.c?js$/,dts:/\.esm\.d\.ts$/})[e].test(n)?i.update(100,{type:e,entry:N(o),message:"finished"}):i.update(95,{type:e,entry:N(o),message:"processed"}),"dts"===e&&(z[o]=!0,Object.values(z).every(Boolean)&&setTimeout((()=>C.stop()),200))}))};return[{...M,input:O,output:[...d({...x,format:"esm",entryFileNames:"[name].esm.js",preserveModules:!0})],plugins:[D("esm"),B,k({external:F}),s&&a({patterns:[/\.s?css$/]}),m(),g]},...Object.entries(O).map((([e,t])=>{const n=h+("index"===e?"":e.replace(/[@|/-](\w)/g,((e,s)=>s.toUpperCase())));return{...M,input:t,output:b?[...d({...x,name:n,format:"cjs",entryFileNames:`${e}.cjs`})]:[...d({...x,name:n,format:"iife",entryFileNames:`${e}.iife.js`}),...d({...x,name:n,format:"umd",entryFileNames:`${e}.umd.js`})],plugins:[D("umd",t),B,E,s&&p({plugins:[r],minimize:!0,sourceMap:!0,extract:`${e}.css`}),m(),j],external:F}})),{...M,input:O,output:[{dir:"dist"},{dir:"dist",entryFileNames:({name:e})=>`${e.replace(/^src\//,"")}.esm.d.ts`,preserveModules:!0}],plugins:[D("dts"),B,s&&a({patterns:[/\.s?css$/]}),i({tsconfig:(I="tsconfig.dts.json",e(f,I))}),{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}'`))}},y],external:F}];var I};export{g 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 { 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,GAAQE,SAAQ,EAAEC,EAAKC,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W,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"}
|
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 '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\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 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 = {\n esm: addBarsByEntries('esm'),\n umd: addBarsByEntries('umd'),\n dts: addBarsByEntries('dts')\n }\n const resolved = entries.reduce((entries, entry) => ({ ...entries, [entry]: false }), {} as Record<string, boolean>)\n const watchingProgress = (\n type: 'esm' | 'umd' | 'dts',\n defaultEntry?: string\n ) => {\n const group = progressState[type]\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 (type === 'dts') {\n resolved[e] = true\n if (Object.values(resolved).every(Boolean)) {\n setTimeout(() => multiBars.stop(), 200)\n }\n }\n }\n )\n }\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 watchingProgress('esm'),\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 watchingProgress('umd', 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 {\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'),\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","outdir","outputOptions","commonOutputOptions","dir","name","Error","namePrefix","replace","_","$1","toUpperCase","exportsEntries","Object","fromEntries","entries","exports","filter","key","startsWith","test","value","map","maxLengthEntry","Math","max","values","v","length","paddingEntry","padEnd","globalsRegister","globalsOutput","createGlobalsLinkage","external","externalResolver","commonOptions","commonPlugins","json","multiBars","MultiBar","clearOnComplete","hideCursor","format","Presets","shades_classic","addBarsByEntries","type","reduce","add","bar","create","update","message","progressState","esm","umd","resolved","watchingProgress","defaultEntry","group","onProcessing","onProcessed","resolveId","source","importer","includes","writeBundle","options","bundle","forEach","fileName","watchProgress","e","every","Boolean","setTimeout","stop","input","output","withMinify","entryFileNames","preserveModules","skip","patterns","esbuild","outputName","postcss","autoprefixer","minimize","sourceMap","extract","tsconfig","p","resolve","generateBundle","file","code"],"mappings":"+nBAkBA,MAAMA,EAAgBC,IAyBf,MAAMC,EAAW,EAEpBC,UAAS,EACTC,SACEC,MAAOC,EAAe,GACtBC,MAAOC,EAAe,GACtBC,IAAKC,EAAa,IAChB,CAAC,GAWH,CAAA,EACJC,KASA,MAAQC,MAAMC,UACZA,GAAY,EAAAC,OACZA,EAAS,QACP,CAAA,GAAOH,EACLI,EAAgB,IACjBC,EACHC,IAAKH,GAEH,IAACH,EAAIO,KACD,MAAA,IAAIC,MAAM,wBAEZ,MAAAC,EAAaT,EAChBO,KACAG,QAAQ,eAAe,CAACC,EAAGC,IAAOA,EAAGC,gBAClCC,EAAiBC,OAAOC,YAC5BD,OAAOE,QAAQjB,EAAIkB,SAAW,CAAA,GAE3BC,QAAO,EAAEC,MAAUA,EAA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ACT9E,EACHG,KAAMiF,EACN3C,OAAQ,MACRsC,eAAgB,GAAG5E,WAEnB,IACC2E,EAAW,IACT9E,EACHG,KAAMiF,EACN3C,OAAQ,OACRsC,eAAgB,GAAG5E,iBAElB2E,EAAW,IACT9E,EACHG,KAAMiF,EACN3C,OAAQ,MACRsC,eAAgB,GAAG5E,cAGvBd,QAAS,CACPmE,EAAiB,MAAOoB,GACxBzC,EACAL,EACA1C,GAAUiG,EAAQ,CAChBhG,QAAS,CAACiG,GACVC,UAAU,EACVC,WAAW,EACXC,QAAS,GAAGtF,UAEdgF,IACA1F,GAEFuC,WACF,IAEF,IACKE,EACH0C,MAAOlE,EACPmE,OAAQ,CACN,CACE3E,IAAK,QAEP,CACEA,IAAK,OACL6E,eAAgB,EAAG5E,UAAW,GAAGA,EAAKG,QAAQ,SAAU,eACxD0E,iBAAiB,IAGrB3F,QAAS,CACPmE,EAAiB,OACjBrB,EACA/C,GAAU6F,EAAK,CAAEC,SAAU,CAAC,cAC5BxF,EAAI,CAAEgG,UAxOgBC,EAwOe,oBAvOpCC,EAAQ3G,EAAe0G,MAwOxB,CACExF,KAAM,wCAKN,cAAA0F,CAAetF,EAAG4D,GAChB,IAAA,MAAW2B,KAAQnF,OAAOa,OAAO2C,GACzB,SAAU2B,IAEXA,EAAAC,KAAOD,EAAKC,KAAKzF,QACpB,iCACA,mBAAmBV,EAAIO,SAG7B,GAEFR,GAEFqC,aA5PN,IAA8B2D,CA8P5B"}
|
@@ -0,0 +1,2 @@
|
|
1
|
+
"use strict";var e=require("node:path"),t=require("@jiek/utils/getWorkspaceDir"),s=require("@rollup/plugin-json"),r=require("autoprefixer"),n=require("cli-progress"),i=require("rollup-plugin-dts"),a=require("rollup-plugin-esbuild"),o=require("rollup-plugin-postcss"),u=require("@rollup/plugin-terser");function l(e){return e&&e.__esModule?e:{default:e}}var c=l(s),p=l(r),d=l(a),m=l(o),g=l(u);function f(e){return e.startsWith("node:")?e.slice(5):e.replace(/[@|/-](\w)/g,((e,t)=>t.toUpperCase()))}var j=(e={})=>({name:"skip",load(t){if(e.patterns?.some((e=>"string"==typeof e?t.includes(e):e.test(t))))return""}});const y={exports:"named",interop:"auto",sourcemap:!0};function $(e){return[e,{...e,entryFileNames:e.entryFileNames?.replace(/(\.c?js)$/,".min$1"),plugins:[...e.plugins??[],g.default()]}]}const b=t.getWorkspaceDir();exports.template=({styled:t=!1,plugins:{index:s=[],entry:r=[],dts:a=[]}={}}={},o)=>{const{jiek:{noBrowser:u=!1,outdir:l="dist"}={}}=o,g={...y,dir:l};if(!o.name)throw new Error("pkg.name is required");const v=o.name.replace(/[@|/-](\w)/g,((e,t)=>t.toUpperCase())),x=Object.fromEntries(Object.entries(o.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"]]))),O=Math.max(...Object.values(x).map((e=>e.length)));function w(e){return e.padEnd(O)}const[h,q]=function(){let e={};const t=new Set([]);return[({external:s}={})=>({name:"globals",resolveId:e=>s?.some((t=>t instanceof RegExp?t.test(e):t===e))?(t.add(e),{id:e,external:!0}):null,outputOptions:s=>(e=[...t].reduce(((e,t)=>({...e,[t]:f(t)})),{}),{...s,globals:e})}),{outputOptions:t=>({...t,globals:e})}]}(),k=function(){const e=process.cwd(),t=require(`${e}/package.json`),{dependencies:s={},peerDependencies:r={},optionalDependencies:n={}}=t;return Object.keys(s).concat(Object.keys(r)).concat(Object.keys(n)).map((e=>new RegExp(`^${e}(/.*)?$`))).concat([/^node:/])}(),N={},E=[c.default()],F=new n.MultiBar({clearOnComplete:!1,hideCursor:!0,format:"- {bar} | {type} | {entry} | {message}"},n.Presets.shades_classic),M=Object.values(x),B=e=>M.reduce(((t,s)=>{const r=F.create(100,0);return r.update(0,{type:e,entry:w(s),message:"waiting"}),{...t,[s]:r}}),{}),C={esm:B("esm"),umd:B("umd"),dts:B("dts")},W=M.reduce(((e,t)=>({...e,[t]:!1})),{}),D=(e,t)=>{const s=C[e];return function(e,t,s){return{name:"progress",resolveId(s,r){(e.includes(s)||void 0===r)&&t(s)},writeBundle(e,t){Object.entries(t).forEach((([e,t])=>{void 0!==t.name&&"isEntry"in t&&s(t.name,t.fileName)}))}}}(Object.values(x),(r=>{const n=t??r,i=s[n];i&&i.update(0,{type:e,entry:w(n),message:"processing"})}),((r,n)=>{const i=t??x[r],a=s[i];if(!a)return;({esm:/\.min\.js$/,umd:/\.min\.c?js$/,dts:/\.esm\.d\.ts$/})[e].test(n)?a.update(100,{type:e,entry:w(i),message:"finished"}):a.update(95,{type:e,entry:w(i),message:"processed"}),"dts"===e&&(W[i]=!0,Object.values(W).every(Boolean)&&setTimeout((()=>F.stop()),200))}))};return[{...N,input:x,output:[...$({...g,format:"esm",entryFileNames:"[name].esm.js",preserveModules:!0})],plugins:[D("esm"),E,h({external:k}),t&&j({patterns:[/\.s?css$/]}),d.default(),s]},...Object.entries(x).map((([e,s])=>{const n=v+("index"===e?"":e.replace(/[@|/-](\w)/g,((e,t)=>t.toUpperCase())));return{...N,input:s,output:u?[...$({...g,name:n,format:"cjs",entryFileNames:`${e}.cjs`})]:[...$({...g,name:n,format:"iife",entryFileNames:`${e}.iife.js`}),...$({...g,name:n,format:"umd",entryFileNames:`${e}.umd.js`})],plugins:[D("umd",s),E,q,t&&m.default({plugins:[p.default],minimize:!0,sourceMap:!0,extract:`${e}.css`}),d.default(),r],external:k}})),{...N,input:x,output:[{dir:"dist"},{dir:"dist",entryFileNames:({name:e})=>`${e.replace(/^src\//,"")}.esm.d.ts`,preserveModules:!0}],plugins:[D("dts"),E,t&&j({patterns:[/\.s?css$/]}),i.dts({tsconfig:(U="tsconfig.dts.json",e.resolve(b,U))}),{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 '${o.name}'`))}},a],external:k}];var U};
|
2
|
+
//# sourceMappingURL=rollup.min.cjs.map
|
@@ -0,0 +1 @@
|
|
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 '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\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 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 = {\n esm: addBarsByEntries('esm'),\n umd: addBarsByEntries('umd'),\n dts: addBarsByEntries('dts')\n }\n const resolved = entries.reduce((entries, entry) => ({ ...entries, [entry]: false }), {} as Record<string, boolean>)\n const watchingProgress = (\n type: 'esm' | 'umd' | 'dts',\n defaultEntry?: string\n ) => {\n const group = progressState[type]\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 (type === 'dts') {\n resolved[e] = true\n if (Object.values(resolved).every(Boolean)) {\n setTimeout(() => multiBars.stop(), 200)\n }\n }\n }\n )\n }\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 watchingProgress('esm'),\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 watchingProgress('umd', 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 {\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'),\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","styled","index","indexPlugins","entry","entryPlugins","dts","dtsPlugins","pkg","jiek","noBrowser","outdir","outputOptions","dir","Error","namePrefix","exportsEntries","Object","fromEntries","entries","filter","key","value","map","maxLengthEntry","Math","max","values","v","length","paddingEntry","padEnd","globalsRegister","globalsOutput","globals","dependencies","Set","resolveId","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","addBarsByEntries","type","bar","create","update","message","progressState","esm","umd","resolved","watchingProgress","defaultEntry","group","onProcessing","onProcessed","source","importer","writeBundle","bundle","forEach","fileName","watchProgress","e","every","Boolean","setTimeout","stop","input","preserveModules","esbuild","outputName","postcss","autoprefixer","minimize","sourceMap","extract","tsconfig","p","resolve","generateBundle","file","code"],"mappings":"wYAAA,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,QAAS,QACTC,QAAS,OACTC,WAAW,GCJb,SAAAC,EAAyBC,GAIhB,MAAA,CACLA,EACA,IACKA,EACHC,eAAgBD,EAAOC,gBAAgBpB,QAAQ,YAAa,UAC5DqB,QAAS,IAAKF,EAAOE,SAAW,GAAKC,cAG3C,CCGA,MAAMC,EAAgBC,EAAgBA,mCAyBd,EAEpBC,UAAS,EACTJ,SACEK,MAAOC,EAAe,GACtBC,MAAOC,EAAe,GACtBC,IAAKC,EAAa,IAChB,CAAC,GAWH,CAAA,EACJC,KASA,MAAQC,MAAMC,UACZA,GAAY,EAAAC,OACZA,EAAS,QACP,CAAA,GAAOH,EACLI,EAAgB,IACjBtB,EACHuB,IAAKF,GAEH,IAACH,EAAI1B,KACD,MAAA,IAAIgC,MAAM,wBAEZ,MAAAC,EAAaP,EAChB1B,KACAN,QAAQ,eAAe,CAACC,EAAGC,IAAOA,EAAGC,gBAClCqC,EAAiBC,OAAOC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