jiek 0.1.4 → 0.1.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (39) hide show
  1. package/dist/rollup/plugins/globals.esm.js +31 -0
  2. package/dist/rollup/plugins/globals.esm.js.map +1 -0
  3. package/dist/rollup/plugins/globals.esm.min.js +2 -0
  4. package/dist/rollup/plugins/globals.esm.min.js.map +1 -0
  5. package/dist/rollup/plugins/skip.esm.js +16 -0
  6. package/dist/rollup/plugins/skip.esm.js.map +1 -0
  7. package/dist/rollup/plugins/skip.esm.min.js +2 -0
  8. package/dist/rollup/plugins/skip.esm.min.js.map +1 -0
  9. package/dist/rollup/utils/commonOptions.esm.js +9 -0
  10. package/dist/rollup/utils/commonOptions.esm.js.map +1 -0
  11. package/dist/rollup/utils/commonOptions.esm.min.js +2 -0
  12. package/dist/rollup/utils/commonOptions.esm.min.js.map +1 -0
  13. package/dist/rollup/utils/externalResolver.esm.js +10 -0
  14. package/dist/rollup/utils/externalResolver.esm.js.map +1 -0
  15. package/dist/rollup/utils/externalResolver.esm.min.js +2 -0
  16. package/dist/rollup/utils/externalResolver.esm.min.js.map +1 -0
  17. package/dist/rollup/utils/globalResolver.esm.js +26 -0
  18. package/dist/rollup/utils/globalResolver.esm.js.map +1 -0
  19. package/dist/rollup/utils/globalResolver.esm.min.js +2 -0
  20. package/dist/rollup/utils/globalResolver.esm.min.js.map +1 -0
  21. package/dist/rollup/utils/withMinify.esm.js +15 -0
  22. package/dist/rollup/utils/withMinify.esm.js.map +1 -0
  23. package/dist/rollup/utils/withMinify.esm.min.js +2 -0
  24. package/dist/rollup/utils/withMinify.esm.min.js.map +1 -0
  25. package/dist/rollup.d.ts +21 -0
  26. package/dist/rollup.esm.d.ts +21 -0
  27. package/dist/rollup.esm.js +127 -0
  28. package/dist/rollup.esm.js.map +1 -0
  29. package/dist/rollup.esm.min.js +2 -0
  30. package/dist/rollup.esm.min.js.map +1 -0
  31. package/dist/rollup.iife.js +213 -0
  32. package/dist/rollup.iife.js.map +1 -0
  33. package/dist/rollup.iife.min.js +2 -0
  34. package/dist/rollup.iife.min.js.map +1 -0
  35. package/dist/rollup.umd.js +214 -0
  36. package/dist/rollup.umd.js.map +1 -0
  37. package/dist/rollup.umd.min.js +2 -0
  38. package/dist/rollup.umd.min.js.map +1 -0
  39. package/package.json +16 -5
