jiek 0.1.12 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. package/dist/commands/build.esm.js +10 -32
  2. package/dist/commands/build.esm.js.map +1 -1
  3. package/dist/commands/build.esm.min.js +1 -1
  4. package/dist/commands/build.esm.min.js.map +1 -1
  5. package/dist/commands/publish.esm.js +50 -34
  6. package/dist/commands/publish.esm.js.map +1 -1
  7. package/dist/commands/publish.esm.min.js +1 -1
  8. package/dist/commands/publish.esm.min.js.map +1 -1
  9. package/dist/index.esm.js +3 -0
  10. package/dist/index.esm.js.map +1 -1
  11. package/dist/index.esm.min.js +1 -1
  12. package/dist/index.esm.min.js.map +1 -1
  13. package/dist/index.iife.js +192 -67
  14. package/dist/index.iife.js.map +1 -1
  15. package/dist/index.iife.min.js +1 -1
  16. package/dist/index.iife.min.js.map +1 -1
  17. package/dist/index.umd.js +194 -69
  18. package/dist/index.umd.js.map +1 -1
  19. package/dist/index.umd.min.js +1 -1
  20. package/dist/index.umd.min.js.map +1 -1
  21. package/dist/merge-package-json.esm.js +43 -4
  22. package/dist/merge-package-json.esm.js.map +1 -1
  23. package/dist/merge-package-json.esm.min.js +1 -1
  24. package/dist/merge-package-json.esm.min.js.map +1 -1
  25. package/dist/rollup.esm.js +7 -0
  26. package/dist/rollup.esm.js.map +1 -1
  27. package/dist/rollup.esm.min.js +1 -1
  28. package/dist/rollup.esm.min.js.map +1 -1
  29. package/dist/rollup.iife.js +9 -2
  30. package/dist/rollup.iife.js.map +1 -1
  31. package/dist/rollup.iife.min.js +1 -1
  32. package/dist/rollup.iife.min.js.map +1 -1
  33. package/dist/rollup.umd.js +11 -4
  34. package/dist/rollup.umd.js.map +1 -1
  35. package/dist/rollup.umd.min.js +1 -1
  36. package/dist/rollup.umd.min.js.map +1 -1
  37. package/dist/utils/commondir.esm.js +25 -0
  38. package/dist/utils/commondir.esm.js.map +1 -0
  39. package/dist/utils/commondir.esm.min.js +2 -0
  40. package/dist/utils/commondir.esm.min.js.map +1 -0
  41. package/dist/utils/filterSupport.esm.js +78 -0
  42. package/dist/utils/filterSupport.esm.js.map +1 -0
  43. package/dist/utils/filterSupport.esm.min.js +2 -0
  44. package/dist/utils/filterSupport.esm.min.js.map +1 -0
  45. package/package.json +30 -29
@@ -1,2 +1,2 @@
1
- import{pkger as r}from"@jiek/pkger";function i(i,t){const{jiek:{inputs:o,cwd:e,...n}={},exports:p}=i,s=o??(Array.isArray(p)?p:void 0);return{...i,...r({inputs:s,cwd:t,...n})}}export{i as mergePackageJson};
1
+ import e from"node:path";import{pkger as r}from"@jiek/pkger";import{commondir as t}from"./utils/commondir.esm.min.js";function o(o,n){const{jiek:{cwd:i,...s}={}}=o;let{exports:p}=o,c=!1;"string"==typeof p&&(c=!0,p={".":p}),void 0===p&&(p={".":"./src/index.ts"}),"object"==typeof p&&(c=!!(Array.isArray(p)&&p.length>0)||!!p["."]);const m=Array.isArray(p)?p:Object.entries(p).reduce(((e,[r,t])=>{if("string"==typeof t)return"."===r?[t,...e]:e.concat(t);throw new TypeError(`Unexpected value type for key "${r}" in exports, expected string, got ${typeof t}`)}),[]);if(0===m.length)throw new Error("No inputs found");const a=m.map((r=>e.isAbsolute(r)?r:e.resolve(n,r)));let d=e.dirname(a[0]);a.length>1&&(d=t(a,n));const f=a.map((r=>e.relative(d,r)));return{...o,...r({cwd:n,noIndex:!c,source:e.relative(n,d),inputs:f,...s})}}export{o as mergePackageJson};
2
2
  //# sourceMappingURL=merge-package-json.esm.min.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"merge-package-json.esm.min.js","sources":["../src/merge-package-json.ts"],"sourcesContent":["import { type Options, pkger } from '@jiek/pkger'\nimport type { PackageJson } from '@npm/types'\nimport type { Manifest } from '@pnpm/workspace.pkgs-graph'\n\nexport function mergePackageJson(manifest: Manifest & {\n jiek?: Options\n exports?: unknown | unknown[]\n}, cwd: string) {\n const {\n jiek: { inputs: jiekInputs, cwd: _, ...jiek } = {}, exports\n } = manifest\n const inputs = jiekInputs ?? (\n Array.isArray(exports) ? exports : undefined\n )\n return {\n ...manifest,\n ...pkger({ inputs, cwd, ...jiek })\n } as PackageJson\n}\n"],"names":["mergePackageJson","manifest","cwd","jiek","inputs","jiekInputs","_","exports","Array","isArray","pkger"],"mappings":"oCAIgB,SAAAA,EAAiBC,EAG9BC,GACK,MACJC,MAAQC,OAAQC,EAAYH,IAAKI,KAAMH,GAAS,CAAC,EAAAI,QAAGA,GAClDN,EACEG,EAASC,IACbG,MAAMC,QAAQF,GAAWA,OAAU,GAE9B,MAAA,IACFN,KACAS,EAAM,CAAEN,SAAQF,SAAQC,IAE/B"}
1
+ {"version":3,"file":"merge-package-json.esm.min.js","sources":["../src/merge-package-json.ts"],"sourcesContent":["import path from 'node:path'\n\nimport { type Options, pkger } from '@jiek/pkger'\nimport type { Manifest } from '@pnpm/workspace.pkgs-graph'\n\nimport { commondir } from './utils/commondir'\n\nexport function mergePackageJson(manifest: Manifest & {\n jiek?: Options\n exports?: unknown | unknown[]\n}, cwd: string) {\n const {\n jiek: { cwd: _, ...jiek } = {}\n } = manifest\n let { exports } = manifest\n let includeIndex = false\n if (typeof exports === 'string') {\n includeIndex = true\n exports = { '.': exports }\n }\n if (exports === undefined) {\n exports = { '.': './src/index.ts' }\n }\n if (typeof exports === 'object') {\n if (Array.isArray(exports) && exports.length > 0) {\n includeIndex = true\n } else {\n includeIndex = !!(<Record<string, unknown>>exports)['.']\n }\n }\n const inputs = Array.isArray(exports)\n ? exports\n : Object\n .entries(<Record<string, unknown>>exports)\n .reduce((acc, [key, value]) => {\n if (typeof value === 'string') return key === '.'\n ? [value, ...acc]\n : acc.concat(value)\n\n throw new TypeError(`Unexpected value type for key \"${key}\" in exports, expected string, got ${typeof value}`)\n }, [] as string[])\n if (inputs.length === 0)\n throw new Error('No inputs found')\n\n const absoluteInputs = inputs.map(input => path.isAbsolute(input)\n ? input\n : path.resolve(cwd, input)\n )\n let cDir = path.dirname(absoluteInputs[0])\n if (absoluteInputs.length > 1) {\n cDir = commondir(absoluteInputs, cwd)\n }\n const resolvedInputs = absoluteInputs.map(input => {\n return path.relative(cDir, input)\n })\n return {\n ...manifest,\n ...pkger({\n cwd,\n noIndex: !includeIndex,\n source: path.relative(cwd, cDir),\n inputs: resolvedInputs,\n ...jiek\n })\n }\n}\n"],"names":["mergePackageJson","manifest","cwd","jiek","_","exports","includeIndex","Array","isArray","length","inputs","Object","entries","reduce","acc","key","value","concat","TypeError","Error","absoluteInputs","map","input","path","isAbsolute","resolve","cDir","dirname","commondir","resolvedInputs","relative","pkger","noIndex","source"],"mappings":"sHAOgB,SAAAA,EAAiBC,EAG9BC,GACK,MACJC,MAAQD,IAAKE,KAAMD,GAAS,CAAC,GAC3BF,EACA,IAAAI,QAAEA,GAAYJ,EACdK,GAAe,EACI,iBAAZD,IACMC,GAAA,EACLD,EAAA,CAAE,IAAKA,SAEH,IAAZA,IACQA,EAAA,CAAE,IAAK,mBAEI,iBAAZA,IAEQC,KADbC,MAAMC,QAAQH,IAAYA,EAAQI,OAAS,MAGFJ,EAAS,MAGxD,MAAMK,EAASH,MAAMC,QAAQH,GACzBA,EACAM,OACCC,QAAiCP,GACjCQ,QAAO,CAACC,GAAMC,EAAKC,MAClB,GAAqB,iBAAVA,EAA2B,MAAQ,MAARD,EAClC,CAACC,KAAUF,GACXA,EAAIG,OAAOD,GAEf,MAAM,IAAIE,UAAU,kCAAkCH,8CAAgDC,IAAO,GAC5G,IACP,GAAsB,IAAlBN,EAAOD,OACH,MAAA,IAAIU,MAAM,mBAElB,MAAMC,EAAiBV,EAAOW,KAAIC,GAASC,EAAKC,WAAWF,GACvDA,EACAC,EAAKE,QAAQvB,EAAKoB,KAEtB,IAAII,EAAOH,EAAKI,QAAQP,EAAe,IACnCA,EAAeX,OAAS,IACnBiB,EAAAE,EAAUR,EAAgBlB,IAE7B,MAAA2B,EAAiBT,EAAeC,KAAaC,GAC1CC,EAAKO,SAASJ,EAAMJ,KAEtB,MAAA,IACFrB,KACA8B,EAAM,CACP7B,MACA8B,SAAU1B,EACV2B,OAAQV,EAAKO,SAAS5B,EAAKwB,GAC3BhB,OAAQmB,KACL1B,IAGT"}
@@ -1,5 +1,6 @@
1
1
  import { resolve } from 'node:path';
2
2
  import { getWorkspaceDir } from '@jiek/utils/getWorkspaceDir';
3
+ import json from '@rollup/plugin-json';
3
4
  import autoprefixer from 'autoprefixer';
4
5
  import { dts } from 'rollup-plugin-dts';
5
6
  import esbuild from 'rollup-plugin-esbuild';