@@ -0,0 +1,31 @@
1
+ import globalResolver from '../utils/globalResolver.esm.js';
2
+
3
+ function createGlobalsLinkage() {
4
+ let globals = {};
5
+ const dependencies = /* @__PURE__ */ new Set([]);
6
+ return [
7
+ ({ external } = {}) => {
8
+ return {
9
+ name: "globals",
10
+ resolveId(id) {
11
+ if (external?.some((dep) => dep instanceof RegExp ? dep.test(id) : dep === id)) {
12
+ dependencies.add(id);
13
+ return { id, external: true };
14
+ }
15
+ return null;
16
+ },
17
+ outputOptions(options) {
18
+ globals = [...dependencies].reduce((acc, value) => ({
19
+ ...acc,
20
+ [value]: globalResolver(value)
21
+ }), {});
22
+ return { ...options, globals };
23
+ }
24
+ };
25
+ },
26
+ { outputOptions: (options) => ({ ...options, globals }) }
27
+ ];
28
+ }
29
+
30
+ export { createGlobalsLinkage };
31
+ //# sourceMappingURL=globals.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"globals.esm.js","sources":["../../../src/rollup/plugins/globals.ts"],"sourcesContent":["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"],"names":[],"mappings":";;AAQO,SAAS,oBAAuB,GAAA;AACrC,EAAA,IAAI,UAAU,EAAC,CAAA;AACf,EAAA,MAAM,YAAe,mBAAA,IAAI,GAAY,CAAA,EAAE,CAAA,CAAA;AACvC,EAAO,OAAA;AAAA,IACJ,CAAC,EAAE,QAAS,EAAA,GAAI,EAAO,KAAA;AACtB,MAAO,OAAA;AAAA,QACL,IAAM,EAAA,SAAA;AAAA,QACN,UAAU,EAAI,EAAA;AACZ,UAAI,IAAA,QAAA,EAAU,IAAK,CAAA,CAAA,GAAA,KAAO,GAAe,YAAA,MAAA,GAAS,GAAI,CAAA,IAAA,CAAK,EAAE,CAAA,GAAI,GAAQ,KAAA,EAAE,CAAG,EAAA;AAC5E,YAAA,YAAA,CAAa,IAAI,EAAE,CAAA,CAAA;AACnB,YAAO,OAAA,EAAE,EAAI,EAAA,QAAA,EAAU,IAAK,EAAA,CAAA;AAAA,WAC9B;AACA,UAAO,OAAA,IAAA,CAAA;AAAA,SACT;AAAA,QACA,cAAc,OAAS,EAAA;AACrB,UAAA,OAAA,GAAU,CAAC,GAAG,YAAY,EAAE,MAAO,CAAA,CAAC,KAAK,KAAW,MAAA;AAAA,YAClD,GAAG,GAAA;AAAA,YACH,CAAC,KAAK,GAAG,cAAA,CAAe,KAAK,CAAA;AAAA,WAC/B,CAAA,EAAI,EAAE,CAAA,CAAA;AACN,UAAO,OAAA,EAAE,GAAG,OAAA,EAAS,OAAQ,EAAA,CAAA;AAAA,SAC/B;AAAA,OACF,CAAA;AAAA,KACF;AAAA,IACA,EAAE,aAAe,EAAA,CAAA,OAAA,MAAY,EAAE,GAAG,OAAA,EAAS,SAAW,CAAA,EAAA;AAAA,GACxD,CAAA;AACF;;;;"}
@@ -0,0 +1,2 @@
1
+ import e from"../utils/globalResolver.esm.min.js";function t(){let t={};const o=new Set([]);return[({external:l}={})=>({name:"globals",resolveId:e=>l?.some((t=>t instanceof RegExp?t.test(e):t===e))?(o.add(e),{id:e,external:!0}):null,outputOptions:l=>(t=[...o].reduce(((t,o)=>({...t,[o]:e(o)})),{}),{...l,globals:t})}),{outputOptions:e=>({...e,globals:t})}]}export{t as createGlobalsLinkage};
2
+ //# sourceMappingURL=globals.esm.min.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"globals.esm.min.js","sources":["../../../src/rollup/plugins/globals.ts"],"sourcesContent":["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"],"names":["createGlobalsLinkage","globals","dependencies","Set","external","name","resolveId","id","some","dep","RegExp","test","add","outputOptions","options","reduce","acc","value","globalResolver"],"mappings":"kDAQO,SAASA,IACd,IAAIC,EAAU,CAAA,EACd,MAAMC,EAAe,IAAIC,IAAY,IAC9B,MAAA,CACJ,EAAGC,YAAa,MACR,CACLC,KAAM,UACNC,UAAUC,GACJH,GAAUI,MAAKC,GAAOA,aAAeC,OAASD,EAAIE,KAAKJ,GAAME,IAAQF,KACvEL,EAAaU,IAAIL,GACV,CAAEA,KAAIH,UAAU,IAElB,KAETS,cAAcC,IACZb,EAAU,IAAIC,GAAca,QAAO,CAACC,EAAKC,KAAW,IAC/CD,EACHC,CAACA,GAAQC,EAAeD,MACtB,CAAE,GACC,IAAKH,EAASb,cAI3B,CAAEY,cAAeC,IAAA,IAAiBA,EAASb,aAE/C"}
@@ -0,0 +1,16 @@
1
+ var skip = (options = {}) => {
2
+ return {
3
+ name: "skip",
4
+ // skip the specified files by `options.patterns`
5
+ load(id) {
6
+ if (options.patterns?.some(
7
+ (pattern) => typeof pattern === "string" ? id.includes(pattern) : pattern.test(id)
8
+ )) {
9
+ return "";
10
+ }
11
+ }
12
+ };
13
+ };
14
+
15
+ export { skip as default };
16
+ //# sourceMappingURL=skip.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"skip.esm.js","sources":["../../../src/rollup/plugins/skip.ts"],"sourcesContent":["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"],"names":[],"mappings":"AAMA,WAAgB,CAAC,OAAU,GAAA,EAAO,KAAA;AAChC,EAAO,OAAA;AAAA,IACL,IAAM,EAAA,MAAA;AAAA;AAAA,IAEN,KAAK,EAAI,EAAA;AACP,MAAA,IACE,QAAQ,QAAU,EAAA,IAAA;AAAA,QAAK,CAAC,OACtB,KAAA,OAAO,OAAY,KAAA,QAAA,GACf,EAAG,CAAA,QAAA,CAAS,OAAO,CAAA,GACnB,OAAQ,CAAA,IAAA,CAAK,EAAE,CAAA;AAAA,OAErB,EAAA;AACA,QAAO,OAAA,EAAA,CAAA;AAAA,OACT;AAAA,KACF;AAAA,GACF,CAAA;AACF,CAAA;;;;"}
@@ -0,0 +1,2 @@
1
+ var e=(e={})=>({name:"skip",load(t){if(e.patterns?.some((e=>"string"==typeof e?t.includes(e):e.test(t))))return""}});export{e as default};
2
+ //# sourceMappingURL=skip.esm.min.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"skip.esm.min.js","sources":["../../../src/rollup/plugins/skip.ts"],"sourcesContent":["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"],"names":["skip","options","name","load","id","patterns","some","pattern","includes","test"],"mappings":"AAMA,IAAAA,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"}
@@ -0,0 +1,9 @@
1
+ const defineOutput = (output) => output;
2
+ const commonOutputOptions = defineOutput({
3
+ dir: "dist",
4
+ exports: "named",
5
+ sourcemap: true
6
+ });
7
+
8
+ export { commonOutputOptions };
9
+ //# sourceMappingURL=commonOptions.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"commonOptions.esm.js","sources":["../../../src/rollup/utils/commonOptions.ts"],"sourcesContent":["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 sourcemap: true\n})\n"],"names":[],"mappings":"AAEA,MAAM,YAAA,GAAe,CAA0B,MAAc,KAAA,MAAA,CAAA;AAEtD,MAAM,sBAAsB,YAAa,CAAA;AAAA,EAC9C,GAAK,EAAA,MAAA;AAAA,EACL,OAAS,EAAA,OAAA;AAAA,EACT,SAAW,EAAA,IAAA;AACb,CAAC;;;;"}
@@ -0,0 +1,2 @@
1
+ const e={dir:"dist",exports:"named",sourcemap:!0};export{e as commonOutputOptions};
2
+ //# sourceMappingURL=commonOptions.esm.min.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"commonOptions.esm.min.js","sources":["../../../src/rollup/utils/commonOptions.ts"],"sourcesContent":["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 sourcemap: true\n})\n"],"names":["commonOutputOptions","dir","exports","sourcemap"],"mappings":"AAEA,MAEaA,EAAmC,CAC9CC,IAAK,OACLC,QAAS,QACTC,WAAW"}
@@ -0,0 +1,10 @@
1
+ function externalResolver() {
2
+ const cwd = process.cwd();
3
+ const pkg = require(`${cwd}/package.json`);
4
+ const { dependencies = {}, peerDependencies = {} } = pkg;
5
+ const external = Object.keys(dependencies).concat(Object.keys(peerDependencies));
6
+ return external.map((dep) => new RegExp(`^${dep}(/.*)?$`));
7
+ }
8
+
9
+ export { externalResolver as default };
10
+ //# sourceMappingURL=externalResolver.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"externalResolver.esm.js","sources":["../../../src/rollup/utils/externalResolver.ts"],"sourcesContent":["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":[],"mappings":"AAA2B,yBAAA,GAAA;AACzB,EAAM,MAAA,GAAA,GAAM,QAAQ,GAAI,EAAA,CAAA;AAExB,EAAA,MAAM,GAAM,GAAA,OAAA,CAAQ,CAAG,EAAA,GAAG,CAAe,aAAA,CAAA,CAAA,CAAA;AACzC,EAAA,MAAM,EAAE,YAAe,GAAA,IAAI,gBAAmB,GAAA,IAAO,GAAA,GAAA,CAAA;AACrD,EAAM,MAAA,QAAA,GAAgC,OACnC,IAAK,CAAA,YAAY,EACjB,MAAO,CAAA,MAAA,CAAO,IAAK,CAAA,gBAAgB,CAAC,CAAA,CAAA;AACvC,EAAO,OAAA,QAAA,CACJ,IAAI,CAAO,GAAA,KAAA,IAAI,OAAO,CAAI,CAAA,EAAA,GAAG,SAAS,CAAC,CAAA,CAAA;AAC5C;;;;"}
@@ -0,0 +1,2 @@
1
+ function e(){const e=process.cwd(),c=require(`${e}/package.json`),{dependencies:n={},peerDependencies:s={}}=c;return Object.keys(n).concat(Object.keys(s)).map((e=>new RegExp(`^${e}(/.*)?$`)))}export{e as default};
2
+ //# sourceMappingURL=externalResolver.esm.min.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"externalResolver.esm.min.js","sources":["../../../src/rollup/utils/externalResolver.ts"],"sourcesContent":["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":["externalResolver","cwd","process","pkg","require","dependencies","peerDependencies","Object","keys","concat","map","dep","RegExp"],"mappings":"AAA2B,SAAAA,IACnB,MAAAC,EAAMC,QAAQD,MAEdE,EAAMC,QAAQ,GAAGH,mBACjBI,aAAEA,EAAe,oBAAIC,EAAmB,IAAOH,EAI9C,OAH+BI,OACnCC,KAAKH,GACLI,OAAOF,OAAOC,KAAKF,IAEnBI,KAAWC,GAAA,IAAIC,OAAO,IAAID,aAC/B"}
@@ -0,0 +1,26 @@
1
+ function globalResolver(external) {
2
+ if (external.startsWith("@zodui/")) {
3
+ return external.replace(/[@/-](\w)/g, (_, c) => c.toUpperCase());
4
+ }
5
+ return {
6
+ react: "React",
7
+ // TODO `react/jsx-runtime` is not supported `umd`
8
+ "react/jsx-runtime": "ReactJSXRuntime",
9
+ // https://cdn.jsdelivr.net/npm/react@18.2.0/umd/react.development.js
10
+ "react-dom": "ReactDOM",
11
+ // https://cdn.jsdelivr.net/npm/react-dom@18.2.0/umd/react-dom.development.js
12
+ // TODO make the library use the global variable `TDesignReact` replace `TDesign`
13
+ "tdesign-react/esm": "TDesign",
14
+ // https://cdn.jsdelivr.net/npm/tdesign-react@1.4.0/dist/tdesign.js
15
+ // https://cdn.jsdelivr.net/npm/tdesign-react@1.4.0/dist/tdesign.css
16
+ "tdesign-icons-react": "TDesignIconReact",
17
+ // https://cdn.jsdelivr.net/npm/tdesign-icons-react@1.4.0/dist/index.js
18
+ zod: "Zod",
19
+ "@zodui/core": "ZodUICore",
20
+ "@zodui/core/utils": "ZodUICoreUtils",
21
+ "@zodui/react": "ZodUIReact"
22
+ }[external];
23
+ }
24
+
25
+ export { globalResolver as default };
26
+ //# sourceMappingURL=globalResolver.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"globalResolver.esm.js","sources":["../../../src/rollup/utils/globalResolver.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"],"names":[],"mappings":"AAAA,uBAAA,CAAyB,QAAkB,EAAA;AACzC,EAAI,IAAA,QAAA,CAAS,UAAW,CAAA,SAAS,CAAG,EAAA;AAClC,IAAO,OAAA,QAAA,CACJ,QAAQ,YAAc,EAAA,CAAC,GAAG,CAAM,KAAA,CAAA,CAAE,aAAa,CAAA,CAAA;AAAA,GACpD;AACA,EAAO,OAAA;AAAA,IACL,KAAO,EAAA,OAAA;AAAA;AAAA,IAEP,mBAAqB,EAAA,iBAAA;AAAA;AAAA,IAErB,WAAa,EAAA,UAAA;AAAA;AAAA;AAAA,IAGb,mBAAqB,EAAA,SAAA;AAAA;AAAA;AAAA,IAGrB,qBAAuB,EAAA,kBAAA;AAAA;AAAA,IAEvB,GAAK,EAAA,KAAA;AAAA,IACL,aAAe,EAAA,WAAA;AAAA,IACf,mBAAqB,EAAA,gBAAA;AAAA,IACrB,cAAgB,EAAA,YAAA;AAAA,IAChB,QAAQ,CAAA,CAAA;AACZ;;;;"}
@@ -0,0 +1,2 @@
1
+ function e(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]}export{e as default};
2
+ //# sourceMappingURL=globalResolver.esm.min.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"globalResolver.esm.min.js","sources":["../../../src/rollup/utils/globalResolver.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"],"names":["globalResolver","external","startsWith","replace","_","c","toUpperCase","react","zod"],"mappings":"AAAA,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"}
@@ -0,0 +1,15 @@
1
+ import terser from '@rollup/plugin-terser';
2
+
3
+ function withMinify(output) {
4
+ return [
5
+ output,
6
+ {
7
+ ...output,
8
+ entryFileNames: output.entryFileNames?.replace(/(\.js)$/, ".min$1"),
9
+ plugins: [...output.plugins ?? [], terser()]
10
+ }
11
+ ];
12
+ }
13
+
14
+ export { withMinify as default };
15
+ //# sourceMappingURL=withMinify.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"withMinify.esm.js","sources":["../../../src/rollup/utils/withMinify.ts"],"sourcesContent":["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"],"names":[],"mappings":";;AAGA,mBAAA,CAAyB,MAGL,EAAA;AAClB,EAAO,OAAA;AAAA,IACL,MAAA;AAAA,IACA;AAAA,MACE,GAAG,MAAA;AAAA,MACH,cAAgB,EAAA,MAAA,CAAO,cAAgB,EAAA,OAAA,CAAQ,WAAW,QAAQ,CAAA;AAAA,MAClE,OAAA,EAAS,CAAC,GAAI,MAAA,CAAO,WAAW,EAAC,EAAI,QAAQ,CAAA;AAAA,KAC/C;AAAA,GACF,CAAA;AACF;;;;"}
@@ -0,0 +1,2 @@
1
+ import e from"@rollup/plugin-terser";function r(r){return[r,{...r,entryFileNames:r.entryFileNames?.replace(/(\.js)$/,".min$1"),plugins:[...r.plugins??[],e()]}]}export{r as default};
2
+ //# sourceMappingURL=withMinify.esm.min.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"withMinify.esm.min.js","sources":["../../../src/rollup/utils/withMinify.ts"],"sourcesContent":["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"],"names":["withMinify","output","entryFileNames","replace","plugins","terser"],"mappings":"qCAGA,SAAAA,EAAyBC,GAIhB,MAAA,CACLA,EACA,IACKA,EACHC,eAAgBD,EAAOC,gBAAgBC,QAAQ,UAAW,UAC1DC,QAAS,IAAKH,EAAOG,SAAW,GAAKC,MAG3C"}
@@ -0,0 +1,21 @@
1
+ import { InputPluginOption, RollupOptions } from 'rollup';
2
+
3
+ declare const template: ({ styled, plugins: { index: indexPlugins, entry: entryPlugins, dts: dtsPlugins } }: {
4
+ /**
5
+ * include styles files
6
+ */
7
+ styled?: boolean | undefined;
8
+ plugins?: {
9
+ index?: InputPluginOption;
10
+ entry?: InputPluginOption;
11
+ dts?: InputPluginOption;
12
+ } | undefined;
13
+ } | undefined, pkg: {
14
+ name?: string;
15
+ exports?: Record<string, string | {
16
+ import: string;
17
+ 'inner-src': string;
18
+ }>;
19
+ }) => RollupOptions[];
20
+
21
+ export { template };
@@ -0,0 +1,21 @@
1
+ import { InputPluginOption, RollupOptions } from 'rollup';
2
+
3
+ declare const template: ({ styled, plugins: { index: indexPlugins, entry: entryPlugins, dts: dtsPlugins } }: {
4
+ /**
5
+ * include styles files
6
+ */
7
+ styled?: boolean | undefined;
8
+ plugins?: {
9
+ index?: InputPluginOption;
10
+ entry?: InputPluginOption;
11
+ dts?: InputPluginOption;
12
+ } | undefined;
13
+ } | undefined, pkg: {
14
+ name?: string;
15
+ exports?: Record<string, string | {
16
+ import: string;
17
+ 'inner-src': string;
18
+ }>;
19
+ }) => RollupOptions[];
20
+
21
+ export { template };
@@ -0,0 +1,127 @@
1
+ import { resolve } from 'node:path';
2
+ import { getWorkspaceDir } from '@jiek/utils/getWorkspaceDir';
3
+ import autoprefixer from 'autoprefixer';
4
+ import { dts } from 'rollup-plugin-dts';
5
+ import esbuild from 'rollup-plugin-esbuild';
6
+ import postcss from 'rollup-plugin-postcss';
7
+ import { createGlobalsLinkage } from './rollup/plugins/globals.esm.js';
8
+ import skip from './rollup/plugins/skip.esm.js';
9
+ import { commonOutputOptions } from './rollup/utils/commonOptions.esm.js';
10
+ import externalResolver from './rollup/utils/externalResolver.esm.js';
11
+ import withMinify from './rollup/utils/withMinify.esm.js';
12
+
13
+ const workspaceRoot = getWorkspaceDir();
14
+ function resolveWorkspacePath(p) {
15
+ return resolve(workspaceRoot, p);
16
+ }
17
+ const template = ({
18
+ styled = false,
19
+ plugins: {
20
+ index: indexPlugins = [],
21
+ entry: entryPlugins = [],
22
+ dts: dtsPlugins = []
23
+ } = {}
24
+ } = {}, pkg) => {
25
+ if (!pkg.name) {
26
+ throw new Error("pkg.name is required");
27
+ }
28
+ const namePrefix = pkg.name.replace(/[@|/-](\w)/g, (_, $1) => $1.toUpperCase());
29
+ const exportsEntries = Object.fromEntries(
30
+ Object.entries(pkg.exports ?? {}).filter(([key]) => !/\.(json|css|scss)$/.test(key)).filter(([, value]) => typeof value === "object" && value["inner-src"] && value["import"]).map(([key, value]) => [
31
+ key.replace(/^\.$/, "index").replace(/^\.\//, ""),
32
+ typeof value === "string" ? value : value["inner-src"]
33
+ ])
34
+ );
35
+ const [globalsRegister, globalsOutput] = createGlobalsLinkage();
36
+ const external = externalResolver();
37
+ return [
38
+ {
39
+ input: exportsEntries,
40
+ output: [
41
+ ...withMinify({
42
+ ...commonOutputOptions,
43
+ format: "esm",
44
+ entryFileNames: "[name].esm.js",
45
+ preserveModules: true
46
+ })
47
+ ],
48
+ plugins: [
49
+ globalsRegister({ external }),
50
+ styled && skip({ patterns: [/\.s?css$/] }),
51
+ esbuild(),
52
+ indexPlugins
53
+ ]
54
+ },
55
+ ...Object.entries(exportsEntries).map(([name, input]) => {
56
+ const outputName = namePrefix + (name === "index" ? "" : name[0].toUpperCase() + name.slice(1));
57
+ return {
58
+ input,
59
+ output: [
60
+ ...withMinify({
61
+ ...commonOutputOptions,
62
+ name: outputName,
63
+ format: "iife",
64
+ entryFileNames: `${name}.iife.js`
65
+ }),
66
+ ...withMinify({
67
+ ...commonOutputOptions,
68
+ name: outputName,
69
+ format: "umd",
70
+ entryFileNames: `${name}.umd.js`
71
+ })
72
+ ],
73
+ plugins: [
74
+ globalsOutput,
75
+ styled && postcss({
76
+ plugins: [autoprefixer],
77
+ minimize: true,
78
+ sourceMap: true,
79
+ extract: `${name}.css`
80
+ }),
81
+ esbuild(),
82
+ entryPlugins
83
+ ],
84
+ external
85
+ };
86
+ }),
87
+ {
88
+ input: exportsEntries,
89
+ output: [
90
+ {
91
+ dir: "dist",
92
+ entryFileNames: ({ name }) => `${name.replace(/^src\//, "")}.esm.d.ts`,
93
+ preserveModules: true
94
+ },
95
+ {
96
+ dir: "dist"
97
+ }
98
+ ],
99
+ plugins: [
100
+ styled && skip({ patterns: [/\.s?css$/] }),
101
+ dts({ tsconfig: resolveWorkspacePath("tsconfig.dts.json") }),
102
+ {
103
+ name: "rollup-plugin-declare-module-replacer",
104
+ /**
105
+ * replace relative path `declare module './xxx'` to `declare module '{{package name}}'`
106
+ * in output file generated
107
+ */
108
+ generateBundle(_, bundle) {
109
+ for (const file of Object.values(bundle)) {
110
+ if (!("code" in file))
111
+ continue;
112
+ file.code = file.code.replace(
113
+ /declare module ['|"]\..*['|"]/g,
114
+ `declare module '${pkg.name}'`
115
+ );
116
+ }
117
+ }
118
+ },
119
+ dtsPlugins
120
+ ],
121
+ external
122
+ }
123
+ ];
124
+ };
125
+
126
+ export { template };
127
+ //# sourceMappingURL=rollup.esm.js.map
@@ -0,0 +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[0].toUpperCase() + name.slice(1)\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,CAAG,EAAA,EAAA,KAAO,EAAG,CAAA,WAAA,EAAa,CAAA,CAAA;AACrD,EAAA,MAAM,iBAAiB,MAAO,CAAA,WAAA;AAAA,IAC5B,OAAO,OAAQ,CAAA,GAAA,CAAI,OAAW,IAAA,EAAE,CAE7B,CAAA,MAAA,CAAO,CAAC,CAAC,GAAG,CAAM,KAAA,CAAC,qBAAqB,IAAK,CAAA,GAAG,CAAC,CAEjD,CAAA,MAAA,CAAO,CAAC,GAAG,KAAK,CAAA,KAAM,OAAO,KAAU,KAAA,QAAA,IAAY,MAAM,WAAW,CAAA,IAAK,KAAM,CAAA,QAAQ,CAAC,CACxF,CAAA,GAAA,CAAI,CAAC,CAAC,GAAA,EAAK,KAAK,CAAM,KA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,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;;;;"}
@@ -0,0 +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 i from"rollup-plugin-esbuild";import o 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$/]}),i(),c]},...Object.entries(x).map((([e,t])=>{const n=j+("index"===e?"":e[0].toUpperCase()+e.slice(1));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&&o({plugins:[s],minimize:!0,sourceMap:!0,extract:`${e}.css`}),i(),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};
2
+ //# sourceMappingURL=rollup.esm.min.js.map
@@ -0,0 +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[0].toUpperCase() + name.slice(1)\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","slice","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,EAAK,GAAGM,cAAgBN,EAAKiC,MAAM,IAGhC,MAAA,CACLX,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,GAAU2C,EAAQ,CAChB1C,QAAS,CAAC2C,GACVC,UAAU,EACVC,WAAW,EACXC,QAAS,GAAGtC,UAEd+B,IACAnC,GAEFwB,WACF,IAEF,CACEE,MAAOf,EACPgB,OAAQ,CACN,CACEgB,IAAK,OACLZ,eAAgB,EAAG3B,UAAW,GAAGA,EAAKG,QAAQ,SAAU,eACxDyB,iBAAiB,GAEnB,CACEW,IAAK,SAGT/C,QAAS,CACPD,GAAUsC,EAAK,CAAEC,SAAU,CAAC,cAC5BjC,EAAI,CAAE2C,UA1HgBC,EA0He,oBAzHpCC,EAAQtD,EAAeqD,MA0HxB,CACEzC,KAAM,wCAKN,cAAA2C,CAAevC,EAAGwC,GAChB,IAAA,MAAWC,KAAQrC,OAAOsC,OAAOF,GACzB,SAAUC,IAEXA,EAAAE,KAAOF,EAAKE,KAAK5C,QACpB,iCACA,mBAAmBJ,EAAIC,SAG7B,GAEFF,GAEFsB,aA9IN,IAA8BqB,CAgJ5B"}
@@ -0,0 +1,213 @@
1
+ var jiekRollup = (function (exports, node_path, getWorkspaceDir, autoprefixer, rollupPluginDts, esbuild, postcss, terser) {
2
+ 'use strict';
3
+
4
+ function globalResolver(external) {
5
+ if (external.startsWith("@zodui/")) {
6
+ return external.replace(/[@/-](\w)/g, (_, c) => c.toUpperCase());
7
+ }
8
+ return {
9
+ react: "React",
10
+ // TODO `react/jsx-runtime` is not supported `umd`
11
+ "react/jsx-runtime": "ReactJSXRuntime",
12
+ // https://cdn.jsdelivr.net/npm/react@18.2.0/umd/react.development.js
13
+ "react-dom": "ReactDOM",
14
+ // https://cdn.jsdelivr.net/npm/react-dom@18.2.0/umd/react-dom.development.js
15
+ // TODO make the library use the global variable `TDesignReact` replace `TDesign`
16
+ "tdesign-react/esm": "TDesign",
17
+ // https://cdn.jsdelivr.net/npm/tdesign-react@1.4.0/dist/tdesign.js
18
+ // https://cdn.jsdelivr.net/npm/tdesign-react@1.4.0/dist/tdesign.css
19
+ "tdesign-icons-react": "TDesignIconReact",
20
+ // https://cdn.jsdelivr.net/npm/tdesign-icons-react@1.4.0/dist/index.js
21
+ zod: "Zod",
22
+ "@zodui/core": "ZodUICore",
23
+ "@zodui/core/utils": "ZodUICoreUtils",
24
+ "@zodui/react": "ZodUIReact"
25
+ }[external];
26
+ }
27
+
28
+ function createGlobalsLinkage() {
29
+ let globals = {};
30
+ const dependencies = /* @__PURE__ */ new Set([]);
31
+ return [
32
+ ({ external } = {}) => {
33
+ return {
34
+ name: "globals",
35
+ resolveId(id) {
36
+ if (external?.some((dep) => dep instanceof RegExp ? dep.test(id) : dep === id)) {
37
+ dependencies.add(id);
38
+ return { id, external: true };
39
+ }
40
+ return null;
41
+ },
42
+ outputOptions(options) {
43
+ globals = [...dependencies].reduce((acc, value) => ({
44
+ ...acc,
45
+ [value]: globalResolver(value)
46
+ }), {});
47
+ return { ...options, globals };
48
+ }
49
+ };
50
+ },
51
+ { outputOptions: (options) => ({ ...options, globals }) }
52
+ ];
53
+ }
54
+
55
+ var skip = (options = {}) => {
56
+ return {
57
+ name: "skip",
58
+ // skip the specified files by `options.patterns`
59
+ load(id) {
60
+ if (options.patterns?.some(
61
+ (pattern) => typeof pattern === "string" ? id.includes(pattern) : pattern.test(id)
62
+ )) {
63
+ return "";
64
+ }
65
+ }
66
+ };
67
+ };
68
+
69
+ const defineOutput = (output) => output;
70
+ const commonOutputOptions = defineOutput({
71
+ dir: "dist",
72
+ exports: "named",
73
+ sourcemap: true
74
+ });
75
+
76
+ function externalResolver() {
77
+ const cwd = process.cwd();
78
+ const pkg = require(`${cwd}/package.json`);
79
+ const { dependencies = {}, peerDependencies = {} } = pkg;
80
+ const external = Object.keys(dependencies).concat(Object.keys(peerDependencies));
81
+ return external.map((dep) => new RegExp(`^${dep}(/.*)?$`));
82
+ }
83
+
84
+ function withMinify(output) {
85
+ return [
86
+ output,
87
+ {
88
+ ...output,
89
+ entryFileNames: output.entryFileNames?.replace(/(\.js)$/, ".min$1"),
90
+ plugins: [...output.plugins ?? [], terser()]
91
+ }
92
+ ];
93
+ }
94
+
95
+ const workspaceRoot = getWorkspaceDir.getWorkspaceDir();
96
+ function resolveWorkspacePath(p) {
97
+ return node_path.resolve(workspaceRoot, p);
98
+ }
99
+ const template = ({
100
+ styled = false,
101
+ plugins: {
102
+ index: indexPlugins = [],
103
+ entry: entryPlugins = [],
104
+ dts: dtsPlugins = []
105
+ } = {}
106
+ } = {}, pkg) => {
107
+ if (!pkg.name) {
108
+ throw new Error("pkg.name is required");
109
+ }
110
+ const namePrefix = pkg.name.replace(/[@|/-](\w)/g, (_, $1) => $1.toUpperCase());
111
+ const exportsEntries = Object.fromEntries(
112
+ Object.entries(pkg.exports ?? {}).filter(([key]) => !/\.(json|css|scss)$/.test(key)).filter(([, value]) => typeof value === "object" && value["inner-src"] && value["import"]).map(([key, value]) => [
113
+ key.replace(/^\.$/, "index").replace(/^\.\//, ""),
114
+ typeof value === "string" ? value : value["inner-src"]
115
+ ])
116
+ );
117
+ const [globalsRegister, globalsOutput] = createGlobalsLinkage();
118
+ const external = externalResolver();
119
+ return [
120
+ {
121
+ input: exportsEntries,
122
+ output: [
123
+ ...withMinify({
124
+ ...commonOutputOptions,
125
+ format: "esm",
126
+ entryFileNames: "[name].esm.js",
127
+ preserveModules: true
128
+ })
129
+ ],
130
+ plugins: [
131
+ globalsRegister({ external }),
132
+ styled && skip({ patterns: [/\.s?css$/] }),
133
+ esbuild(),
134
+ indexPlugins
135
+ ]
136
+ },
137
+ ...Object.entries(exportsEntries).map(([name, input]) => {
138
+ const outputName = namePrefix + (name === "index" ? "" : name[0].toUpperCase() + name.slice(1));
139
+ return {
140
+ input,
141
+ output: [
142
+ ...withMinify({
143
+ ...commonOutputOptions,
144
+ name: outputName,
145
+ format: "iife",
146
+ entryFileNames: `${name}.iife.js`
147
+ }),
148
+ ...withMinify({
149
+ ...commonOutputOptions,
150
+ name: outputName,
151
+ format: "umd",
152
+ entryFileNames: `${name}.umd.js`
153
+ })
154
+ ],
155
+ plugins: [
156
+ globalsOutput,
157
+ styled && postcss({
158
+ plugins: [autoprefixer],
159
+ minimize: true,
160
+ sourceMap: true,
161
+ extract: `${name}.css`
162
+ }),
163
+ esbuild(),
164
+ entryPlugins
165
+ ],
166
+ external
167
+ };
168
+ }),
169
+ {
170
+ input: exportsEntries,
171
+ output: [
172
+ {
173
+ dir: "dist",
174
+ entryFileNames: ({ name }) => `${name.replace(/^src\//, "")}.esm.d.ts`,
175
+ preserveModules: true
176
+ },
177
+ {
178
+ dir: "dist"
179
+ }
180
+ ],
181
+ plugins: [
182
+ styled && skip({ patterns: [/\.s?css$/] }),
183
+ rollupPluginDts.dts({ tsconfig: resolveWorkspacePath("tsconfig.dts.json") }),
184
+ {
185
+ name: "rollup-plugin-declare-module-replacer",
186
+ /**
187
+ * replace relative path `declare module './xxx'` to `declare module '{{package name}}'`
188
+ * in output file generated
189
+ */
190
+ generateBundle(_, bundle) {
191
+ for (const file of Object.values(bundle)) {
192
+ if (!("code" in file))
193
+ continue;
194
+ file.code = file.code.replace(
195
+ /declare module ['|"]\..*['|"]/g,
196
+ `declare module '${pkg.name}'`
197
+ );
198
+ }
199
+ }
200
+ },
201
+ dtsPlugins
202
+ ],
203
+ external
204
+ }
205
+ ];
206
+ };
207
+
208
+ exports.template = template;
209
+
210
+ return exports;
211
+
212
+ })({}, node_path, getWorkspaceDir, autoprefixer, rollupPluginDts, esbuild, postcss, terser);
213
+ //# sourceMappingURL=rollup.iife.js.map
@@ -0,0 +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 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[0].toUpperCase() + name.slice(1)\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":["getWorkspaceDir","resolve","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,EAA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A,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;;;;;;;;;;"}
@@ -0,0 +1,2 @@
1
+ var jiekRollup=function(e,t,s,r,n,i,o,a){"use strict";function c(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 p=(e={})=>({name:"skip",load(t){if(e.patterns?.some((e=>"string"==typeof e?t.includes(e):e.test(t))))return""}});const l={dir:"dist",exports:"named",sourcemap:!0};function u(e){return[e,{...e,entryFileNames:e.entryFileNames?.replace(/(\.js)$/,".min$1"),plugins:[...e.plugins??[],a()]}]}const d=s.getWorkspaceDir();return e.template=({styled:e=!1,plugins:{index:s=[],entry:a=[],dts:m=[]}={}}={},g)=>{if(!g.name)throw new Error("pkg.name is required");const f=g.name.replace(/[@|/-](\w)/g,((e,t)=>t.toUpperCase())),j=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,t])=>[e.replace(/^\.$/,"index").replace(/^\.\//,""),"string"==typeof t?t:t["inner-src"]]))),[x,$]=function(){let e={};const t=new Set([]);return[({external:s}={})=>({name:"globals",resolveId:e=>s?.some((t=>t instanceof RegExp?t.test(e):t===e))?(t.add(e),{id:e,external:!0}):null,outputOptions:s=>(e=[...t].reduce(((e,t)=>({...e,[t]:c(t)})),{}),{...s,globals:e})}),{outputOptions:t=>({...t,globals:e})}]}(),y=function(){const e=process.cwd(),t=require(`${e}/package.json`),{dependencies:s={},peerDependencies:r={}}=t;return Object.keys(s).concat(Object.keys(r)).map((e=>new RegExp(`^${e}(/.*)?$`)))}();return[{input:j,output:[...u({...l,format:"esm",entryFileNames:"[name].esm.js",preserveModules:!0})],plugins:[x({external:y}),e&&p({patterns:[/\.s?css$/]}),i(),s]},...Object.entries(j).map((([t,s])=>{const n=f+("index"===t?"":t[0].toUpperCase()+t.slice(1));return{input:s,output:[...u({...l,name:n,format:"iife",entryFileNames:`${t}.iife.js`}),...u({...l,name:n,format:"umd",entryFileNames:`${t}.umd.js`})],plugins:[$,e&&o({plugins:[r],minimize:!0,sourceMap:!0,extract:`${t}.css`}),i(),a],external:y}})),{input:j,output:[{dir:"dist",entryFileNames:({name:e})=>`${e.replace(/^src\//,"")}.esm.d.ts`,preserveModules:!0},{dir:"dist"}],plugins:[e&&p({patterns:[/\.s?css$/]}),n.dts({tsconfig:(b="tsconfig.dts.json",t.resolve(d,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 '${g.name}'`))}},m],external:y}];var b},e}({},node_path,getWorkspaceDir,autoprefixer,rollupPluginDts,esbuild,postcss,terser);
2
+ //# sourceMappingURL=rollup.iife.min.js.map
@@ -0,0 +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 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[0].toUpperCase() + name.slice(1)\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","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","slice","postcss","autoprefixer","minimize","sourceMap","extract","tsconfig","p","resolve","generateBundle","bundle","file","values","code"],"mappings":"sDAAA,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,WAAW,GCJb,SAAAC,EAAyBC,GAIhB,MAAA,CACLA,E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IAEXA,EAAAE,KAAOF,EAAKE,KAAKpF,QACpB,iCACA,mBAAmBkC,EAAI1B,SAG7B,GAEFyB,GAEFnC,aA9IN,IAA8BgF,CAgJ5B"}
@@ -0,0 +1,214 @@
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';
6
+
7
+ function globalResolver(external) {
8
+ if (external.startsWith("@zodui/")) {
9
+ return external.replace(/[@/-](\w)/g, (_, c) => c.toUpperCase());
10
+ }
11
+ return {
12
+ react: "React",
13
+ // TODO `react/jsx-runtime` is not supported `umd`
14
+ "react/jsx-runtime": "ReactJSXRuntime",
15
+ // https://cdn.jsdelivr.net/npm/react@18.2.0/umd/react.development.js
16
+ "react-dom": "ReactDOM",
17
+ // https://cdn.jsdelivr.net/npm/react-dom@18.2.0/umd/react-dom.development.js
18
+ // TODO make the library use the global variable `TDesignReact` replace `TDesign`
19
+ "tdesign-react/esm": "TDesign",
20
+ // https://cdn.jsdelivr.net/npm/tdesign-react@1.4.0/dist/tdesign.js
21
+ // https://cdn.jsdelivr.net/npm/tdesign-react@1.4.0/dist/tdesign.css
22
+ "tdesign-icons-react": "TDesignIconReact",
23
+ // https://cdn.jsdelivr.net/npm/tdesign-icons-react@1.4.0/dist/index.js
24
+ zod: "Zod",
25
+ "@zodui/core": "ZodUICore",
26
+ "@zodui/core/utils": "ZodUICoreUtils",
27
+ "@zodui/react": "ZodUIReact"
28
+ }[external];
29
+ }
30
+
31
+ function createGlobalsLinkage() {
32
+ let globals = {};
33
+ const dependencies = /* @__PURE__ */ new Set([]);
34
+ return [
35
+ ({ external } = {}) => {
36
+ return {
37
+ name: "globals",
38
+ resolveId(id) {
39
+ if (external?.some((dep) => dep instanceof RegExp ? dep.test(id) : dep === id)) {
40
+ dependencies.add(id);
41
+ return { id, external: true };
42
+ }
43
+ return null;
44
+ },
45
+ outputOptions(options) {
46
+ globals = [...dependencies].reduce((acc, value) => ({
47
+ ...acc,
48
+ [value]: globalResolver(value)
49
+ }), {});
50
+ return { ...options, globals };
51
+ }
52
+ };
53
+ },
54
+ { outputOptions: (options) => ({ ...options, globals }) }
55
+ ];
56
+ }
57
+
58
+ var skip = (options = {}) => {
59
+ return {
60
+ name: "skip",
61
+ // skip the specified files by `options.patterns`
62
+ load(id) {
63
+ if (options.patterns?.some(
64
+ (pattern) => typeof pattern === "string" ? id.includes(pattern) : pattern.test(id)
65
+ )) {
66
+ return "";
67
+ }
68
+ }
69
+ };
70
+ };
71
+
72
+ const defineOutput = (output) => output;
73
+ const commonOutputOptions = defineOutput({
74
+ dir: "dist",
75
+ exports: "named",
76
+ sourcemap: true
77
+ });
78
+
79
+ function externalResolver() {
80
+ const cwd = process.cwd();
81
+ const pkg = require(`${cwd}/package.json`);
82
+ const { dependencies = {}, peerDependencies = {} } = pkg;
83
+ const external = Object.keys(dependencies).concat(Object.keys(peerDependencies));
84
+ return external.map((dep) => new RegExp(`^${dep}(/.*)?$`));
85
+ }
86
+
87
+ function withMinify(output) {
88
+ return [
89
+ output,
90
+ {
91
+ ...output,
92
+ entryFileNames: output.entryFileNames?.replace(/(\.js)$/, ".min$1"),
93
+ plugins: [...output.plugins ?? [], terser()]
94
+ }
95
+ ];
96
+ }
97
+
98
+ const workspaceRoot = getWorkspaceDir.getWorkspaceDir();
99
+ function resolveWorkspacePath(p) {
100
+ return node_path.resolve(workspaceRoot, p);
101
+ }
102
+ const template = ({
103
+ styled = false,
104
+ plugins: {
105
+ index: indexPlugins = [],
106
+ entry: entryPlugins = [],
107
+ dts: dtsPlugins = []
108
+ } = {}
109
+ } = {}, pkg) => {
110
+ if (!pkg.name) {
111
+ throw new Error("pkg.name is required");
112
+ }
113
+ const namePrefix = pkg.name.replace(/[@|/-](\w)/g, (_, $1) => $1.toUpperCase());
114
+ const exportsEntries = Object.fromEntries(
115
+ Object.entries(pkg.exports ?? {}).filter(([key]) => !/\.(json|css|scss)$/.test(key)).filter(([, value]) => typeof value === "object" && value["inner-src"] && value["import"]).map(([key, value]) => [
116
+ key.replace(/^\.$/, "index").replace(/^\.\//, ""),
117
+ typeof value === "string" ? value : value["inner-src"]
118
+ ])
119
+ );
120
+ const [globalsRegister, globalsOutput] = createGlobalsLinkage();
121
+ const external = externalResolver();
122
+ return [
123
+ {
124
+ input: exportsEntries,
125
+ output: [
126
+ ...withMinify({
127
+ ...commonOutputOptions,
128
+ format: "esm",
129
+ entryFileNames: "[name].esm.js",
130
+ preserveModules: true
131
+ })
132
+ ],
133
+ plugins: [
134
+ globalsRegister({ external }),
135
+ styled && skip({ patterns: [/\.s?css$/] }),
136
+ esbuild(),
137
+ indexPlugins
138
+ ]
139
+ },
140
+ ...Object.entries(exportsEntries).map(([name, input]) => {
141
+ const outputName = namePrefix + (name === "index" ? "" : name[0].toUpperCase() + name.slice(1));
142
+ return {
143
+ input,
144
+ output: [
145
+ ...withMinify({
146
+ ...commonOutputOptions,
147
+ name: outputName,
148
+ format: "iife",
149
+ entryFileNames: `${name}.iife.js`
150
+ }),
151
+ ...withMinify({
152
+ ...commonOutputOptions,
153
+ name: outputName,
154
+ format: "umd",
155
+ entryFileNames: `${name}.umd.js`
156
+ })
157
+ ],
158
+ plugins: [
159
+ globalsOutput,
160
+ styled && postcss({
161
+ plugins: [autoprefixer],
162
+ minimize: true,
163
+ sourceMap: true,
164
+ extract: `${name}.css`
165
+ }),
166
+ esbuild(),
167
+ entryPlugins
168
+ ],
169
+ external
170
+ };
171
+ }),
172
+ {
173
+ input: exportsEntries,
174
+ output: [
175
+ {
176
+ dir: "dist",
177
+ entryFileNames: ({ name }) => `${name.replace(/^src\//, "")}.esm.d.ts`,
178
+ preserveModules: true
179
+ },
180
+ {
181
+ dir: "dist"
182
+ }
183
+ ],
184
+ plugins: [
185
+ styled && skip({ patterns: [/\.s?css$/] }),
186
+ rollupPluginDts.dts({ tsconfig: resolveWorkspacePath("tsconfig.dts.json") }),
187
+ {
188
+ name: "rollup-plugin-declare-module-replacer",
189
+ /**
190
+ * replace relative path `declare module './xxx'` to `declare module '{{package name}}'`
191
+ * in output file generated
192
+ */
193
+ generateBundle(_, bundle) {
194
+ for (const file of Object.values(bundle)) {
195
+ if (!("code" in file))
196
+ continue;
197
+ file.code = file.code.replace(
198
+ /declare module ['|"]\..*['|"]/g,
199
+ `declare module '${pkg.name}'`
200
+ );
201
+ }
202
+ }
203
+ },
204
+ dtsPlugins
205
+ ],
206
+ external
207
+ }
208
+ ];
209
+ };
210
+
211
+ exports.template = template;
212
+
213
+ }));
214
+ //# sourceMappingURL=rollup.umd.js.map
@@ -0,0 +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 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[0].toUpperCase() + name.slice(1)\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 ['|\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ACL,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,UAAU,IAAK,CAAA,EAAE,UAAU,CAAC,UAAU,GAAG,CAAA;EAAA,QACzCC,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;;;;;;;;"}
@@ -0,0 +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,l){"use strict";function p(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 u=(e={})=>({name:"skip",load(t){if(e.patterns?.some((e=>"string"==typeof e?t.includes(e):e.test(t))))return""}});const a={dir:"dist",exports:"named",sourcemap:!0};function c(e){return[e,{...e,entryFileNames:e.entryFileNames?.replace(/(\.js)$/,".min$1"),plugins:[...e.plugins??[],l()]}]}const d=r.getWorkspaceDir();e.template=({styled:e=!1,plugins:{index:r=[],entry:l=[],dts:m=[]}={}}={},g)=>{if(!g.name)throw new Error("pkg.name is required");const f=g.name.replace(/[@|/-](\w)/g,((e,t)=>t.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,t])=>[e.replace(/^\.$/,"index").replace(/^\.\//,""),"string"==typeof t?t:t["inner-src"]]))),[j,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]:p(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:x,output:[...c({...a,format:"esm",entryFileNames:"[name].esm.js",preserveModules:!0})],plugins:[j({external:b}),e&&u({patterns:[/\.s?css$/]}),i(),r]},...Object.entries(x).map((([t,r])=>{const n=f+("index"===t?"":t[0].toUpperCase()+t.slice(1));return{input:r,output:[...c({...a,name:n,format:"iife",entryFileNames:`${t}.iife.js`}),...c({...a,name:n,format:"umd",entryFileNames:`${t}.umd.js`})],plugins:[y,e&&o({plugins:[s],minimize:!0,sourceMap:!0,extract:`${t}.css`}),i(),l],external:b}})),{input:x,output:[{dir:"dist",entryFileNames:({name:e})=>`${e.replace(/^src\//,"")}.esm.d.ts`,preserveModules:!0},{dir:"dist"}],plugins:[e&&u({patterns:[/\.s?css$/]}),n.dts({tsconfig:($="tsconfig.dts.json",t.resolve(d,$))}),{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 '${g.name}'`))}},m],external:b}];var $}}));
2
+ //# sourceMappingURL=rollup.umd.min.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rollup.umd.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 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[0].toUpperCase() + name.slice(1)\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","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","slice","postcss","autoprefixer","minimize","sourceMap","extract","tsconfig","p","resolve","generateBundle","bundle","file","values","code"],"mappings":"qsBAAA,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,WAAW,GCJb,SAAAC,EAAyBC,GAIhB,MAAA,CACLA,EACA,IACKA,EACHC,eAAgBD,EAAOC,gBAAgBtB,QAAQ,UAAW,UAC1DuB,QAAS,IAAKF,EAAOE,SAAW,GAAKC,MAG3C,CCAA,MAAMC,EAAgBC,EAAgBA,6BAKd,EAEpBC,UAAS,EACTJ,SACEK,MAAOC,EAAe,GACtBC,MAAOC,EAAe,GACtBC,IAAKC,EAAa,IAChB,CAAC,GAWH,CAAA,EACJC,KAQI,IAACA,EAAI1B,KACD,MAA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,iBAAiB,KAGrB7C,QAAS,CACPuB,EAAgB,CAAEhD,aAClB6B,GAAUrB,EAAK,CAAEK,SAAU,CAAC,cAC5B0D,IACAxC,OAGDU,OAAOE,QAAQH,GAAgBO,KAAI,EAAErC,EAAM0D,MAC5C,MAAMI,EAAalC,GACR,UAAT5B,EAAmB,GACjBA,EAAK,GAAGL,cAAgBK,EAAK+D,MAAM,IAGhC,MAAA,CACLL,QACA7C,OAAQ,IACHD,EAAW,IACTJ,EACHR,KAAM8D,EACNH,OAAQ,OACR7C,eAAgB,GAAGd,iBAElBY,EAAW,IACTJ,EACHR,KAAM8D,EACNH,OAAQ,MACR7C,eAAgB,GAAGd,cAGvBe,QAAS,CACPwB,EACApB,GAAU6C,EAAQ,CAChBjD,QAAS,CAACkD,GACVC,UAAU,EACVC,WAAW,EACXC,QAAS,GAAGpE,UAEd6D,IACAtC,GAEFjC,WACF,IAEF,CACEoE,MAAO5B,EACPjB,OAAQ,CACN,CACEJ,IAAK,OACLK,eAAgB,EAAGd,UAAW,GAAGA,EAAKR,QAAQ,SAAU,eACxDoE,iBAAiB,GAEnB,CACEnD,IAAK,SAGTM,QAAS,CACPI,GAAUrB,EAAK,CAAEK,SAAU,CAAC,cAC5BqB,EAAAA,IAAI,CAAE6C,UA1HgBC,EA0He,oBAzHpCC,EAAAA,QAAQtD,EAAeqD,MA0HxB,CACEtE,KAAM,wCAKN,cAAAwE,CAAe/E,EAAGgF,GAChB,IAAA,MAAWC,KAAQ3C,OAAO4C,OAAOF,GACzB,SAAUC,IAEXA,EAAAE,KAAOF,EAAKE,KAAKpF,QACpB,iCACA,mBAAmBkC,EAAI1B,SAG7B,GAEFyB,GAEFnC,aA9IN,IAA8BgF,CAgJ5B"}
package/package.json CHANGED
@@ -1,11 +1,17 @@
1
1
  {
2
2
  "name": "jiek",
3
- "version": "0.1.4",
3
+ "version": "0.1.5",
4
4
  "description": "YiJie's personal kits.",
5
5
  "bin": {
6
6
  "jiek": "bin/jiek.js",
7
7
  "jiek-dev": "bin/jiek-dev.js"
8
8
  },
9
+ "jiek": {
10
+ "inputs": [
11
+ "index.ts",
12
+ "rollup/index.ts"
13
+ ]
14
+ },
9
15
  "dependencies": {
10
16
  "@pnpm/filter-workspace-packages": "^7.2.13",
11
17
  "@rollup/plugin-json": "^6.0.1",
@@ -18,8 +24,8 @@
18
24
  "rollup-plugin-dts": "^6.1.0",
19
25
  "rollup-plugin-esbuild": "^6.1.0",
20
26
  "rollup-plugin-postcss": "^4.0.2",
21
- "@jiek/pkger": "0.1.4",
22
- "@jiek/utils": "0.1.5"
27
+ "@jiek/pkger": "0.1.6",
28
+ "@jiek/utils": "0.1.6"
23
29
  },
24
30
  "devDependencies": {
25
31
  "@npm/types": "^1.0.2",
@@ -50,9 +56,14 @@
50
56
  ".": {
51
57
  "types": "./dist/index.d.ts",
52
58
  "import": "./dist/index.esm.js",
53
- "default": "./dist/index.esm.js",
54
59
  "require": "./dist/index.umd.js",
55
- "inner-src": "src/index.ts"
60
+ "inner-src": "./src/index.ts"
61
+ },
62
+ "./rollup": {
63
+ "types": "./dist/rollup/index.d.ts",
64
+ "import": "./dist/rollup/index.esm.js",
65
+ "require": "./dist/rollup/index.umd.js",
66
+ "inner-src": "./src/rollup/index.ts"
56
67
  }
57
68
  },
58
69
  "scripts": {