@@ -34,6 +35,9 @@ const template = ({
34
35
  );
35
36
  const [globalsRegister, globalsOutput] = createGlobalsLinkage();
36
37
  const external = externalResolver();
38
+ const commonPlugins = [
39
+ json()
40
+ ];
37
41
  return [
38
42
  {
39
43
  input: exportsEntries,
@@ -46,6 +50,7 @@ const template = ({
46
50
  })
47
51
  ],
48
52
  plugins: [
53
+ commonPlugins,
49
54
  globalsRegister({ external }),
50
55
  styled && skip({ patterns: [/\.s?css$/] }),
51
56
  esbuild(),
@@ -71,6 +76,7 @@ const template = ({
71
76
  })
72
77
  ],
73
78
  plugins: [
79
+ commonPlugins,
74
80
  globalsOutput,
75
81
  styled && postcss({
76
82
  plugins: [autoprefixer],
@@ -97,6 +103,7 @@ const template = ({
97
103
  }
98
104
  ],
99
105
  plugins: [
106
+ commonPlugins,
100
107
  styled && skip({ patterns: [/\.s?css$/] }),
101
108
  dts({ tsconfig: resolveWorkspacePath("tsconfig.dts.json") }),
102
109
  {
@@ -1 +1 @@
1
- {"version":3,"file":"rollup.esm.js","sources":["../src/rollup/index.ts"],"sourcesContent":["import { resolve } from 'node:path'\n\nimport { getWorkspaceDir } from '@jiek/utils/getWorkspaceDir'\nimport autoprefixer from 'autoprefixer'\nimport type { InputPluginOption, RollupOptions } from 'rollup'\nimport { dts } from 'rollup-plugin-dts'\nimport esbuild from 'rollup-plugin-esbuild'\nimport postcss from 'rollup-plugin-postcss'\n\nimport { createGlobalsLinkage } from './plugins/globals'\nimport skip from './plugins/skip'\nimport { commonOutputOptions } from './utils/commonOptions'\nimport externalResolver from './utils/externalResolver'\nimport withMinify from './utils/withMinify'\n\nconst workspaceRoot = getWorkspaceDir()\nfunction resolveWorkspacePath(p: string) {\n return resolve(workspaceRoot, p)\n}\n\nexport const template = (\n {\n styled = false,\n plugins: {\n index: indexPlugins = [],\n entry: entryPlugins = [],\n dts: dtsPlugins = []\n } = {}\n }: {\n /**\n * include styles files\n */\n styled?: boolean\n plugins?: {\n index?: InputPluginOption\n entry?: InputPluginOption\n dts?: InputPluginOption\n }\n } = {},\n pkg: {\n name?: string\n exports?: Record<string, string | {\n import: string\n 'inner-src': string\n }>\n }\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 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 return [\n {\n input: exportsEntries,\n output: [\n ...withMinify({\n ...commonOutputOptions,\n format: 'esm',\n entryFileNames: '[name].esm.js',\n preserveModules: true\n })\n ],\n plugins: [\n globalsRegister({ external }),\n styled && skip({ patterns: [/\\.s?css$/] }),\n esbuild(),\n indexPlugins\n ]\n },\n ...Object.entries(exportsEntries).map(([name, input]) => {\n const outputName = namePrefix + (\n name === 'index' ? '' : (\n name.replace(/[@|/-](\\w)/g, (_, $1) => $1.toUpperCase())\n )\n )\n return {\n input: input,\n output: [\n ...withMinify({\n ...commonOutputOptions,\n name: outputName,\n format: 'iife',\n entryFileNames: `${name}.iife.js`\n }),\n ...withMinify({\n ...commonOutputOptions,\n name: outputName,\n format: 'umd',\n entryFileNames: `${name}.umd.js`\n })\n ],\n plugins: [\n globalsOutput,\n styled && postcss({\n plugins: [autoprefixer],\n minimize: true,\n sourceMap: true,\n extract: `${name}.css`\n }),\n esbuild(),\n entryPlugins\n ],\n external\n }\n }),\n {\n input: exportsEntries,\n output: [\n {\n dir: 'dist',\n entryFileNames: ({ name }) => `${name.replace(/^src\\//, '')}.esm.d.ts`,\n preserveModules: true\n },\n {\n dir: 'dist'\n }\n ],\n plugins: [\n 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":[],"mappings":";;;;;;;;;;;;AAeA,MAAM,gBAAgB,eAAgB,EAAA,CAAA;AACtC,SAAS,qBAAqB,CAAW,EAAA;AACvC,EAAO,OAAA,OAAA,CAAQ,eAAe,CAAC,CAAA,CAAA;AACjC,CAAA;AAEO,MAAM,WAAW,CACtB;AAAA,EACE,MAAS,GAAA,KAAA;AAAA,EACT,OAAS,EAAA;AAAA,IACP,KAAA,EAAO,eAAe,EAAC;AAAA,IACvB,KAAA,EAAO,eAAe,EAAC;AAAA,IACvB,GAAA,EAAK,aAAa,EAAC;AAAA,MACjB,EAAC;AACP,CAUI,GAAA,IACJ,GAOG,KAAA;AACH,EAAI,IAAA,CAAC,IAAI,IAAM,EAAA;AACb,IAAM,MAAA,IAAI,MAAM,sBAAsB,CAAA,CAAA;AAAA,GACxC;AACA,EAAM,MAAA,UAAA,GAAa,GAChB,CAAA,IAAA,CACA,OAAQ,CAAA,aAAA,EAAe,CAAC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,EAAA,KAAM,GAAG,IAAK,CAAA,OAAA,CAAQ,QAAU,EAAA,EAAE,CAAC,CAAA,SAAA,CAAA;AAAA,UAC3D,eAAiB,EAAA,IAAA;AAAA,SACnB;AAAA,QACA;AAAA,UACE,GAAK,EAAA,MAAA;AAAA,SACP;AAAA,OACF;AAAA,MACA,OAAS,EAAA;AAAA,QACP,UAAU,IAAK,CAAA,EAAE,UAAU,CAAC,UAAU,GAAG,CAAA;AAAA,QACzC,IAAI,EAAE,QAAA,EAAU,oBAAqB,CAAA,mBAAmB,GAAG,CAAA;AAAA,QAC3D;AAAA,UACE,IAAM,EAAA,uCAAA;AAAA;AAAA;AAAA;AAAA;AAAA,UAKN,cAAA,CAAe,GAAG,MAAQ,EAAA;AACxB,YAAA,KAAA,MAAW,IAAQ,IAAA,MAAA,CAAO,MAAO,CAAA,MAAM,CAAG,EAAA;AACxC,cAAA,IAAI,EAAE,MAAU,IAAA,IAAA,CAAA;AAAO,gBAAA,SAAA;AAEvB,cAAK,IAAA,CAAA,IAAA,GAAO,KAAK,IAAK,CAAA,OAAA;AAAA,gBACpB,gCAAA;AAAA,gBACA,CAAA,gBAAA,EAAmB,IAAI,IAAI,CAAA,CAAA,CAAA;AAAA,eAC7B,CAAA;AAAA,aACF;AAAA,WACF;AAAA,SACF;AAAA,QACA,UAAA;AAAA,OACF;AAAA,MACA,QAAA;AAAA,KACF;AAAA,GACF,CAAA;AACF;;;;"}
1
+ {"version":3,"file":"rollup.esm.js","sources":["../src/rollup/index.ts"],"sourcesContent":["import { resolve } from 'node:path'\n\nimport { getWorkspaceDir } from '@jiek/utils/getWorkspaceDir'\nimport json from '@rollup/plugin-json'\nimport autoprefixer from 'autoprefixer'\nimport type { InputPluginOption, RollupOptions } from 'rollup'\nimport { dts } from 'rollup-plugin-dts'\nimport esbuild from 'rollup-plugin-esbuild'\nimport postcss from 'rollup-plugin-postcss'\n\nimport { createGlobalsLinkage } from './plugins/globals'\nimport skip from './plugins/skip'\nimport { commonOutputOptions } from './utils/commonOptions'\nimport externalResolver from './utils/externalResolver'\nimport withMinify from './utils/withMinify'\n\nconst workspaceRoot = getWorkspaceDir()\nfunction resolveWorkspacePath(p: string) {\n return resolve(workspaceRoot, p)\n}\n\nexport const template = (\n {\n styled = false,\n plugins: {\n index: indexPlugins = [],\n entry: entryPlugins = [],\n dts: dtsPlugins = []\n } = {}\n }: {\n /**\n * include styles files\n */\n styled?: boolean\n plugins?: {\n index?: InputPluginOption\n entry?: InputPluginOption\n dts?: InputPluginOption\n }\n } = {},\n pkg: {\n name?: string\n exports?: Record<string, string | {\n import: string\n 'inner-src': string\n }>\n }\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 static files\n .filter(([key]) => !/\\.(json|css|scss)$/.test(key))\n // filter no `inner-src` or `import` field entries\n .filter(([, value]) => typeof value === 'object' && value['inner-src'] && value['import'])\n .map(([key, value]) => [\n key\n .replace(/^\\.$/, 'index')\n .replace(/^\\.\\//, ''),\n typeof value === 'string' ? value : value['inner-src']\n ])\n )\n\n const [globalsRegister, globalsOutput] = createGlobalsLinkage()\n const external = externalResolver()\n\n const commonPlugins = [\n json()\n ]\n return [\n {\n input: exportsEntries,\n output: [\n ...withMinify({\n ...commonOutputOptions,\n format: 'esm',\n entryFileNames: '[name].esm.js',\n preserveModules: true\n })\n ],\n plugins: [\n commonPlugins,\n globalsRegister({ external }),\n styled && skip({ patterns: [/\\.s?css$/] }),\n esbuild(),\n indexPlugins\n ]\n },\n ...Object.entries(exportsEntries).map(([name, input]) => {\n const outputName = namePrefix + (\n name === 'index' ? '' : (\n name.replace(/[@|/-](\\w)/g, (_, $1) => $1.toUpperCase())\n )\n )\n return {\n input: input,\n output: [\n ...withMinify({\n ...commonOutputOptions,\n name: outputName,\n format: 'iife',\n entryFileNames: `${name}.iife.js`\n }),\n ...withMinify({\n ...commonOutputOptions,\n name: outputName,\n format: 'umd',\n entryFileNames: `${name}.umd.js`\n })\n ],\n plugins: [\n commonPlugins,\n globalsOutput,\n styled && postcss({\n plugins: [autoprefixer],\n minimize: true,\n sourceMap: true,\n extract: `${name}.css`\n }),\n esbuild(),\n entryPlugins\n ],\n external\n }\n }),\n {\n input: exportsEntries,\n output: [\n {\n dir: 'dist',\n entryFileNames: ({ name }) => `${name.replace(/^src\\//, '')}.esm.d.ts`,\n preserveModules: true\n },\n {\n dir: 'dist'\n }\n ],\n plugins: [\n commonPlugins,\n styled && skip({ patterns: [/\\.s?css$/] }),\n dts({ tsconfig: resolveWorkspacePath('tsconfig.dts.json') }),\n {\n name: 'rollup-plugin-declare-module-replacer',\n /**\n * replace relative path `declare module './xxx'` to `declare module '{{package name}}'`\n * in output file generated\n */\n generateBundle(_, bundle) {\n for (const file of Object.values(bundle)) {\n if (!('code' in file)) continue\n\n file.code = file.code.replace(\n /declare module ['|\"]\\..*['|\"]/g,\n `declare module '${pkg.name}'`\n )\n }\n }\n },\n dtsPlugins\n ],\n external\n }\n ] as RollupOptions[]\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;AAgBA,MAAM,gBAAgB,eAAgB,EAAA,CAAA;AACtC,SAAS,qBAAqB,CAAW,EAAA;AACvC,EAAO,OAAA,OAAA,CAAQ,eAAe,CAAC,CAAA,CAAA;AACjC,CAAA;AAEO,MAAM,WAAW,CACtB;AAAA,EACE,MAAS,GAAA,KAAA;AAAA,EACT,OAAS,EAAA;AAAA,IACP,KAAA,EAAO,eAAe,EAAC;AAAA,IACvB,KAAA,EAAO,eAAe,EAAC;AAAA,IACvB,GAAA,EAAK,aAAa,EAAC;AAAA,MACjB,EAAC;AACP,CAUI,GAAA,IACJ,GAOG,KAAA;AACH,EAAI,IAAA,CAAC,IAAI,IAAM,EAAA;AACb,IAAM,MAAA,IAAI,MAAM,sBAAsB,CAAA,CAAA;AAAA,GACxC;AACA,EAAM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AAA,OACF,CAAA;AAAA,KACD,CAAA;AAAA,IACD;AAAA,MACE,KAAO,EAAA,cAAA;AAAA,MACP,MAAQ,EAAA;AAAA,QACN;AAAA,UACE,GAAK,EAAA,MAAA;AAAA,UACL,cAAA,EAAgB,CAAC,EAAE,IAAK,EAAA,KAAM,GAAG,IAAK,CAAA,OAAA,CAAQ,QAAU,EAAA,EAAE,CAAC,CAAA,SAAA,CAAA;AAAA,UAC3D,eAAiB,EAAA,IAAA;AAAA,SACnB;AAAA,QACA;AAAA,UACE,GAAK,EAAA,MAAA;AAAA,SACP;AAAA,OACF;AAAA,MACA,OAAS,EAAA;AAAA,QACP,aAAA;AAAA,QACA,UAAU,IAAK,CAAA,EAAE,UAAU,CAAC,UAAU,GAAG,CAAA;AAAA,QACzC,IAAI,EAAE,QAAA,EAAU,oBAAqB,CAAA,mBAAmB,GAAG,CAAA;AAAA,QAC3D;AAAA,UACE,IAAM,EAAA,uCAAA;AAAA;AAAA;AAAA;AAAA;AAAA,UAKN,cAAA,CAAe,GAAG,MAAQ,EAAA;AACxB,YAAA,KAAA,MAAW,IAAQ,IAAA,MAAA,CAAO,MAAO,CAAA,MAAM,CAAG,EAAA;AACxC,cAAA,IAAI,EAAE,MAAU,IAAA,IAAA,CAAA;AAAO,gBAAA,SAAA;AAEvB,cAAK,IAAA,CAAA,IAAA,GAAO,KAAK,IAAK,CAAA,OAAA;AAAA,gBACpB,gCAAA;AAAA,gBACA,CAAA,gBAAA,EAAmB,IAAI,IAAI,CAAA,CAAA,CAAA;AAAA,eAC7B,CAAA;AAAA,aACF;AAAA,WACF;AAAA,SACF;AAAA,QACA,UAAA;AAAA,OACF;AAAA,MACA,QAAA;AAAA,KACF;AAAA,GACF,CAAA;AACF;;;;"}
@@ -1,2 +1,2 @@
1
- import{resolve as e}from"node:path";import{getWorkspaceDir as r}from"@jiek/utils/getWorkspaceDir";import s from"autoprefixer";import{dts as t}from"rollup-plugin-dts";import o from"rollup-plugin-esbuild";import i from"rollup-plugin-postcss";import{createGlobalsLinkage as n}from"./rollup/plugins/globals.esm.min.js";import p from"./rollup/plugins/skip.esm.min.js";import{commonOutputOptions as l}from"./rollup/utils/commonOptions.esm.min.js";import m from"./rollup/utils/externalResolver.esm.min.js";import u from"./rollup/utils/withMinify.esm.min.js";const a=r();const c=({styled:r=!1,plugins:{index:c=[],entry:d=[],dts:f=[]}={}}={},g)=>{if(!g.name)throw new Error("pkg.name is required");const j=g.name.replace(/[@|/-](\w)/g,((e,r)=>r.toUpperCase())),x=Object.fromEntries(Object.entries(g.exports??{}).filter((([e])=>!/\.(json|css|scss)$/.test(e))).filter((([,e])=>"object"==typeof e&&e["inner-src"]&&e.import)).map((([e,r])=>[e.replace(/^\.$/,"index").replace(/^\.\//,""),"string"==typeof r?r:r["inner-src"]]))),[y,$]=n(),b=m();return[{input:x,output:[...u({...l,format:"esm",entryFileNames:"[name].esm.js",preserveModules:!0})],plugins:[y({external:b}),r&&p({patterns:[/\.s?css$/]}),o(),c]},...Object.entries(x).map((([e,t])=>{const n=j+("index"===e?"":e.replace(/[@|/-](\w)/g,((e,r)=>r.toUpperCase())));return{input:t,output:[...u({...l,name:n,format:"iife",entryFileNames:`${e}.iife.js`}),...u({...l,name:n,format:"umd",entryFileNames:`${e}.umd.js`})],plugins:[$,r&&i({plugins:[s],minimize:!0,sourceMap:!0,extract:`${e}.css`}),o(),d],external:b}})),{input:x,output:[{dir:"dist",entryFileNames:({name:e})=>`${e.replace(/^src\//,"")}.esm.d.ts`,preserveModules:!0},{dir:"dist"}],plugins:[r&&p({patterns:[/\.s?css$/]}),t({tsconfig:(v="tsconfig.dts.json",e(a,v))}),{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 '${g.name}'`))}},f],external:b}];var v};export{c as template};
1
+ import{resolve as e}from"node:path";import{getWorkspaceDir as r}from"@jiek/utils/getWorkspaceDir";import s from"@rollup/plugin-json";import t from"autoprefixer";import{dts as o}from"rollup-plugin-dts";import i from"rollup-plugin-esbuild";import n from"rollup-plugin-postcss";import{createGlobalsLinkage as p}from"./rollup/plugins/globals.esm.min.js";import l from"./rollup/plugins/skip.esm.min.js";import{commonOutputOptions as m}from"./rollup/utils/commonOptions.esm.min.js";import u from"./rollup/utils/externalResolver.esm.min.js";import a from"./rollup/utils/withMinify.esm.min.js";const c=r();const d=({styled:r=!1,plugins:{index:d=[],entry:f=[],dts:g=[]}={}}={},j)=>{if(!j.name)throw new Error("pkg.name is required");const x=j.name.replace(/[@|/-](\w)/g,((e,r)=>r.toUpperCase())),y=Object.fromEntries(Object.entries(j.exports??{}).filter((([e])=>!/\.(json|css|scss)$/.test(e))).filter((([,e])=>"object"==typeof e&&e["inner-src"]&&e.import)).map((([e,r])=>[e.replace(/^\.$/,"index").replace(/^\.\//,""),"string"==typeof r?r:r["inner-src"]]))),[$,b]=p(),v=u(),w=[s()];return[{input:y,output:[...a({...m,format:"esm",entryFileNames:"[name].esm.js",preserveModules:!0})],plugins:[w,$({external:v}),r&&l({patterns:[/\.s?css$/]}),i(),d]},...Object.entries(y).map((([e,s])=>{const o=x+("index"===e?"":e.replace(/[@|/-](\w)/g,((e,r)=>r.toUpperCase())));return{input:s,output:[...a({...m,name:o,format:"iife",entryFileNames:`${e}.iife.js`}),...a({...m,name:o,format:"umd",entryFileNames:`${e}.umd.js`})],plugins:[w,b,r&&n({plugins:[t],minimize:!0,sourceMap:!0,extract:`${e}.css`}),i(),f],external:v}})),{input:y,output:[{dir:"dist",entryFileNames:({name:e})=>`${e.replace(/^src\//,"")}.esm.d.ts`,preserveModules:!0},{dir:"dist"}],plugins:[w,r&&l({patterns:[/\.s?css$/]}),o({tsconfig:(O="tsconfig.dts.json",e(c,O))}),{name:"rollup-plugin-declare-module-replacer",generateBundle(e,r){for(const e of Object.values(r))"code"in e&&(e.code=e.code.replace(/declare module ['|"]\..*['|"]/g,`declare module '${j.name}'`))}},g],external:v}];var O};export{d 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 { getWorkspaceDir } from '@jiek/utils/getWorkspaceDir'\nimport autoprefixer from 'autoprefixer'\nimport type { InputPluginOption, RollupOptions } from 'rollup'\nimport { dts } from 'rollup-plugin-dts'\nimport esbuild from 'rollup-plugin-esbuild'\nimport postcss from 'rollup-plugin-postcss'\n\nimport { createGlobalsLinkage } from './plugins/globals'\nimport skip from './plugins/skip'\nimport { commonOutputOptions } from './utils/commonOptions'\nimport externalResolver from './utils/externalResolver'\nimport withMinify from './utils/withMinify'\n\nconst workspaceRoot = getWorkspaceDir()\nfunction resolveWorkspacePath(p: string) {\n return resolve(workspaceRoot, p)\n}\n\nexport const template = (\n {\n styled = false,\n plugins: {\n index: indexPlugins = [],\n entry: entryPlugins = [],\n dts: dtsPlugins = []\n } = {}\n }: {\n /**\n * include styles files\n */\n styled?: boolean\n plugins?: {\n index?: InputPluginOption\n entry?: InputPluginOption\n dts?: InputPluginOption\n }\n } = {},\n pkg: {\n name?: string\n exports?: Record<string, string | {\n import: string\n 'inner-src': string\n }>\n }\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 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 return [\n {\n input: exportsEntries,\n output: [\n ...withMinify({\n ...commonOutputOptions,\n format: 'esm',\n entryFileNames: '[name].esm.js',\n preserveModules: true\n })\n ],\n plugins: [\n globalsRegister({ external }),\n styled && skip({ patterns: [/\\.s?css$/] }),\n esbuild(),\n indexPlugins\n ]\n },\n ...Object.entries(exportsEntries).map(([name, input]) => {\n const outputName = namePrefix + (\n name === 'index' ? '' : (\n name.replace(/[@|/-](\\w)/g, (_, $1) => $1.toUpperCase())\n )\n )\n return {\n input: input,\n output: [\n ...withMinify({\n ...commonOutputOptions,\n name: outputName,\n format: 'iife',\n entryFileNames: `${name}.iife.js`\n }),\n ...withMinify({\n ...commonOutputOptions,\n name: outputName,\n format: 'umd',\n entryFileNames: `${name}.umd.js`\n })\n ],\n plugins: [\n globalsOutput,\n styled && postcss({\n plugins: [autoprefixer],\n minimize: true,\n sourceMap: true,\n extract: `${name}.css`\n }),\n esbuild(),\n entryPlugins\n ],\n external\n }\n }),\n {\n input: exportsEntries,\n output: [\n {\n dir: 'dist',\n entryFileNames: ({ name }) => `${name.replace(/^src\\//, '')}.esm.d.ts`,\n preserveModules: true\n },\n {\n dir: 'dist'\n }\n ],\n plugins: [\n 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","name","Error","namePrefix","replace","_","$1","toUpperCase","exportsEntries","Object","fromEntries","entries","exports","filter","key","test","value","map","globalsRegister","globalsOutput","createGlobalsLinkage","external","externalResolver","input","output","withMinify","commonOutputOptions","format","entryFileNames","preserveModules","skip","patterns","esbuild","outputName","postcss","autoprefixer","minimize","sourceMap","extract","dir","tsconfig","p","resolve","generateBundle","bundle","file","values","code"],"mappings":"uiBAeA,MAAMA,EAAgBC,IAKf,MAAMC,EAAW,EAEpBC,UAAS,EACTC,SACEC,MAAOC,EAAe,GACtBC,MAAOC,EAAe,GACtBC,IAAKC,EAAa,IAChB,CAAC,GAWH,CAAA,EACJC,KAQI,IAACA,EAAIC,KACD,MAAA,IAAIC,MAAM,wBAEZ,MAAAC,EAAaH,EAChBC,KACAG,QAAQ,eAAe,CAACC,EAAGC,IAAOA,EAAGC,gBAClCC,EAAiBC,OAAOC,YAC5BD,OAAOE,QAAQX,EAAIY,SAAW,CAAA,GAE3BC,QAAO,EAAEC,MAAU,qBAAqBC,KAAKD,KAE7CD,QAAO,EAAI,CAAAG,KAA4B,iBAAVA,GAAsBA,EAAM,cAAgBA,EAAc,SACvFC,KAAI,EAAEH,EAAKE,KAAW,CACrBF,EACGV,QAAQ,OAAQ,SAChBA,QAAQ,QAAS,IACH,iBAAVY,EAAqBA,EAAQA,EAAM,kBAIzCE,EAAiBC,GAAiBC,IACnCC,EAAWC,IAEV,MAAA,CACL,CACEC,MAAOf,EACPgB,OAAQ,IACHC,EAAW,IACTC,EACHC,OAAQ,MACRC,eAAgB,gBAChBC,iBAAiB,KAGrBpC,QAAS,CACPyB,EAAgB,CAAEG,aAClB7B,GAAUsC,EAAK,CAAEC,SAAU,CAAC,cAC5BC,IACArC,OAGDc,OAAOE,QAAQH,GAAgBS,KAAI,EAAEhB,EAAMsB,MAC5C,MAAMU,EAAa9B,GACR,UAATF,EAAmB,GACjBA,EAAKG,QAAQ,eAAe,CAACC,EAAGC,IAAOA,EAAGC,iBAGvC,MAAA,CACLgB,QACAC,OAAQ,IACHC,EAAW,IACTC,EACHzB,KAAMgC,EACNN,OAAQ,OACRC,eAAgB,GAAG3B,iBAElBwB,EAAW,IACTC,EACHzB,KAAMgC,EACNN,OAAQ,MACRC,eAAgB,GAAG3B,cAGvBR,QAAS,CACP0B,EACA3B,GAAU0C,EAAQ,CAChBzC,QAAS,CAAC0C,GACVC,UAAU,EACVC,WAAW,EACXC,QAAS,GAAGrC,UAEd+B,IACAnC,GAEFwB,WACF,IAEF,CACEE,MAAOf,EACPgB,OAAQ,CACN,CACEe,IAAK,OACLX,eAAgB,EAAG3B,UAAW,GAAGA,EAAKG,QAAQ,SAAU,eACxDyB,iBAAiB,GAEnB,CACEU,IAAK,SAGT9C,QAAS,CACPD,GAAUsC,EAAK,CAAEC,SAAU,CAAC,cAC5BjC,EAAI,CAAE0C,UA1HgBC,EA0He,oBAzHpCC,EAAQrD,EAAeoD,MA0HxB,CACExC,KAAM,wCAKN,cAAA0C,CAAetC,EAAGuC,GAChB,IAAA,MAAWC,KAAQpC,OAAOqC,OAAOF,GACzB,SAAUC,IAEXA,EAAAE,KAAOF,EAAKE,KAAK3C,QACpB,iCACA,mBAAmBJ,EAAIC,SAG7B,GAEFF,GAEFsB,aA9IN,IAA8BoB,CAgJ5B"}
1
+ {"version":3,"file":"rollup.esm.min.js","sources":["../src/rollup/index.ts"],"sourcesContent":["import { resolve } from 'node:path'\n\nimport { getWorkspaceDir } from '@jiek/utils/getWorkspaceDir'\nimport json from '@rollup/plugin-json'\nimport autoprefixer from 'autoprefixer'\nimport type { InputPluginOption, RollupOptions } from 'rollup'\nimport { dts } from 'rollup-plugin-dts'\nimport esbuild from 'rollup-plugin-esbuild'\nimport postcss from 'rollup-plugin-postcss'\n\nimport { createGlobalsLinkage } from './plugins/globals'\nimport skip from './plugins/skip'\nimport { commonOutputOptions } from './utils/commonOptions'\nimport externalResolver from './utils/externalResolver'\nimport withMinify from './utils/withMinify'\n\nconst workspaceRoot = getWorkspaceDir()\nfunction resolveWorkspacePath(p: string) {\n return resolve(workspaceRoot, p)\n}\n\nexport const template = (\n {\n styled = false,\n plugins: {\n index: indexPlugins = [],\n entry: entryPlugins = [],\n dts: dtsPlugins = []\n } = {}\n }: {\n /**\n * include styles files\n */\n styled?: boolean\n plugins?: {\n index?: InputPluginOption\n entry?: InputPluginOption\n dts?: InputPluginOption\n }\n } = {},\n pkg: {\n name?: string\n exports?: Record<string, string | {\n import: string\n 'inner-src': string\n }>\n }\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 static files\n .filter(([key]) => !/\\.(json|css|scss)$/.test(key))\n // filter no `inner-src` or `import` field entries\n .filter(([, value]) => typeof value === 'object' && value['inner-src'] && value['import'])\n .map(([key, value]) => [\n key\n .replace(/^\\.$/, 'index')\n .replace(/^\\.\\//, ''),\n typeof value === 'string' ? value : value['inner-src']\n ])\n )\n\n const [globalsRegister, globalsOutput] = createGlobalsLinkage()\n const external = externalResolver()\n\n const commonPlugins = [\n json()\n ]\n return [\n {\n input: exportsEntries,\n output: [\n ...withMinify({\n ...commonOutputOptions,\n format: 'esm',\n entryFileNames: '[name].esm.js',\n preserveModules: true\n })\n ],\n plugins: [\n commonPlugins,\n globalsRegister({ external }),\n styled && skip({ patterns: [/\\.s?css$/] }),\n esbuild(),\n indexPlugins\n ]\n },\n ...Object.entries(exportsEntries).map(([name, input]) => {\n const outputName = namePrefix + (\n name === 'index' ? '' : (\n name.replace(/[@|/-](\\w)/g, (_, $1) => $1.toUpperCase())\n )\n )\n return {\n input: input,\n output: [\n ...withMinify({\n ...commonOutputOptions,\n name: outputName,\n format: 'iife',\n entryFileNames: `${name}.iife.js`\n }),\n ...withMinify({\n ...commonOutputOptions,\n name: outputName,\n format: 'umd',\n entryFileNames: `${name}.umd.js`\n })\n ],\n plugins: [\n commonPlugins,\n globalsOutput,\n styled && postcss({\n plugins: [autoprefixer],\n minimize: true,\n sourceMap: true,\n extract: `${name}.css`\n }),\n esbuild(),\n entryPlugins\n ],\n external\n }\n }),\n {\n input: exportsEntries,\n output: [\n {\n dir: 'dist',\n entryFileNames: ({ name }) => `${name.replace(/^src\\//, '')}.esm.d.ts`,\n preserveModules: true\n },\n {\n dir: 'dist'\n }\n ],\n plugins: [\n commonPlugins,\n styled && skip({ patterns: [/\\.s?css$/] }),\n dts({ tsconfig: resolveWorkspacePath('tsconfig.dts.json') }),\n {\n name: 'rollup-plugin-declare-module-replacer',\n /**\n * replace relative path `declare module './xxx'` to `declare module '{{package name}}'`\n * in output file generated\n */\n generateBundle(_, bundle) {\n for (const file of Object.values(bundle)) {\n if (!('code' in file)) continue\n\n file.code = file.code.replace(\n /declare module ['|\"]\\..*['|\"]/g,\n `declare module '${pkg.name}'`\n )\n }\n }\n },\n dtsPlugins\n ],\n external\n }\n ] as RollupOptions[]\n}\n"],"names":["workspaceRoot","getWorkspaceDir","template","styled","plugins","index","indexPlugins","entry","entryPlugins","dts","dtsPlugins","pkg","name","Error","namePrefix","replace","_","$1","toUpperCase","exportsEntries","Object","fromEntries","entries","exports","filter","key","test","value","map","globalsRegister","globalsOutput","createGlobalsLinkage","external","externalResolver","commonPlugins","json","input","output","withMinify","commonOutputOptions","format","entryFileNames","preserveModules","skip","patterns","esbuild","outputName","postcss","autoprefixer","minimize","sourceMap","extract","dir","tsconfig","p","resolve","generateBundle","bundle","file","values","code"],"mappings":"0kBAgBA,MAAMA,EAAgBC,IAKf,MAAMC,EAAW,EAEpBC,UAAS,EACTC,SACEC,MAAOC,EAAe,GACtBC,MAAOC,EAAe,GACtBC,IAAKC,EAAa,IAChB,CAAC,GAWH,CAAA,EACJC,KAQI,IAACA,EAAIC,KACD,MAAA,IAAIC,MAAM,wBAEZ,MAAAC,EAAaH,EAChBC,KACAG,QAAQ,eAAe,CAACC,EAAGC,IAAOA,EAAGC,gBAClCC,EAAiBC,OAAOC,YAC5BD,OAAOE,QAAQX,EAAIY,SAAW,CAAA,GAE3BC,QAAO,EAAEC,MAAU,qBAAqBC,KAAKD,KAE7CD,QAAO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,EAAGyC,GAChB,IAAA,MAAWC,KAAQtC,OAAOuC,OAAOF,GACzB,SAAUC,IAEXA,EAAAE,KAAOF,EAAKE,KAAK7C,QACpB,iCACA,mBAAmBJ,EAAIC,SAG7B,GAEFF,GAEFsB,aApJN,IAA8BsB,CAsJ5B"}
@@ -1,8 +1,9 @@
1
- var jiekrollup = (function (exports, node_path, getWorkspaceDir, autoprefixer, rollupPluginDts, esbuild, postcss, terser) {
1
+ var jiekrollup = (function (exports, node_path, getWorkspaceDir, json, autoprefixer, rollupPluginDts, esbuild, postcss, terser) {
2
2
  'use strict';
3
3
 
4
4
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
5
5
 
6
+ var json__default = /*#__PURE__*/_interopDefault(json);
6
7
  var autoprefixer__default = /*#__PURE__*/_interopDefault(autoprefixer);
7
8
  var esbuild__default = /*#__PURE__*/_interopDefault(esbuild);
8
9
  var postcss__default = /*#__PURE__*/_interopDefault(postcss);
@@ -124,6 +125,9 @@ var jiekrollup = (function (exports, node_path, getWorkspaceDir, autoprefixer, r
124
125
  );
125
126
  const [globalsRegister, globalsOutput] = createGlobalsLinkage();
126
127
  const external = externalResolver();
128
+ const commonPlugins = [
129
+ json__default.default()
130
+ ];
127
131
  return [
128
132
  {
129
133
  input: exportsEntries,
@@ -136,6 +140,7 @@ var jiekrollup = (function (exports, node_path, getWorkspaceDir, autoprefixer, r
136
140
  })
137
141
  ],
138
142
  plugins: [
143
+ commonPlugins,
139
144
  globalsRegister({ external }),
140
145
  styled && skip({ patterns: [/\.s?css$/] }),
141
146
  esbuild__default.default(),
@@ -161,6 +166,7 @@ var jiekrollup = (function (exports, node_path, getWorkspaceDir, autoprefixer, r
161
166
  })
162
167
  ],
163
168
  plugins: [
169
+ commonPlugins,
164
170
  globalsOutput,
165
171
  styled && postcss__default.default({
166
172
  plugins: [autoprefixer__default.default],
@@ -187,6 +193,7 @@ var jiekrollup = (function (exports, node_path, getWorkspaceDir, autoprefixer, r
187
193
  }
188
194
  ],
189
195
  plugins: [
196
+ commonPlugins,
190
197
  styled && skip({ patterns: [/\.s?css$/] }),
191
198
  rollupPluginDts.dts({ tsconfig: resolveWorkspacePath("tsconfig.dts.json") }),
192
199
  {
@@ -217,5 +224,5 @@ var jiekrollup = (function (exports, node_path, getWorkspaceDir, autoprefixer, r
217
224
 
218
225
  return exports;
219
226
 
220
- })({}, node_path, getWorkspaceDir, autoprefixer, rollupPluginDts, esbuild, postcss, terser);
227
+ })({}, node_path, getWorkspaceDir, json, autoprefixer, rollupPluginDts, esbuild, postcss, terser);
221
228
  //# sourceMappingURL=rollup.iife.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"rollup.iife.js","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 if (external.startsWith('@zodui/')) {\n return external\n .replace(/[@/-](\\w)/g, (_, c) => c.toUpperCase())\n }\n return {\n react: 'React',\n // TODO `react/jsx-runtime` is not supported `umd`\n 'react/jsx-runtime': 'ReactJSXRuntime',\n // https://cdn.jsdelivr.net/npm/react@18.2.0/umd/react.development.js\n 'react-dom': 'ReactDOM',\n // https://cdn.jsdelivr.net/npm/react-dom@18.2.0/umd/react-dom.development.js\n // TODO make the library use the global variable `TDesignReact` replace `TDesign`\n 'tdesign-react/esm': 'TDesign',\n // https://cdn.jsdelivr.net/npm/tdesign-react@1.4.0/dist/tdesign.js\n // https://cdn.jsdelivr.net/npm/tdesign-react@1.4.0/dist/tdesign.css\n 'tdesign-icons-react': 'TDesignIconReact',\n // https://cdn.jsdelivr.net/npm/tdesign-icons-react@1.4.0/dist/index.js\n zod: 'Zod',\n '@zodui/core': 'ZodUICore',\n '@zodui/core/utils': 'ZodUICoreUtils',\n '@zodui/react': 'ZodUIReact'\n }[external]\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 dir: 'dist',\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 = {} } = pkg\n const external = <(string | RegExp)[]>Object\n .keys(dependencies)\n .concat(Object.keys(peerDependencies))\n return external\n .map(dep => new RegExp(`^${dep}(/.*)?$`))\n}\n","import terser from '@rollup/plugin-terser'\nimport type { OutputOptions, OutputPlugin } from 'rollup'\n\nexport default function (output: OutputOptions & {\n entryFileNames?: string\n plugins?: OutputPlugin[]\n}): OutputOptions[] {\n return [\n output,\n {\n ...output,\n entryFileNames: output.entryFileNames?.replace(/(\\.js)$/, '.min$1'),\n plugins: [...(output.plugins ?? []), terser()]\n }\n ]\n}\n","import { resolve } from 'node:path'\n\nimport { getWorkspaceDir } from '@jiek/utils/getWorkspaceDir'\nimport autoprefixer from 'autoprefixer'\nimport type { InputPluginOption, RollupOptions } from 'rollup'\nimport { dts } from 'rollup-plugin-dts'\nimport esbuild from 'rollup-plugin-esbuild'\nimport postcss from 'rollup-plugin-postcss'\n\nimport { createGlobalsLinkage } from './plugins/globals'\nimport skip from './plugins/skip'\nimport { commonOutputOptions } from './utils/commonOptions'\nimport externalResolver from './utils/externalResolver'\nimport withMinify from './utils/withMinify'\n\nconst workspaceRoot = getWorkspaceDir()\nfunction resolveWorkspacePath(p: string) {\n return resolve(workspaceRoot, p)\n}\n\nexport const template = (\n {\n styled = false,\n plugins: {\n index: indexPlugins = [],\n entry: entryPlugins = [],\n dts: dtsPlugins = []\n } = {}\n }: {\n /**\n * include styles files\n */\n styled?: boolean\n plugins?: {\n index?: InputPluginOption\n entry?: InputPluginOption\n dts?: InputPluginOption\n }\n } = {},\n pkg: {\n name?: string\n exports?: Record<string, string | {\n import: string\n 'inner-src': string\n }>\n }\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 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 return [\n {\n input: exportsEntries,\n output: [\n ...withMinify({\n ...commonOutputOptions,\n format: 'esm',\n entryFileNames: '[name].esm.js',\n preserveModules: true\n })\n ],\n plugins: [\n globalsRegister({ external }),\n styled && skip({ patterns: [/\\.s?css$/] }),\n esbuild(),\n indexPlugins\n ]\n },\n ...Object.entries(exportsEntries).map(([name, input]) => {\n const outputName = namePrefix + (\n name === 'index' ? '' : (\n name.replace(/[@|/-](\\w)/g, (_, $1) => $1.toUpperCase())\n )\n )\n return {\n input: input,\n output: [\n ...withMinify({\n ...commonOutputOptions,\n name: outputName,\n format: 'iife',\n entryFileNames: `${name}.iife.js`\n }),\n ...withMinify({\n ...commonOutputOptions,\n name: outputName,\n format: 'umd',\n entryFileNames: `${name}.umd.js`\n })\n ],\n plugins: [\n globalsOutput,\n styled && postcss({\n plugins: [autoprefixer],\n minimize: true,\n sourceMap: true,\n extract: `${name}.css`\n }),\n esbuild(),\n entryPlugins\n ],\n external\n }\n }),\n {\n input: exportsEntries,\n output: [\n {\n dir: 'dist',\n entryFileNames: ({ name }) => `${name.replace(/^src\\//, '')}.esm.d.ts`,\n preserveModules: true\n },\n {\n dir: 'dist'\n }\n ],\n plugins: [\n 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":["terser","getWorkspaceDir","resolve","esbuild","postcss","autoprefixer","dts"],"mappings":";;;;;;;;;;EAAA,uBAAA,CAAyB,QAAkB,EAAA;EACzC,EAAI,IAAA,QAAA,CAAS,UAAW,CAAA,SAAS,CAAG,EAAA;EAClC,IAAO,OAAA,QAAA,CACJ,QAAQ,YAAc,EAAA,CAAC,GAAG,CAAM,KAAA,CAAA,CAAE,aAAa,CAAA,CAAA;EAAA,GACpD;EACA,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AG,CAAA;EAAA,QACzCG,oBAAI,EAAE,QAAA,EAAU,oBAAqB,CAAA,mBAAmB,GAAG,CAAA;EAAA,QAC3D;EAAA,UACE,IAAM,EAAA,uCAAA;EAAA;EAAA;EAAA;EAAA;EAAA,UAKN,cAAA,CAAe,GAAG,MAAQ,EAAA;EACxB,YAAA,KAAA,MAAW,IAAQ,IAAA,MAAA,CAAO,MAAO,CAAA,MAAM,CAAG,EAAA;EACxC,cAAA,IAAI,EAAE,MAAU,IAAA,IAAA,CAAA;EAAO,gBAAA,SAAA;EAEvB,cAAK,IAAA,CAAA,IAAA,GAAO,KAAK,IAAK,CAAA,OAAA;EAAA,gBACpB,gCAAA;EAAA,gBACA,CAAA,gBAAA,EAAmB,IAAI,IAAI,CAAA,CAAA,CAAA;EAAA,eAC7B,CAAA;EAAA,aACF;EAAA,WACF;EAAA,SACF;EAAA,QACA,UAAA;EAAA,OACF;EAAA,MACA,QAAA;EAAA,KACF;EAAA,GACF,CAAA;EACF;;;;;;;;;;"}
1
+ {"version":3,"file":"rollup.iife.js","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 if (external.startsWith('@zodui/')) {\n return external\n .replace(/[@/-](\\w)/g, (_, c) => c.toUpperCase())\n }\n return {\n react: 'React',\n // TODO `react/jsx-runtime` is not supported `umd`\n 'react/jsx-runtime': 'ReactJSXRuntime',\n // https://cdn.jsdelivr.net/npm/react@18.2.0/umd/react.development.js\n 'react-dom': 'ReactDOM',\n // https://cdn.jsdelivr.net/npm/react-dom@18.2.0/umd/react-dom.development.js\n // TODO make the library use the global variable `TDesignReact` replace `TDesign`\n 'tdesign-react/esm': 'TDesign',\n // https://cdn.jsdelivr.net/npm/tdesign-react@1.4.0/dist/tdesign.js\n // https://cdn.jsdelivr.net/npm/tdesign-react@1.4.0/dist/tdesign.css\n 'tdesign-icons-react': 'TDesignIconReact',\n // https://cdn.jsdelivr.net/npm/tdesign-icons-react@1.4.0/dist/index.js\n zod: 'Zod',\n '@zodui/core': 'ZodUICore',\n '@zodui/core/utils': 'ZodUICoreUtils',\n '@zodui/react': 'ZodUIReact'\n }[external]\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 dir: 'dist',\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 = {} } = pkg\n const external = <(string | RegExp)[]>Object\n .keys(dependencies)\n .concat(Object.keys(peerDependencies))\n return external\n .map(dep => new RegExp(`^${dep}(/.*)?$`))\n}\n","import terser from '@rollup/plugin-terser'\nimport type { OutputOptions, OutputPlugin } from 'rollup'\n\nexport default function (output: OutputOptions & {\n entryFileNames?: string\n plugins?: OutputPlugin[]\n}): OutputOptions[] {\n return [\n output,\n {\n ...output,\n entryFileNames: output.entryFileNames?.replace(/(\\.js)$/, '.min$1'),\n plugins: [...(output.plugins ?? []), terser()]\n }\n ]\n}\n","import { resolve } from 'node:path'\n\nimport { getWorkspaceDir } from '@jiek/utils/getWorkspaceDir'\nimport json from '@rollup/plugin-json'\nimport autoprefixer from 'autoprefixer'\nimport type { InputPluginOption, RollupOptions } from 'rollup'\nimport { dts } from 'rollup-plugin-dts'\nimport esbuild from 'rollup-plugin-esbuild'\nimport postcss from 'rollup-plugin-postcss'\n\nimport { createGlobalsLinkage } from './plugins/globals'\nimport skip from './plugins/skip'\nimport { commonOutputOptions } from './utils/commonOptions'\nimport externalResolver from './utils/externalResolver'\nimport withMinify from './utils/withMinify'\n\nconst workspaceRoot = getWorkspaceDir()\nfunction resolveWorkspacePath(p: string) {\n return resolve(workspaceRoot, p)\n}\n\nexport const template = (\n {\n styled = false,\n plugins: {\n index: indexPlugins = [],\n entry: entryPlugins = [],\n dts: dtsPlugins = []\n } = {}\n }: {\n /**\n * include styles files\n */\n styled?: boolean\n plugins?: {\n index?: InputPluginOption\n entry?: InputPluginOption\n dts?: InputPluginOption\n }\n } = {},\n pkg: {\n name?: string\n exports?: Record<string, string | {\n import: string\n 'inner-src': string\n }>\n }\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 static files\n .filter(([key]) => !/\\.(json|css|scss)$/.test(key))\n // filter no `inner-src` or `import` field entries\n .filter(([, value]) => typeof value === 'object' && value['inner-src'] && value['import'])\n .map(([key, value]) => [\n key\n .replace(/^\\.$/, 'index')\n .replace(/^\\.\\//, ''),\n typeof value === 'string' ? value : value['inner-src']\n ])\n )\n\n const [globalsRegister, globalsOutput] = createGlobalsLinkage()\n const external = externalResolver()\n\n const commonPlugins = [\n json()\n ]\n return [\n {\n input: exportsEntries,\n output: [\n ...withMinify({\n ...commonOutputOptions,\n format: 'esm',\n entryFileNames: '[name].esm.js',\n preserveModules: true\n })\n ],\n plugins: [\n commonPlugins,\n globalsRegister({ external }),\n styled && skip({ patterns: [/\\.s?css$/] }),\n esbuild(),\n indexPlugins\n ]\n },\n ...Object.entries(exportsEntries).map(([name, input]) => {\n const outputName = namePrefix + (\n name === 'index' ? '' : (\n name.replace(/[@|/-](\\w)/g, (_, $1) => $1.toUpperCase())\n )\n )\n return {\n input: input,\n output: [\n ...withMinify({\n ...commonOutputOptions,\n name: outputName,\n format: 'iife',\n entryFileNames: `${name}.iife.js`\n }),\n ...withMinify({\n ...commonOutputOptions,\n name: outputName,\n format: 'umd',\n entryFileNames: `${name}.umd.js`\n })\n ],\n plugins: [\n commonPlugins,\n globalsOutput,\n styled && postcss({\n plugins: [autoprefixer],\n minimize: true,\n sourceMap: true,\n extract: `${name}.css`\n }),\n esbuild(),\n entryPlugins\n ],\n external\n }\n }),\n {\n input: exportsEntries,\n output: [\n {\n dir: 'dist',\n entryFileNames: ({ name }) => `${name.replace(/^src\\//, '')}.esm.d.ts`,\n preserveModules: true\n },\n {\n dir: 'dist'\n }\n ],\n plugins: [\n commonPlugins,\n styled && skip({ patterns: [/\\.s?css$/] }),\n dts({ tsconfig: resolveWorkspacePath('tsconfig.dts.json') }),\n {\n name: 'rollup-plugin-declare-module-replacer',\n /**\n * replace relative path `declare module './xxx'` to `declare module '{{package name}}'`\n * in output file generated\n */\n generateBundle(_, bundle) {\n for (const file of Object.values(bundle)) {\n if (!('code' in file)) continue\n\n file.code = file.code.replace(\n /declare module ['|\"]\\..*['|\"]/g,\n `declare module '${pkg.name}'`\n )\n }\n }\n },\n dtsPlugins\n ],\n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CAAA;EAAA,IACD;EAAA,MACE,KAAO,EAAA,cAAA;EAAA,MACP,MAAQ,EAAA;EAAA,QACN;EAAA,UACE,GAAK,EAAA,MAAA;EAAA,UACL,cAAA,EAAgB,CAAC,EAAE,IAAK,EAAA,KAAM,GAAG,IAAK,CAAA,OAAA,CAAQ,QAAU,EAAA,EAAE,CAAC,CAAA,SAAA,CAAA;EAAA,UAC3D,eAAiB,EAAA,IAAA;EAAA,SACnB;EAAA,QACA;EAAA,UACE,GAAK,EAAA,MAAA;EAAA,SACP;EAAA,OACF;EAAA,MACA,OAAS,EAAA;EAAA,QACP,aAAA;EAAA,QACA,UAAU,IAAK,CAAA,EAAE,UAAU,CAAC,UAAU,GAAG,CAAA;EAAA,QACzCG,oBAAI,EAAE,QAAA,EAAU,oBAAqB,CAAA,mBAAmB,GAAG,CAAA;EAAA,QAC3D;EAAA,UACE,IAAM,EAAA,uCAAA;EAAA;EAAA;EAAA;EAAA;EAAA,UAKN,cAAA,CAAe,GAAG,MAAQ,EAAA;EACxB,YAAA,KAAA,MAAW,IAAQ,IAAA,MAAA,CAAO,MAAO,CAAA,MAAM,CAAG,EAAA;EACxC,cAAA,IAAI,EAAE,MAAU,IAAA,IAAA,CAAA;EAAO,gBAAA,SAAA;EAEvB,cAAK,IAAA,CAAA,IAAA,GAAO,KAAK,IAAK,CAAA,OAAA;EAAA,gBACpB,gCAAA;EAAA,gBACA,CAAA,gBAAA,EAAmB,IAAI,IAAI,CAAA,CAAA,CAAA;EAAA,eAC7B,CAAA;EAAA,aACF;EAAA,WACF;EAAA,SACF;EAAA,QACA,UAAA;EAAA,OACF;EAAA,MACA,QAAA;EAAA,KACF;EAAA,GACF,CAAA;EACF;;;;;;;;;;"}
@@ -1,2 +1,2 @@
1
- var jiekrollup=function(e,t,r,s,n,o,a,i){"use strict";function c(e){return e&&e.__esModule?e:{default:e}}var u=c(s),l=c(o),p=c(a),d=c(i);function m(e){return e.startsWith("@zodui/")?e.replace(/[@/-](\w)/g,((e,t)=>t.toUpperCase())):{react:"React","react/jsx-runtime":"ReactJSXRuntime","react-dom":"ReactDOM","tdesign-react/esm":"TDesign","tdesign-icons-react":"TDesignIconReact",zod:"Zod","@zodui/core":"ZodUICore","@zodui/core/utils":"ZodUICoreUtils","@zodui/react":"ZodUIReact"}[e]}var f=(e={})=>({name:"skip",load(t){if(e.patterns?.some((e=>"string"==typeof e?t.includes(e):e.test(t))))return""}});const g={dir:"dist",exports:"named",interop:"auto",sourcemap:!0};function j(e){return[e,{...e,entryFileNames:e.entryFileNames?.replace(/(\.js)$/,".min$1"),plugins:[...e.plugins??[],d.default()]}]}const x=r.getWorkspaceDir();return e.template=({styled:e=!1,plugins:{index:r=[],entry:s=[],dts:o=[]}={}}={},a)=>{if(!a.name)throw new Error("pkg.name is required");const i=a.name.replace(/[@|/-](\w)/g,((e,t)=>t.toUpperCase())),c=Object.fromEntries(Object.entries(a.exports??{}).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"]]))),[d,$]=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]:m(t)})),{}),{...r,globals:e})}),{outputOptions:t=>({...t,globals:e})}]}(),y=function(){const e=process.cwd(),t=require(`${e}/package.json`),{dependencies:r={},peerDependencies:s={}}=t;return Object.keys(r).concat(Object.keys(s)).map((e=>new RegExp(`^${e}(/.*)?$`)))}();return[{input:c,output:[...j({...g,format:"esm",entryFileNames:"[name].esm.js",preserveModules:!0})],plugins:[d({external:y}),e&&f({patterns:[/\.s?css$/]}),l.default(),r]},...Object.entries(c).map((([t,r])=>{const n=i+("index"===t?"":t.replace(/[@|/-](\w)/g,((e,t)=>t.toUpperCase())));return{input:r,output:[...j({...g,name:n,format:"iife",entryFileNames:`${t}.iife.js`}),...j({...g,name:n,format:"umd",entryFileNames:`${t}.umd.js`})],plugins:[$,e&&p.default({plugins:[u.default],minimize:!0,sourceMap:!0,extract:`${t}.css`}),l.default(),s],external:y}})),{input:c,output:[{dir:"dist",entryFileNames:({name:e})=>`${e.replace(/^src\//,"")}.esm.d.ts`,preserveModules:!0},{dir:"dist"}],plugins:[e&&f({patterns:[/\.s?css$/]}),n.dts({tsconfig:(b="tsconfig.dts.json",t.resolve(x,b))}),{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:y}];var b},e}({},node_path,getWorkspaceDir,autoprefixer,rollupPluginDts,esbuild,postcss,terser);
1
+ var jiekrollup=function(e,t,r,s,n,o,a,i,c){"use strict";function u(e){return e&&e.__esModule?e:{default:e}}var l=u(s),p=u(n),d=u(a),m=u(i),f=u(c);function g(e){return e.startsWith("@zodui/")?e.replace(/[@/-](\w)/g,((e,t)=>t.toUpperCase())):{react:"React","react/jsx-runtime":"ReactJSXRuntime","react-dom":"ReactDOM","tdesign-react/esm":"TDesign","tdesign-icons-react":"TDesignIconReact",zod:"Zod","@zodui/core":"ZodUICore","@zodui/core/utils":"ZodUICoreUtils","@zodui/react":"ZodUIReact"}[e]}var j=(e={})=>({name:"skip",load(t){if(e.patterns?.some((e=>"string"==typeof e?t.includes(e):e.test(t))))return""}});const x={dir:"dist",exports:"named",interop:"auto",sourcemap:!0};function $(e){return[e,{...e,entryFileNames:e.entryFileNames?.replace(/(\.js)$/,".min$1"),plugins:[...e.plugins??[],f.default()]}]}const y=r.getWorkspaceDir();return e.template=({styled:e=!1,plugins:{index:r=[],entry:s=[],dts:n=[]}={}}={},a)=>{if(!a.name)throw new Error("pkg.name is required");const i=a.name.replace(/[@|/-](\w)/g,((e,t)=>t.toUpperCase())),c=Object.fromEntries(Object.entries(a.exports??{}).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"]]))),[u,f]=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})}]}(),b=function(){const e=process.cwd(),t=require(`${e}/package.json`),{dependencies:r={},peerDependencies:s={}}=t;return Object.keys(r).concat(Object.keys(s)).map((e=>new RegExp(`^${e}(/.*)?$`)))}(),v=[l.default()];return[{input:c,output:[...$({...x,format:"esm",entryFileNames:"[name].esm.js",preserveModules:!0})],plugins:[v,u({external:b}),e&&j({patterns:[/\.s?css$/]}),d.default(),r]},...Object.entries(c).map((([t,r])=>{const n=i+("index"===t?"":t.replace(/[@|/-](\w)/g,((e,t)=>t.toUpperCase())));return{input:r,output:[...$({...x,name:n,format:"iife",entryFileNames:`${t}.iife.js`}),...$({...x,name:n,format:"umd",entryFileNames:`${t}.umd.js`})],plugins:[v,f,e&&m.default({plugins:[p.default],minimize:!0,sourceMap:!0,extract:`${t}.css`}),d.default(),s],external:b}})),{input:c,output:[{dir:"dist",entryFileNames:({name:e})=>`${e.replace(/^src\//,"")}.esm.d.ts`,preserveModules:!0},{dir:"dist"}],plugins:[v,e&&j({patterns:[/\.s?css$/]}),o.dts({tsconfig:(O="tsconfig.dts.json",t.resolve(y,O))}),{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}'`))}},n],external:b}];var O},e}({},node_path,getWorkspaceDir,json,autoprefixer,rollupPluginDts,esbuild,postcss,terser);
2
2
  //# sourceMappingURL=rollup.iife.min.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"rollup.iife.min.js","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 if (external.startsWith('@zodui/')) {\n return external\n .replace(/[@/-](\\w)/g, (_, c) => c.toUpperCase())\n }\n return {\n react: 'React',\n // TODO `react/jsx-runtime` is not supported `umd`\n 'react/jsx-runtime': 'ReactJSXRuntime',\n // https://cdn.jsdelivr.net/npm/react@18.2.0/umd/react.development.js\n 'react-dom': 'ReactDOM',\n // https://cdn.jsdelivr.net/npm/react-dom@18.2.0/umd/react-dom.development.js\n // TODO make the library use the global variable `TDesignReact` replace `TDesign`\n 'tdesign-react/esm': 'TDesign',\n // https://cdn.jsdelivr.net/npm/tdesign-react@1.4.0/dist/tdesign.js\n // https://cdn.jsdelivr.net/npm/tdesign-react@1.4.0/dist/tdesign.css\n 'tdesign-icons-react': 'TDesignIconReact',\n // https://cdn.jsdelivr.net/npm/tdesign-icons-react@1.4.0/dist/index.js\n zod: 'Zod',\n '@zodui/core': 'ZodUICore',\n '@zodui/core/utils': 'ZodUICoreUtils',\n '@zodui/react': 'ZodUIReact'\n }[external]\n}\n","import type { PluginImpl } from 'rollup'\n\ninterface Options {\n patterns?: (string | RegExp)[]\n}\n\nexport default ((options = {}) => {\n return {\n name: 'skip',\n // skip the specified files by `options.patterns`\n load(id) {\n if (\n options.patterns?.some((pattern) =>\n typeof pattern === 'string'\n ? id.includes(pattern)\n : pattern.test(id)\n )\n ) {\n return ''\n }\n }\n }\n}) as PluginImpl<Options>\n","import type { OutputOptions } from 'rollup'\n\nconst defineOutput = <O extends OutputOptions>(output: O) => output\n\nexport const commonOutputOptions = defineOutput({\n dir: 'dist',\n exports: 'named',\n interop: 'auto',\n sourcemap: true\n})\n","import terser from '@rollup/plugin-terser'\nimport type { OutputOptions, OutputPlugin } from 'rollup'\n\nexport default function (output: OutputOptions & {\n entryFileNames?: string\n plugins?: OutputPlugin[]\n}): OutputOptions[] {\n return [\n output,\n {\n ...output,\n entryFileNames: output.entryFileNames?.replace(/(\\.js)$/, '.min$1'),\n plugins: [...(output.plugins ?? []), terser()]\n }\n ]\n}\n","import { resolve } from 'node:path'\n\nimport { getWorkspaceDir } from '@jiek/utils/getWorkspaceDir'\nimport autoprefixer from 'autoprefixer'\nimport type { InputPluginOption, RollupOptions } from 'rollup'\nimport { dts } from 'rollup-plugin-dts'\nimport esbuild from 'rollup-plugin-esbuild'\nimport postcss from 'rollup-plugin-postcss'\n\nimport { createGlobalsLinkage } from './plugins/globals'\nimport skip from './plugins/skip'\nimport { commonOutputOptions } from './utils/commonOptions'\nimport externalResolver from './utils/externalResolver'\nimport withMinify from './utils/withMinify'\n\nconst workspaceRoot = getWorkspaceDir()\nfunction resolveWorkspacePath(p: string) {\n return resolve(workspaceRoot, p)\n}\n\nexport const template = (\n {\n styled = false,\n plugins: {\n index: indexPlugins = [],\n entry: entryPlugins = [],\n dts: dtsPlugins = []\n } = {}\n }: {\n /**\n * include styles files\n */\n styled?: boolean\n plugins?: {\n index?: InputPluginOption\n entry?: InputPluginOption\n dts?: InputPluginOption\n }\n } = {},\n pkg: {\n name?: string\n exports?: Record<string, string | {\n import: string\n 'inner-src': string\n }>\n }\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 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 return [\n {\n input: exportsEntries,\n output: [\n ...withMinify({\n ...commonOutputOptions,\n format: 'esm',\n entryFileNames: '[name].esm.js',\n preserveModules: true\n })\n ],\n plugins: [\n globalsRegister({ external }),\n styled && skip({ patterns: [/\\.s?css$/] }),\n esbuild(),\n indexPlugins\n ]\n },\n ...Object.entries(exportsEntries).map(([name, input]) => {\n const outputName = namePrefix + (\n name === 'index' ? '' : (\n name.replace(/[@|/-](\\w)/g, (_, $1) => $1.toUpperCase())\n )\n )\n return {\n input: input,\n output: [\n ...withMinify({\n ...commonOutputOptions,\n name: outputName,\n format: 'iife',\n entryFileNames: `${name}.iife.js`\n }),\n ...withMinify({\n ...commonOutputOptions,\n name: outputName,\n format: 'umd',\n entryFileNames: `${name}.umd.js`\n })\n ],\n plugins: [\n globalsOutput,\n styled && postcss({\n plugins: [autoprefixer],\n minimize: true,\n sourceMap: true,\n extract: `${name}.css`\n }),\n esbuild(),\n entryPlugins\n ],\n external\n }\n }),\n {\n input: exportsEntries,\n output: [\n {\n dir: 'dist',\n entryFileNames: ({ name }) => `${name.replace(/^src\\//, '')}.esm.d.ts`,\n preserveModules: true\n },\n {\n dir: 'dist'\n }\n ],\n plugins: [\n 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 = {} } = pkg\n const external = <(string | RegExp)[]>Object\n .keys(dependencies)\n .concat(Object.keys(peerDependencies))\n return external\n .map(dep => new RegExp(`^${dep}(/.*)?$`))\n}\n"],"names":["globalResolver","external","startsWith","replace","_","c","toUpperCase","react","zod","skip","options","name","load","id","patterns","some","pattern","includes","test","commonOutputOptions","dir","exports","interop","sourcemap","withMinify","output","entryFileNames","plugins","terser","workspaceRoot","getWorkspaceDir","styled","index","indexPlugins","entry","entryPlugins","dts","dtsPlugins","pkg","Error","namePrefix","$1","exportsEntries","Object","fromEntries","entries","filter","key","value","map","globalsRegister","globalsOutput","globals","dependencies","Set","resolveId","dep","RegExp","add","outputOptions","reduce","acc","createGlobalsLinkage","cwd","process","require","peerDependencies","keys","concat","externalResolver","input","format","preserveModules","esbuild","outputName","postcss","autoprefixer","minimize","sourceMap","extract","tsconfig","p","resolve","generateBundle","bundle","file","values","code"],"mappings":"yIAAA,SAAAA,EAAyBC,GACnB,OAAAA,EAASC,WAAW,WACfD,EACJE,QAAQ,cAAc,CAACC,EAAGC,IAAMA,EAAEC,gBAEhC,CACLC,MAAO,QAEP,oBAAqB,kBAErB,YAAa,WAGb,oBAAqB,UAGrB,sBAAuB,mBAE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IAEF,CACEqE,MAAO5B,EACPjB,OAAQ,CACN,CACEL,IAAK,OACLM,eAAgB,EAAGf,UAAW,GAAGA,EAAKR,QAAQ,SAAU,eACxDqE,iBAAiB,GAEnB,CACEpD,IAAK,SAGTO,QAAS,CACPI,GAAUtB,EAAK,CAAEK,SAAU,CAAC,cAC5BsB,EAAAA,IAAI,CAAE4C,UA1HgBC,EA0He,oBAzHpCC,EAAAA,QAAQrD,EAAeoD,MA0HxB,CACEtE,KAAM,wCAKN,cAAAwE,CAAe/E,EAAGgF,GAChB,IAAA,MAAWC,KAAQ1C,OAAO2C,OAAOF,GACzB,SAAUC,IAEXA,EAAAE,KAAOF,EAAKE,KAAKpF,QACpB,iCACA,mBAAmBmC,EAAI3B,SAG7B,GAEF0B,GAEFpC,aA9IN,IAA8BgF,CAgJ5B"}
1
+ {"version":3,"file":"rollup.iife.min.js","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 if (external.startsWith('@zodui/')) {\n return external\n .replace(/[@/-](\\w)/g, (_, c) => c.toUpperCase())\n }\n return {\n react: 'React',\n // TODO `react/jsx-runtime` is not supported `umd`\n 'react/jsx-runtime': 'ReactJSXRuntime',\n // https://cdn.jsdelivr.net/npm/react@18.2.0/umd/react.development.js\n 'react-dom': 'ReactDOM',\n // https://cdn.jsdelivr.net/npm/react-dom@18.2.0/umd/react-dom.development.js\n // TODO make the library use the global variable `TDesignReact` replace `TDesign`\n 'tdesign-react/esm': 'TDesign',\n // https://cdn.jsdelivr.net/npm/tdesign-react@1.4.0/dist/tdesign.js\n // https://cdn.jsdelivr.net/npm/tdesign-react@1.4.0/dist/tdesign.css\n 'tdesign-icons-react': 'TDesignIconReact',\n // https://cdn.jsdelivr.net/npm/tdesign-icons-react@1.4.0/dist/index.js\n zod: 'Zod',\n '@zodui/core': 'ZodUICore',\n '@zodui/core/utils': 'ZodUICoreUtils',\n '@zodui/react': 'ZodUIReact'\n }[external]\n}\n","import type { PluginImpl } from 'rollup'\n\ninterface Options {\n patterns?: (string | RegExp)[]\n}\n\nexport default ((options = {}) => {\n return {\n name: 'skip',\n // skip the specified files by `options.patterns`\n load(id) {\n if (\n options.patterns?.some((pattern) =>\n typeof pattern === 'string'\n ? id.includes(pattern)\n : pattern.test(id)\n )\n ) {\n return ''\n }\n }\n }\n}) as PluginImpl<Options>\n","import type { OutputOptions } from 'rollup'\n\nconst defineOutput = <O extends OutputOptions>(output: O) => output\n\nexport const commonOutputOptions = defineOutput({\n dir: 'dist',\n exports: 'named',\n interop: 'auto',\n sourcemap: true\n})\n","import terser from '@rollup/plugin-terser'\nimport type { OutputOptions, OutputPlugin } from 'rollup'\n\nexport default function (output: OutputOptions & {\n entryFileNames?: string\n plugins?: OutputPlugin[]\n}): OutputOptions[] {\n return [\n output,\n {\n ...output,\n entryFileNames: output.entryFileNames?.replace(/(\\.js)$/, '.min$1'),\n plugins: [...(output.plugins ?? []), terser()]\n }\n ]\n}\n","import { resolve } from 'node:path'\n\nimport { getWorkspaceDir } from '@jiek/utils/getWorkspaceDir'\nimport json from '@rollup/plugin-json'\nimport autoprefixer from 'autoprefixer'\nimport type { InputPluginOption, RollupOptions } from 'rollup'\nimport { dts } from 'rollup-plugin-dts'\nimport esbuild from 'rollup-plugin-esbuild'\nimport postcss from 'rollup-plugin-postcss'\n\nimport { createGlobalsLinkage } from './plugins/globals'\nimport skip from './plugins/skip'\nimport { commonOutputOptions } from './utils/commonOptions'\nimport externalResolver from './utils/externalResolver'\nimport withMinify from './utils/withMinify'\n\nconst workspaceRoot = getWorkspaceDir()\nfunction resolveWorkspacePath(p: string) {\n return resolve(workspaceRoot, p)\n}\n\nexport const template = (\n {\n styled = false,\n plugins: {\n index: indexPlugins = [],\n entry: entryPlugins = [],\n dts: dtsPlugins = []\n } = {}\n }: {\n /**\n * include styles files\n */\n styled?: boolean\n plugins?: {\n index?: InputPluginOption\n entry?: InputPluginOption\n dts?: InputPluginOption\n }\n } = {},\n pkg: {\n name?: string\n exports?: Record<string, string | {\n import: string\n 'inner-src': string\n }>\n }\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 static files\n .filter(([key]) => !/\\.(json|css|scss)$/.test(key))\n // filter no `inner-src` or `import` field entries\n .filter(([, value]) => typeof value === 'object' && value['inner-src'] && value['import'])\n .map(([key, value]) => [\n key\n .replace(/^\\.$/, 'index')\n .replace(/^\\.\\//, ''),\n typeof value === 'string' ? value : value['inner-src']\n ])\n )\n\n const [globalsRegister, globalsOutput] = createGlobalsLinkage()\n const external = externalResolver()\n\n const commonPlugins = [\n json()\n ]\n return [\n {\n input: exportsEntries,\n output: [\n ...withMinify({\n ...commonOutputOptions,\n format: 'esm',\n entryFileNames: '[name].esm.js',\n preserveModules: true\n })\n ],\n plugins: [\n commonPlugins,\n globalsRegister({ external }),\n styled && skip({ patterns: [/\\.s?css$/] }),\n esbuild(),\n indexPlugins\n ]\n },\n ...Object.entries(exportsEntries).map(([name, input]) => {\n const outputName = namePrefix + (\n name === 'index' ? '' : (\n name.replace(/[@|/-](\\w)/g, (_, $1) => $1.toUpperCase())\n )\n )\n return {\n input: input,\n output: [\n ...withMinify({\n ...commonOutputOptions,\n name: outputName,\n format: 'iife',\n entryFileNames: `${name}.iife.js`\n }),\n ...withMinify({\n ...commonOutputOptions,\n name: outputName,\n format: 'umd',\n entryFileNames: `${name}.umd.js`\n })\n ],\n plugins: [\n commonPlugins,\n globalsOutput,\n styled && postcss({\n plugins: [autoprefixer],\n minimize: true,\n sourceMap: true,\n extract: `${name}.css`\n }),\n esbuild(),\n entryPlugins\n ],\n external\n }\n }),\n {\n input: exportsEntries,\n output: [\n {\n dir: 'dist',\n entryFileNames: ({ name }) => `${name.replace(/^src\\//, '')}.esm.d.ts`,\n preserveModules: true\n },\n {\n dir: 'dist'\n }\n ],\n plugins: [\n commonPlugins,\n styled && skip({ patterns: [/\\.s?css$/] }),\n dts({ tsconfig: resolveWorkspacePath('tsconfig.dts.json') }),\n {\n name: 'rollup-plugin-declare-module-replacer',\n /**\n * replace relative path `declare module './xxx'` to `declare module '{{package name}}'`\n * in output file generated\n */\n generateBundle(_, bundle) {\n for (const file of Object.values(bundle)) {\n if (!('code' in file)) continue\n\n file.code = file.code.replace(\n /declare module ['|\"]\\..*['|\"]/g,\n `declare module '${pkg.name}'`\n )\n }\n }\n },\n dtsPlugins\n ],\n external\n }\n ] as RollupOptions[]\n}\n","import type { Plugin, PluginImpl } from 'rollup'\n\nimport globalResolver from '../utils/globalResolver'\n\ninterface GlobalsOptions {\n external?: (string | RegExp)[]\n}\n\nexport function createGlobalsLinkage() {\n let globals = {}\n const dependencies = new Set<string>([])\n return [\n (({ external } = {}) => {\n return {\n name: 'globals',\n resolveId(id) {\n if (external?.some(dep => dep instanceof RegExp ? dep.test(id) : dep === id)) {\n dependencies.add(id)\n return { id, external: true }\n }\n return null\n },\n outputOptions(options) {\n globals = [...dependencies].reduce((acc, value) => ({\n ...acc,\n [value]: globalResolver(value)\n }), {})\n return { ...options, globals }\n }\n }\n }) as PluginImpl<GlobalsOptions>,\n { outputOptions: options => ({ ...options, globals }) } as Plugin\n ] as const\n}\n","export default function () {\n const cwd = process.cwd()\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n const pkg = require(`${cwd}/package.json`)\n const { dependencies = {}, peerDependencies = {} } = pkg\n const external = <(string | RegExp)[]>Object\n .keys(dependencies)\n .concat(Object.keys(peerDependencies))\n return external\n .map(dep => new RegExp(`^${dep}(/.*)?$`))\n}\n"],"names":["globalResolver","external","startsWith","replace","_","c","toUpperCase","react","zod","skip","options","name","load","id","patterns","some","pattern","includes","test","commonOutputOptions","dir","exports","interop","sourcemap","withMinify","output","entryFileNames","plugins","terser","workspaceRoot","getWorkspaceDir","styled","index","indexPlugins","entry","entryPlugins","dts","dtsPlugins","pkg","Error","namePrefix","$1","exportsEntries","Object","fromEntries","entries","filter","key","value","map","globalsRegister","globalsOutput","globals","dependencies","Set","resolveId","dep","RegExp","add","outputOptions","reduce","acc","createGlobalsLinkage","cwd","process","require","peerDependencies","keys","concat","externalResolver","commonPlugins","json","input","format","preserveModules","esbuild","outputName","postcss","autoprefixer","minimize","sourceMap","extract","tsconfig","p","resolve","generateBundle","bundle","file","values","code"],"mappings":"kJAAA,SAAAA,EAAyBC,GACnB,OAAAA,EAASC,WAAW,WACfD,EACJE,QAAQ,cAAc,CAACC,EAAGC,IAAMA,EAAEC,gBAEhC,CACLC,MAAO,QAEP,oBAAqB,kBAErB,YAAa,WAGb,oBAAqB,UAGrB,sBAAuB,mBAEvBC,IAAK,MACL,cAAe,YACf,oBAAqB,iBACrB,eAAgB,cAChBP,EACJ,CCjBA,IAAAQ,EAAgB,CAACC,EAAU,CAAA,KAClB,CACLC,KAAM,OAEN,IAAAC,CAAKC,GACH,GACEH,EAAQI,UAAUC,MAAMC,GACH,iBAAZA,EACHH,EAAGI,SAASD,GACZA,EAAQE,KAAKL,KAGZ,MAAA,EAEX,IClBJ,MAEaM,EAAmC,CAC9CC,IAAK,OACLC,QAAS,QACTC,QAAS,OACTC,WAAW,GCLb,SAAAC,EAAyBC,GAIhB,MAAA,CACLA,EACA,IACKA,EACHC,eAAgBD,EAAOC,gBAAgBvB,QAAQ,UAAW,UAC1DwB,QAAS,IAAKF,EAAOE,SAAW,GAAKC,cAG3C,CCCA,MAAMC,EAAgBC,EAAgBA,oCAKd,EAEpBC,UAAS,EACTJ,SACEK,MAAOC,EAAe,GACtBC,MAAOC,EAAe,GACtBC,IAAKC,EAAa,IAChB,CAAC,GAWH,CAAA,EACJC,KAQI,IAACA,EAAI3B,KACD,MAAA,IAAI4B,MAAM,wBAEZ,MAAA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KAGrB/C,QAAS,CACP2C,EACApB,EAAgB,CAAEjD,aAClB8B,GAAUtB,EAAK,CAAEK,SAAU,CAAC,cAC5B6D,YACA1C,OAGDU,OAAOE,QAAQH,GAAgBO,KAAI,EAAEtC,EAAM6D,MAC5C,MAAMI,EAAapC,GACR,UAAT7B,EAAmB,GACjBA,EAAKR,QAAQ,eAAe,CAACC,EAAGqC,IAAOA,EAAGnC,iBAGvC,MAAA,CACLkE,QACA/C,OAAQ,IACHD,EAAW,IACTL,EACHR,KAAMiE,EACNH,OAAQ,OACR/C,eAAgB,GAAGf,iBAElBa,EAAW,IACTL,EACHR,KAAMiE,EACNH,OAAQ,MACR/C,eAAgB,GAAGf,cAGvBgB,QAAS,CACP2C,EACAnB,EACApB,GAAU8C,EAAAA,QAAQ,CAChBlD,QAAS,CAACmD,EAAAA,SACVC,UAAU,EACVC,WAAW,EACXC,QAAS,GAAGtE,UAEdgE,YACAxC,GAEFlC,WACF,IAEF,CACEuE,MAAO9B,EACPjB,OAAQ,CACN,CACEL,IAAK,OACLM,eAAgB,EAAGf,UAAW,GAAGA,EAAKR,QAAQ,SAAU,eACxDuE,iBAAiB,GAEnB,CACEtD,IAAK,SAGTO,QAAS,CACP2C,EACAvC,GAAUtB,EAAK,CAAEK,SAAU,CAAC,cAC5BsB,EAAAA,IAAI,CAAE8C,UAhIgBC,EAgIe,oBA/HpCC,EAAAA,QAAQvD,EAAesD,MAgIxB,CACExE,KAAM,wCAKN,cAAA0E,CAAejF,EAAGkF,GAChB,IAAA,MAAWC,KAAQ5C,OAAO6C,OAAOF,GACzB,SAAUC,IAEXA,EAAAE,KAAOF,EAAKE,KAAKtF,QACpB,iCACA,mBAAmBmC,EAAI3B,SAG7B,GAEF0B,GAEFpC,aApJN,IAA8BkF,CAsJ5B"}
@@ -1,11 +1,12 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('node:path'), require('@jiek/utils/getWorkspaceDir'), require('autoprefixer'), require('rollup-plugin-dts'), require('rollup-plugin-esbuild'), require('rollup-plugin-postcss'), require('@rollup/plugin-terser')) :
3
- typeof define === 'function' && define.amd ? define(['exports', 'node:path', '@jiek/utils/getWorkspaceDir', 'autoprefixer', 'rollup-plugin-dts', 'rollup-plugin-esbuild', 'rollup-plugin-postcss', '@rollup/plugin-terser'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.jiekrollup = {}, global.node_path, global.getWorkspaceDir, global.autoprefixer, global.rollupPluginDts, global.esbuild, global.postcss, global.terser));
5
- })(this, (function (exports, node_path, getWorkspaceDir, autoprefixer, rollupPluginDts, esbuild, postcss, terser) { 'use strict';
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('node:path'), require('@jiek/utils/getWorkspaceDir'), require('@rollup/plugin-json'), require('autoprefixer'), require('rollup-plugin-dts'), require('rollup-plugin-esbuild'), require('rollup-plugin-postcss'), require('@rollup/plugin-terser')) :
3
+ typeof define === 'function' && define.amd ? define(['exports', 'node:path', '@jiek/utils/getWorkspaceDir', '@rollup/plugin-json', 'autoprefixer', 'rollup-plugin-dts', 'rollup-plugin-esbuild', 'rollup-plugin-postcss', '@rollup/plugin-terser'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.jiekrollup = {}, global.node_path, global.getWorkspaceDir, global.json, global.autoprefixer, global.rollupPluginDts, global.esbuild, global.postcss, global.terser));
5
+ })(this, (function (exports, node_path, getWorkspaceDir, json, autoprefixer, rollupPluginDts, esbuild, postcss, terser) { 'use strict';
6
6
 
7
7
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
8
8
 
9
+ var json__default = /*#__PURE__*/_interopDefault(json);
9
10
  var autoprefixer__default = /*#__PURE__*/_interopDefault(autoprefixer);
10
11
  var esbuild__default = /*#__PURE__*/_interopDefault(esbuild);
11
12
  var postcss__default = /*#__PURE__*/_interopDefault(postcss);
@@ -127,6 +128,9 @@
127
128
  );
128
129
  const [globalsRegister, globalsOutput] = createGlobalsLinkage();
129
130
  const external = externalResolver();
131
+ const commonPlugins = [
132
+ json__default.default()
133
+ ];
130
134
  return [
131
135
  {
132
136
  input: exportsEntries,
@@ -139,6 +143,7 @@
139
143
  })
140
144
  ],
141
145
  plugins: [
146
+ commonPlugins,
142
147
  globalsRegister({ external }),
143
148
  styled && skip({ patterns: [/\.s?css$/] }),
144
149
  esbuild__default.default(),
@@ -164,6 +169,7 @@
164
169
  })
165
170
  ],
166
171
  plugins: [
172
+ commonPlugins,
167
173
  globalsOutput,
168
174
  styled && postcss__default.default({
169
175
  plugins: [autoprefixer__default.default],
@@ -190,6 +196,7 @@
190
196
  }
191
197
  ],
192
198
  plugins: [
199
+ commonPlugins,
193
200
  styled && skip({ patterns: [/\.s?css$/] }),
194
201
  rollupPluginDts.dts({ tsconfig: resolveWorkspacePath("tsconfig.dts.json") }),
195
202
  {
@@ -1 +1 @@
1
- {"version":3,"file":"rollup.umd.js","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 if (external.startsWith('@zodui/')) {\n return external\n .replace(/[@/-](\\w)/g, (_, c) => c.toUpperCase())\n }\n return {\n react: 'React',\n // TODO `react/jsx-runtime` is not supported `umd`\n 'react/jsx-runtime': 'ReactJSXRuntime',\n // https://cdn.jsdelivr.net/npm/react@18.2.0/umd/react.development.js\n 'react-dom': 'ReactDOM',\n // https://cdn.jsdelivr.net/npm/react-dom@18.2.0/umd/react-dom.development.js\n // TODO make the library use the global variable `TDesignReact` replace `TDesign`\n 'tdesign-react/esm': 'TDesign',\n // https://cdn.jsdelivr.net/npm/tdesign-react@1.4.0/dist/tdesign.js\n // https://cdn.jsdelivr.net/npm/tdesign-react@1.4.0/dist/tdesign.css\n 'tdesign-icons-react': 'TDesignIconReact',\n // https://cdn.jsdelivr.net/npm/tdesign-icons-react@1.4.0/dist/index.js\n zod: 'Zod',\n '@zodui/core': 'ZodUICore',\n '@zodui/core/utils': 'ZodUICoreUtils',\n '@zodui/react': 'ZodUIReact'\n }[external]\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 dir: 'dist',\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 = {} } = pkg\n const external = <(string | RegExp)[]>Object\n .keys(dependencies)\n .concat(Object.keys(peerDependencies))\n return external\n .map(dep => new RegExp(`^${dep}(/.*)?$`))\n}\n","import terser from '@rollup/plugin-terser'\nimport type { OutputOptions, OutputPlugin } from 'rollup'\n\nexport default function (output: OutputOptions & {\n entryFileNames?: string\n plugins?: OutputPlugin[]\n}): OutputOptions[] {\n return [\n output,\n {\n ...output,\n entryFileNames: output.entryFileNames?.replace(/(\\.js)$/, '.min$1'),\n plugins: [...(output.plugins ?? []), terser()]\n }\n ]\n}\n","import { resolve } from 'node:path'\n\nimport { getWorkspaceDir } from '@jiek/utils/getWorkspaceDir'\nimport autoprefixer from 'autoprefixer'\nimport type { InputPluginOption, RollupOptions } from 'rollup'\nimport { dts } from 'rollup-plugin-dts'\nimport esbuild from 'rollup-plugin-esbuild'\nimport postcss from 'rollup-plugin-postcss'\n\nimport { createGlobalsLinkage } from './plugins/globals'\nimport skip from './plugins/skip'\nimport { commonOutputOptions } from './utils/commonOptions'\nimport externalResolver from './utils/externalResolver'\nimport withMinify from './utils/withMinify'\n\nconst workspaceRoot = getWorkspaceDir()\nfunction resolveWorkspacePath(p: string) {\n return resolve(workspaceRoot, p)\n}\n\nexport const template = (\n {\n styled = false,\n plugins: {\n index: indexPlugins = [],\n entry: entryPlugins = [],\n dts: dtsPlugins = []\n } = {}\n }: {\n /**\n * include styles files\n */\n styled?: boolean\n plugins?: {\n index?: InputPluginOption\n entry?: InputPluginOption\n dts?: InputPluginOption\n }\n } = {},\n pkg: {\n name?: string\n exports?: Record<string, string | {\n import: string\n 'inner-src': string\n }>\n }\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 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 return [\n {\n input: exportsEntries,\n output: [\n ...withMinify({\n ...commonOutputOptions,\n format: 'esm',\n entryFileNames: '[name].esm.js',\n preserveModules: true\n })\n ],\n plugins: [\n globalsRegister({ external }),\n styled && skip({ patterns: [/\\.s?css$/] }),\n esbuild(),\n indexPlugins\n ]\n },\n ...Object.entries(exportsEntries).map(([name, input]) => {\n const outputName = namePrefix + (\n name === 'index' ? '' : (\n name.replace(/[@|/-](\\w)/g, (_, $1) => $1.toUpperCase())\n )\n )\n return {\n input: input,\n output: [\n ...withMinify({\n ...commonOutputOptions,\n name: outputName,\n format: 'iife',\n entryFileNames: `${name}.iife.js`\n }),\n ...withMinify({\n ...commonOutputOptions,\n name: outputName,\n format: 'umd',\n entryFileNames: `${name}.umd.js`\n })\n ],\n plugins: [\n globalsOutput,\n styled && postcss({\n plugins: [autoprefixer],\n minimize: true,\n sourceMap: true,\n extract: `${name}.css`\n }),\n esbuild(),\n entryPlugins\n ],\n external\n }\n }),\n {\n input: exportsEntries,\n output: [\n {\n dir: 'dist',\n entryFileNames: ({ name }) => `${name.replace(/^src\\//, '')}.esm.d.ts`,\n preserveModules: true\n },\n {\n dir: 'dist'\n }\n ],\n plugins: [\n 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":["terser","getWorkspaceDir","resolve","esbuild","postcss","autoprefixer","dts"],"mappings":";;;;;;;;;;;;;EAAA,uBAAA,CAAyB,QAAkB,EAAA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AA,UAC3D,eAAiB,EAAA,IAAA;EAAA,SACnB;EAAA,QACA;EAAA,UACE,GAAK,EAAA,MAAA;EAAA,SACP;EAAA,OACF;EAAA,MACA,OAAS,EAAA;EAAA,QACP,UAAU,IAAK,CAAA,EAAE,UAAU,CAAC,UAAU,GAAG,CAAA;EAAA,QACzCG,oBAAI,EAAE,QAAA,EAAU,oBAAqB,CAAA,mBAAmB,GAAG,CAAA;EAAA,QAC3D;EAAA,UACE,IAAM,EAAA,uCAAA;EAAA;EAAA;EAAA;EAAA;EAAA,UAKN,cAAA,CAAe,GAAG,MAAQ,EAAA;EACxB,YAAA,KAAA,MAAW,IAAQ,IAAA,MAAA,CAAO,MAAO,CAAA,MAAM,CAAG,EAAA;EACxC,cAAA,IAAI,EAAE,MAAU,IAAA,IAAA,CAAA;EAAO,gBAAA,SAAA;EAEvB,cAAK,IAAA,CAAA,IAAA,GAAO,KAAK,IAAK,CAAA,OAAA;EAAA,gBACpB,gCAAA;EAAA,gBACA,CAAA,gBAAA,EAAmB,IAAI,IAAI,CAAA,CAAA,CAAA;EAAA,eAC7B,CAAA;EAAA,aACF;EAAA,WACF;EAAA,SACF;EAAA,QACA,UAAA;EAAA,OACF;EAAA,MACA,QAAA;EAAA,KACF;EAAA,GACF,CAAA;EACF;;;;;;;;"}
1
+ {"version":3,"file":"rollup.umd.js","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 if (external.startsWith('@zodui/')) {\n return external\n .replace(/[@/-](\\w)/g, (_, c) => c.toUpperCase())\n }\n return {\n react: 'React',\n // TODO `react/jsx-runtime` is not supported `umd`\n 'react/jsx-runtime': 'ReactJSXRuntime',\n // https://cdn.jsdelivr.net/npm/react@18.2.0/umd/react.development.js\n 'react-dom': 'ReactDOM',\n // https://cdn.jsdelivr.net/npm/react-dom@18.2.0/umd/react-dom.development.js\n // TODO make the library use the global variable `TDesignReact` replace `TDesign`\n 'tdesign-react/esm': 'TDesign',\n // https://cdn.jsdelivr.net/npm/tdesign-react@1.4.0/dist/tdesign.js\n // https://cdn.jsdelivr.net/npm/tdesign-react@1.4.0/dist/tdesign.css\n 'tdesign-icons-react': 'TDesignIconReact',\n // https://cdn.jsdelivr.net/npm/tdesign-icons-react@1.4.0/dist/index.js\n zod: 'Zod',\n '@zodui/core': 'ZodUICore',\n '@zodui/core/utils': 'ZodUICoreUtils',\n '@zodui/react': 'ZodUIReact'\n }[external]\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 dir: 'dist',\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 = {} } = pkg\n const external = <(string | RegExp)[]>Object\n .keys(dependencies)\n .concat(Object.keys(peerDependencies))\n return external\n .map(dep => new RegExp(`^${dep}(/.*)?$`))\n}\n","import terser from '@rollup/plugin-terser'\nimport type { OutputOptions, OutputPlugin } from 'rollup'\n\nexport default function (output: OutputOptions & {\n entryFileNames?: string\n plugins?: OutputPlugin[]\n}): OutputOptions[] {\n return [\n output,\n {\n ...output,\n entryFileNames: output.entryFileNames?.replace(/(\\.js)$/, '.min$1'),\n plugins: [...(output.plugins ?? []), terser()]\n }\n ]\n}\n","import { resolve } from 'node:path'\n\nimport { getWorkspaceDir } from '@jiek/utils/getWorkspaceDir'\nimport json from '@rollup/plugin-json'\nimport autoprefixer from 'autoprefixer'\nimport type { InputPluginOption, RollupOptions } from 'rollup'\nimport { dts } from 'rollup-plugin-dts'\nimport esbuild from 'rollup-plugin-esbuild'\nimport postcss from 'rollup-plugin-postcss'\n\nimport { createGlobalsLinkage } from './plugins/globals'\nimport skip from './plugins/skip'\nimport { commonOutputOptions } from './utils/commonOptions'\nimport externalResolver from './utils/externalResolver'\nimport withMinify from './utils/withMinify'\n\nconst workspaceRoot = getWorkspaceDir()\nfunction resolveWorkspacePath(p: string) {\n return resolve(workspaceRoot, p)\n}\n\nexport const template = (\n {\n styled = false,\n plugins: {\n index: indexPlugins = [],\n entry: entryPlugins = [],\n dts: dtsPlugins = []\n } = {}\n }: {\n /**\n * include styles files\n */\n styled?: boolean\n plugins?: {\n index?: InputPluginOption\n entry?: InputPluginOption\n dts?: InputPluginOption\n }\n } = {},\n pkg: {\n name?: string\n exports?: Record<string, string | {\n import: string\n 'inner-src': string\n }>\n }\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 static files\n .filter(([key]) => !/\\.(json|css|scss)$/.test(key))\n // filter no `inner-src` or `import` field entries\n .filter(([, value]) => typeof value === 'object' && value['inner-src'] && value['import'])\n .map(([key, value]) => [\n key\n .replace(/^\\.$/, 'index')\n .replace(/^\\.\\//, ''),\n typeof value === 'string' ? value : value['inner-src']\n ])\n )\n\n const [globalsRegister, globalsOutput] = createGlobalsLinkage()\n const external = externalResolver()\n\n const commonPlugins = [\n json()\n ]\n return [\n {\n input: exportsEntries,\n output: [\n ...withMinify({\n ...commonOutputOptions,\n format: 'esm',\n entryFileNames: '[name].esm.js',\n preserveModules: true\n })\n ],\n plugins: [\n commonPlugins,\n globalsRegister({ external }),\n styled && skip({ patterns: [/\\.s?css$/] }),\n esbuild(),\n indexPlugins\n ]\n },\n ...Object.entries(exportsEntries).map(([name, input]) => {\n const outputName = namePrefix + (\n name === 'index' ? '' : (\n name.replace(/[@|/-](\\w)/g, (_, $1) => $1.toUpperCase())\n )\n )\n return {\n input: input,\n output: [\n ...withMinify({\n ...commonOutputOptions,\n name: outputName,\n format: 'iife',\n entryFileNames: `${name}.iife.js`\n }),\n ...withMinify({\n ...commonOutputOptions,\n name: outputName,\n format: 'umd',\n entryFileNames: `${name}.umd.js`\n })\n ],\n plugins: [\n commonPlugins,\n globalsOutput,\n styled && postcss({\n plugins: [autoprefixer],\n minimize: true,\n sourceMap: true,\n extract: `${name}.css`\n }),\n esbuild(),\n entryPlugins\n ],\n external\n }\n }),\n {\n input: exportsEntries,\n output: [\n {\n dir: 'dist',\n entryFileNames: ({ name }) => `${name.replace(/^src\\//, '')}.esm.d.ts`,\n preserveModules: true\n },\n {\n dir: 'dist'\n }\n ],\n plugins: [\n commonPlugins,\n styled && skip({ patterns: [/\\.s?css$/] }),\n dts({ tsconfig: resolveWorkspacePath('tsconfig.dts.json') }),\n {\n name: 'rollup-plugin-declare-module-replacer',\n /**\n * replace relative path `declare module './xxx'` to `declare module '{{package name}}'`\n * in output file generated\n */\n generateBundle(_, bundle) {\n for (const file of Object.values(bundle)) {\n if (!('code' in file)) continue\n\n file.code = file.code.replace(\n /declare module ['|\"]\\..*['|\"]/g,\n `declare module '${pkg.name}'`\n )\n }\n }\n },\n dtsPlugins\n ],\n external\n }\n ] as RollupOptions[]\n}\n"],"names":["terser","getWorkspaceDir","resolve","json","esbuild","postcss","autoprefixer","dts"],"mappings":";;;;;;;;;;;;;;EAAA,uBAAA,CAAyB,QAAkB,EAAA;EACzC,EAAI,IAAA,QAAA,CAAS,UAAW,CAAA,SAAS,CAAG,EAAA;EAClC,IAAO,OAAA,QAAA,CACJ,QAAQ,YAAc,EAAA,CAAC,GAAG,CAAM,KAAA,CAAA,CAAE,aAAa,CAAA,CAAA;EAAA,GACpD;EACA,EAAO,OAAA;EAAA,IACL,KAAO,EAAA,OAAA;EAAA;EAAA,IAEP,mBAAqB,EAAA,iBAAA;EAAA;EAAA,IAErB,WAAa,EAAA,UAAA;EAAA;EAAA;EAAA,IAGb,mBAAqB,EAAA,SAAA;EAAA;EAAA;EAAA,IAGrB,qBAAuB,EAAA,kBAAA;EAAA;EAAA,IAEvB,GAAK,EAAA,KAAA;EAAA,IACL,aAAe,EAAA,WAAA;EAAA,IACf,mBAAqB,EAAA,gBAAA;EAAA,IACrB,cAAgB,EAAA,YAAA;EAAA,IAChB,QAAQ,CAAA,CAAA;EACZ;;ECfO,SAAS,oBAAuB,GAAA;EACrC,EAAA,IAAI,UAAU,EAAC,CAAA;EACf,EAAA,MAAM,YAAe,mBAAA,IAAI,GAAY,CAAA,EAAE,CAAA,CAAA;EACvC,EAAO,OAAA;EAAA,IACJ,CAAC,EAAE,QAAS,EAAA,GAAI,EAAO,KAAA;EACtB,MAAO,OAAA;EAAA,QACL,IAAM,EAAA,SAAA;EAAA,QACN,UAAU,EAAI,EAAA;EACZ,UAAI,IAAA,QAAA,EAAU,IAAK,CAAA,CAAA,GAAA,KAAO,GAAe,YAAA,MAAA,GAA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F;;;;;;;;"}
@@ -1,2 +1,2 @@
1
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("node:path"),require("@jiek/utils/getWorkspaceDir"),require("autoprefixer"),require("rollup-plugin-dts"),require("rollup-plugin-esbuild"),require("rollup-plugin-postcss"),require("@rollup/plugin-terser")):"function"==typeof define&&define.amd?define(["exports","node:path","@jiek/utils/getWorkspaceDir","autoprefixer","rollup-plugin-dts","rollup-plugin-esbuild","rollup-plugin-postcss","@rollup/plugin-terser"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).jiekrollup={},e.node_path,e.getWorkspaceDir,e.autoprefixer,e.rollupPluginDts,e.esbuild,e.postcss,e.terser)}(this,(function(e,t,r,s,n,i,o,u){"use strict";function l(e){return e&&e.__esModule?e:{default:e}}var p=l(s),a=l(i),c=l(o),d=l(u);function m(e){return e.startsWith("@zodui/")?e.replace(/[@/-](\w)/g,((e,t)=>t.toUpperCase())):{react:"React","react/jsx-runtime":"ReactJSXRuntime","react-dom":"ReactDOM","tdesign-react/esm":"TDesign","tdesign-icons-react":"TDesignIconReact",zod:"Zod","@zodui/core":"ZodUICore","@zodui/core/utils":"ZodUICoreUtils","@zodui/react":"ZodUIReact"}[e]}var f=(e={})=>({name:"skip",load(t){if(e.patterns?.some((e=>"string"==typeof e?t.includes(e):e.test(t))))return""}});const g={dir:"dist",exports:"named",interop:"auto",sourcemap:!0};function x(e){return[e,{...e,entryFileNames:e.entryFileNames?.replace(/(\.js)$/,".min$1"),plugins:[...e.plugins??[],d.default()]}]}const j=r.getWorkspaceDir();e.template=({styled:e=!1,plugins:{index:r=[],entry:s=[],dts:i=[]}={}}={},o)=>{if(!o.name)throw new Error("pkg.name is required");const u=o.name.replace(/[@|/-](\w)/g,((e,t)=>t.toUpperCase())),l=Object.fromEntries(Object.entries(o.exports??{}).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"]]))),[d,y]=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]:m(t)})),{}),{...r,globals:e})}),{outputOptions:t=>({...t,globals:e})}]}(),b=function(){const e=process.cwd(),t=require(`${e}/package.json`),{dependencies:r={},peerDependencies:s={}}=t;return Object.keys(r).concat(Object.keys(s)).map((e=>new RegExp(`^${e}(/.*)?$`)))}();return[{input:l,output:[...x({...g,format:"esm",entryFileNames:"[name].esm.js",preserveModules:!0})],plugins:[d({external:b}),e&&f({patterns:[/\.s?css$/]}),a.default(),r]},...Object.entries(l).map((([t,r])=>{const n=u+("index"===t?"":t.replace(/[@|/-](\w)/g,((e,t)=>t.toUpperCase())));return{input:r,output:[...x({...g,name:n,format:"iife",entryFileNames:`${t}.iife.js`}),...x({...g,name:n,format:"umd",entryFileNames:`${t}.umd.js`})],plugins:[y,e&&c.default({plugins:[p.default],minimize:!0,sourceMap:!0,extract:`${t}.css`}),a.default(),s],external:b}})),{input:l,output:[{dir:"dist",entryFileNames:({name:e})=>`${e.replace(/^src\//,"")}.esm.d.ts`,preserveModules:!0},{dir:"dist"}],plugins:[e&&f({patterns:[/\.s?css$/]}),n.dts({tsconfig:($="tsconfig.dts.json",t.resolve(j,$))}),{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}'`))}},i],external:b}];var $}}));
1
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("node:path"),require("@jiek/utils/getWorkspaceDir"),require("@rollup/plugin-json"),require("autoprefixer"),require("rollup-plugin-dts"),require("rollup-plugin-esbuild"),require("rollup-plugin-postcss"),require("@rollup/plugin-terser")):"function"==typeof define&&define.amd?define(["exports","node:path","@jiek/utils/getWorkspaceDir","@rollup/plugin-json","autoprefixer","rollup-plugin-dts","rollup-plugin-esbuild","rollup-plugin-postcss","@rollup/plugin-terser"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).jiekrollup={},e.node_path,e.getWorkspaceDir,e.json,e.autoprefixer,e.rollupPluginDts,e.esbuild,e.postcss,e.terser)}(this,(function(e,t,r,s,n,i,o,l,u){"use strict";function p(e){return e&&e.__esModule?e:{default:e}}var a=p(s),c=p(n),d=p(o),m=p(l),f=p(u);function g(e){return e.startsWith("@zodui/")?e.replace(/[@/-](\w)/g,((e,t)=>t.toUpperCase())):{react:"React","react/jsx-runtime":"ReactJSXRuntime","react-dom":"ReactDOM","tdesign-react/esm":"TDesign","tdesign-icons-react":"TDesignIconReact",zod:"Zod","@zodui/core":"ZodUICore","@zodui/core/utils":"ZodUICoreUtils","@zodui/react":"ZodUIReact"}[e]}var j=(e={})=>({name:"skip",load(t){if(e.patterns?.some((e=>"string"==typeof e?t.includes(e):e.test(t))))return""}});const x={dir:"dist",exports:"named",interop:"auto",sourcemap:!0};function y(e){return[e,{...e,entryFileNames:e.entryFileNames?.replace(/(\.js)$/,".min$1"),plugins:[...e.plugins??[],f.default()]}]}const b=r.getWorkspaceDir();e.template=({styled:e=!1,plugins:{index:r=[],entry:s=[],dts:n=[]}={}}={},o)=>{if(!o.name)throw new Error("pkg.name is required");const l=o.name.replace(/[@|/-](\w)/g,((e,t)=>t.toUpperCase())),u=Object.fromEntries(Object.entries(o.exports??{}).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"]]))),[p,f]=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})}]}(),$=function(){const e=process.cwd(),t=require(`${e}/package.json`),{dependencies:r={},peerDependencies:s={}}=t;return Object.keys(r).concat(Object.keys(s)).map((e=>new RegExp(`^${e}(/.*)?$`)))}(),k=[a.default()];return[{input:u,output:[...y({...x,format:"esm",entryFileNames:"[name].esm.js",preserveModules:!0})],plugins:[k,p({external:$}),e&&j({patterns:[/\.s?css$/]}),d.default(),r]},...Object.entries(u).map((([t,r])=>{const n=l+("index"===t?"":t.replace(/[@|/-](\w)/g,((e,t)=>t.toUpperCase())));return{input:r,output:[...y({...x,name:n,format:"iife",entryFileNames:`${t}.iife.js`}),...y({...x,name:n,format:"umd",entryFileNames:`${t}.umd.js`})],plugins:[k,f,e&&m.default({plugins:[c.default],minimize:!0,sourceMap:!0,extract:`${t}.css`}),d.default(),s],external:$}})),{input:u,output:[{dir:"dist",entryFileNames:({name:e})=>`${e.replace(/^src\//,"")}.esm.d.ts`,preserveModules:!0},{dir:"dist"}],plugins:[k,e&&j({patterns:[/\.s?css$/]}),i.dts({tsconfig:(q="tsconfig.dts.json",t.resolve(b,q))}),{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}'`))}},n],external:$}];var q}}));
2
2
  //# sourceMappingURL=rollup.umd.min.js.map