@delta-comic/vite 0.1.0 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,42 +1,42 @@
1
- ```python
2
- r"""
3
- ___________________________
4
- / ______\ | __ | | ____|
5
- | | _____ | |__| | | |__
6
- | | / _ \| __ \ | __|
7
- | |___| |_| || | \ \| |____
8
- \__________/|_| \________|
9
- ==============================
10
- 空阙虱楼 Copyright © Wenxig
11
- """
12
- ```
13
-
14
- [![GitHub](https://img.shields.io/github/license/delta-comic/delta-comic-core)](https://raw.githubusercontent.com/delta-comic/delta-comic-core/main/LICENSE)
15
- [![NPM Downloads](https://img.shields.io/npm/dm/delta-comic-core)](https://www.npmjs.com/package/delta-comic-core)
16
-
17
- - 工具库
18
-
19
- ## 功能
20
-
21
- - 辅助编写插件
22
- - 提供通用数据结构与默认样式
23
-
24
- ## 如何使用
25
-
26
- ```sh
27
- pnpm add delta-comic-core
28
- ```
29
-
30
- ## 为谁编写插件?
31
-
32
- [![Readme Card](https://wenxig-grs.vercel.app/api/pin/?username=delta-comic&repo=delta-comic&user&theme=transparent)](https://github.com/delta-comic/delta-comic)
33
-
34
- ## 辅助的插件
35
-
36
- ### Layout
37
-
38
- [![Readme Card](https://wenxig-grs.vercel.app/api/pin/?username=delta-comic&repo=delta-comic-plugin-layout&user&theme=transparent)](https://github.com/delta-comic/delta-comic-plugin-bika)
39
-
40
- ## Star History
41
-
1
+ ```python
2
+ r"""
3
+ ___________________________
4
+ / ______\ | __ | | ____|
5
+ | | _____ | |__| | | |__
6
+ | | / _ \| __ \ | __|
7
+ | |___| |_| || | \ \| |____
8
+ \__________/|_| \________|
9
+ ==============================
10
+ 空阙虱楼 Copyright © Wenxig
11
+ """
12
+ ```
13
+
14
+ [![GitHub](https://img.shields.io/github/license/delta-comic/delta-comic-core)](https://raw.githubusercontent.com/delta-comic/delta-comic-core/main/LICENSE)
15
+ [![NPM Downloads](https://img.shields.io/npm/dm/delta-comic-core)](https://www.npmjs.com/package/delta-comic-core)
16
+
17
+ - 工具库
18
+
19
+ ## 功能
20
+
21
+ - 辅助编写插件
22
+ - 提供通用数据结构与默认样式
23
+
24
+ ## 如何使用
25
+
26
+ ```sh
27
+ pnpm add delta-comic-core
28
+ ```
29
+
30
+ ## 为谁编写插件?
31
+
32
+ [![Readme Card](https://wenxig-grs.vercel.app/api/pin/?username=delta-comic&repo=delta-comic&user&theme=transparent)](https://github.com/delta-comic/delta-comic)
33
+
34
+ ## 辅助的插件
35
+
36
+ ### Layout
37
+
38
+ [![Readme Card](https://wenxig-grs.vercel.app/api/pin/?username=delta-comic&repo=delta-comic-plugin-layout&user&theme=transparent)](https://github.com/delta-comic/delta-comic-plugin-bika)
39
+
40
+ ## Star History
41
+
42
42
  [![Star History Chart](https://api.star-history.com/svg?repos=delta-comic/delta-comic-core&type=Date)](https://www.star-history.com/#delta-comic/delta-comic-core&Date)
package/dist/index.js CHANGED
@@ -33,13 +33,14 @@ function a(e, t) {
33
33
  }
34
34
  return e;
35
35
  }
36
+ var o = Object.fromEntries(Object.entries(n).map(([e, t]) => [e, t.split(".").slice(1)]));
36
37
  /** vite插件,自动配置了库的外部化与脚本头 */
37
- const o = (r, i, a) => {
38
- let o = {
38
+ const s = (r, i, a) => {
39
+ let s = {
39
40
  ...a.dependencies,
40
41
  ...a.devDependencies
41
- }, s = Object.fromEntries(Object.entries(n).filter(([e]) => e in o));
42
- return [i == "build" ? !1 : e(n), t({
42
+ }, c = Object.fromEntries(Object.entries(n).filter(([e]) => e in s));
43
+ return [t({
43
44
  entry: r.entry ?? "src/main.ts",
44
45
  userscript: {
45
46
  name: {
@@ -51,14 +52,14 @@ const o = (r, i, a) => {
51
52
  description: r.description,
52
53
  require: ["core", ...r.require ?? []].map((e) => typeof e == "string" ? `dc|${e}:` : `dc|${e.id}:${e.download ?? ""}`)
53
54
  },
54
- build: { externalGlobals: i == "serve" ? {} : s },
55
+ build: { externalGlobals: i == "serve" ? {} : c },
55
56
  server: {
56
57
  mountGmApi: !1,
57
58
  open: !1,
58
59
  prefix: !1
59
60
  }
60
- })];
61
- }, s = (t, r) => r == "build" ? [e(n), {
61
+ }), e(o, { disableInServe: !1 })];
62
+ }, c = (t, r) => r == "build" ? [e(o, { disableInServe: !1 }), {
62
63
  name: "delta-comic-helper",
63
64
  config(e) {
64
65
  return a(e, { build: {
@@ -79,7 +80,7 @@ const o = (r, i, a) => {
79
80
  source: JSON.stringify(t, null, 2)
80
81
  });
81
82
  }
82
- }] : o({
83
+ }] : s({
83
84
  description: t.description,
84
85
  displayName: t.name.display,
85
86
  name: t.name.id,
@@ -92,6 +93,6 @@ const o = (r, i, a) => {
92
93
  dependencies: n,
93
94
  devDependencies: n
94
95
  });
95
- export { o as deltaComic, s as deltaComicPlus };
96
+ export { s as deltaComic, c as deltaComicPlus };
96
97
 
97
98
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../utils/dist/index.js","../../../node_modules/.pnpm/es-toolkit@1.40.0/node_modules/es-toolkit/dist/predicate/isPlainObject.mjs","../../../node_modules/.pnpm/es-toolkit@1.40.0/node_modules/es-toolkit/dist/_internal/isUnsafeProperty.mjs","../../../node_modules/.pnpm/es-toolkit@1.40.0/node_modules/es-toolkit/dist/object/merge.mjs","../lib/index.ts"],"sourcesContent":["const extendsDepends = {\n\tvue: \"window.$$lib$$.Vue\",\n\tvant: \"window.$$lib$$.Vant\",\n\t\"naive-ui\": \"window.$$lib$$.Naive\",\n\taxios: \"window.$$lib$$.Axios\",\n\tpinia: \"window.$$lib$$.Pinia\",\n\t\"vue-router\": \"window.$$lib$$.VR\",\n\t\"@delta-comic/ui\": \"window.$$lib$$.DcUi\",\n\t\"@delta-comic/model\": \"window.$$lib$$.DcModel\",\n\t\"@delta-comic/core\": \"window.$$lib$$.DcCore\",\n\t\"@delta-comic/plugin\": \"window.$$lib$$.DcPlugin\",\n\t\"@delta-comic/utils\": \"window.$$lib$$.DcUtils\",\n\t\"@delta-comic/require\": \"window.$$lib$$.DcRequire\",\n\t\"@delta-comic/db\": \"window.$$lib$$.DcDb\"\n}, useGlobalVar = (e, t) => (window.$api.__core_lib__ ??= {})[t] ??= e;\nexport { extendsDepends, useGlobalVar };\n\n//# sourceMappingURL=index.js.map","function isPlainObject(value) {\n if (!value || typeof value !== 'object') {\n return false;\n }\n const proto = Object.getPrototypeOf(value);\n const hasObjectPrototype = proto === null ||\n proto === Object.prototype ||\n Object.getPrototypeOf(proto) === null;\n if (!hasObjectPrototype) {\n return false;\n }\n return Object.prototype.toString.call(value) === '[object Object]';\n}\n\nexport { isPlainObject };\n","function isUnsafeProperty(key) {\n return key === '__proto__';\n}\n\nexport { isUnsafeProperty };\n","import { isUnsafeProperty } from '../_internal/isUnsafeProperty.mjs';\nimport { isPlainObject } from '../predicate/isPlainObject.mjs';\n\nfunction merge(target, source) {\n const sourceKeys = Object.keys(source);\n for (let i = 0; i < sourceKeys.length; i++) {\n const key = sourceKeys[i];\n if (isUnsafeProperty(key)) {\n continue;\n }\n const sourceValue = source[key];\n const targetValue = target[key];\n if (Array.isArray(sourceValue)) {\n if (Array.isArray(targetValue)) {\n target[key] = merge(targetValue, sourceValue);\n }\n else {\n target[key] = merge([], sourceValue);\n }\n }\n else if (isPlainObject(sourceValue)) {\n if (isPlainObject(targetValue)) {\n target[key] = merge(targetValue, sourceValue);\n }\n else {\n target[key] = merge({}, sourceValue);\n }\n }\n else if (targetValue === undefined || sourceValue !== undefined) {\n target[key] = sourceValue;\n }\n }\n return target;\n}\n\nexport { merge };\n","import type { PluginMeta } from '@delta-comic/plugin'\r\n\r\nimport { extendsDepends } from '@delta-comic/utils'\r\nimport { merge } from 'es-toolkit'\r\nimport { viteExternalsPlugin as external } from 'vite-plugin-externals'\r\nimport monkey from 'vite-plugin-monkey'\r\n\r\n/** vite插件,自动配置了库的外部化与脚本头 */\r\nexport const deltaComic = (\r\n config: {\r\n name: string\r\n displayName: string\r\n version: string\r\n author?: string\r\n description: string\r\n /** 通过语义化版本号描述core支持版本,通过`semver.satisfies`判定,所有的`>=`会替换为`^`,除非`lockCoreVersion为`true` */\r\n supportCoreVersion: string\r\n /** 如果为`true`,则`supportCoreVersion`的`>=`不会替换为`^` */\r\n lockCoreVersion?: boolean\r\n /** @default ['core'] */\r\n require?: ({ id: string; download?: string } | string)[]\r\n /** @default 'src/main.ts' */\r\n entry?: string\r\n },\r\n command: 'build' | 'serve',\r\n packageJson: { dependencies: Record<string, string>; devDependencies: Record<string, string> }\r\n): any => {\r\n const allDependencies = { ...packageJson.dependencies, ...packageJson.devDependencies }\r\n const needExternalDepends = Object.fromEntries(\r\n Object.entries(extendsDepends).filter(([key]) => key in allDependencies)\r\n )\r\n\r\n const result = [\r\n command == 'build' ? false : external(extendsDepends),\r\n monkey({\r\n entry: config.entry ?? 'src/main.ts',\r\n userscript: {\r\n name: { display: config.displayName, id: config.name },\r\n version: `${config.version}/${config.supportCoreVersion}/${!!config.lockCoreVersion}`,\r\n author: config.author,\r\n description: config.description,\r\n require: ['core', ...(config.require ?? [])].map(v => {\r\n if (typeof v == 'string') return `dc|${v}:`\r\n return `dc|${v.id}:${v.download ?? ''}`\r\n })\r\n },\r\n build: { externalGlobals: command == 'serve' ? {} : needExternalDepends },\r\n server: { mountGmApi: false, open: false, prefix: false }\r\n })\r\n ]\r\n return result\r\n}\r\n\r\nexport const deltaComicPlus = (meta: PluginMeta, command: 'build' | 'serve'): any => {\r\n const plugin = {\r\n name: 'delta-comic-helper',\r\n config(config: any) {\r\n return merge(config, {\r\n build: {\r\n lib: {\r\n entry: './src/main.ts',\r\n fileName: 'index',\r\n cssFileName: 'index',\r\n name: `$$lib$$.__DcPlugin__${meta.name.id.replace('-', '_')}__`,\r\n formats: ['es']\r\n },\r\n rollupOptions: {}\r\n }\r\n })\r\n },\r\n generateBundle() {\r\n ;(this as any).emitFile({\r\n type: 'asset', // 指定类型为资源文件\r\n fileName: 'manifest.json', // 输出的文件名\r\n source: JSON.stringify(meta, null, 2) // 将 meta 对象转换为格式化的 JSON 字符串\r\n })\r\n }\r\n }\r\n return command == 'build'\r\n ? ([external(extendsDepends), plugin] as any)\r\n : deltaComic(\r\n {\r\n description: meta.description,\r\n displayName: meta.name.display,\r\n name: meta.name.id,\r\n supportCoreVersion: meta.version.supportCore,\r\n version: meta.version.plugin,\r\n author: meta.author,\r\n entry: 'src/main.ts',\r\n require: meta.require\r\n },\r\n command,\r\n { dependencies: extendsDepends, devDependencies: extendsDepends }\r\n )\r\n}"],"x_google_ignoreList":[1,2,3],"mappings":";;AAAA,IAAM,IAAiB;CACtB,KAAK;CACL,MAAM;CACN,YAAY;CACZ,OAAO;CACP,OAAO;CACP,cAAc;CACd,mBAAmB;CACnB,sBAAsB;CACtB,qBAAqB;CACrB,uBAAuB;CACvB,sBAAsB;CACtB,wBAAwB;CACxB,mBAAmB;CACnB;ACdD,SAAS,EAAc,GAAO;AAC1B,KAAI,CAAC,KAAS,OAAO,KAAU,SAC3B,QAAO;CAEX,IAAM,IAAQ,OAAO,eAAe,EAAM;AAO1C,QAN2B,MAAU,QACjC,MAAU,OAAO,aACjB,OAAO,eAAe,EAAM,KAAK,OAI9B,OAAO,UAAU,SAAS,KAAK,EAAM,KAAK,oBAFtC;;ACTf,SAAS,EAAiB,GAAK;AAC3B,QAAO,MAAQ;;ACEnB,SAAS,EAAM,GAAQ,GAAQ;CAC3B,IAAM,IAAa,OAAO,KAAK,EAAO;AACtC,MAAK,IAAI,IAAI,GAAG,IAAI,EAAW,QAAQ,KAAK;EACxC,IAAM,IAAM,EAAW;AACvB,MAAI,EAAiB,EAAI,CACrB;EAEJ,IAAM,IAAc,EAAO,IACrB,IAAc,EAAO;AAC3B,EAAI,MAAM,QAAQ,EAAY,GACtB,MAAM,QAAQ,EAAY,GAC1B,EAAO,KAAO,EAAM,GAAa,EAAY,GAG7C,EAAO,KAAO,EAAM,EAAE,EAAE,EAAY,GAG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EJ,iBAAiB;AACb,OAAa,SAAS;GACtB,MAAM;GACN,UAAU;GACV,QAAQ,KAAK,UAAU,GAAM,MAAM,EAAE;GACtC,CAAC;;CAEL,CAEsC,GACnC,EACE;CACE,aAAa,EAAK;CAClB,aAAa,EAAK,KAAK;CACvB,MAAM,EAAK,KAAK;CAChB,oBAAoB,EAAK,QAAQ;CACjC,SAAS,EAAK,QAAQ;CACtB,QAAQ,EAAK;CACb,OAAO;CACP,SAAS,EAAK;CACf,EACD,GACA;CAAE,cAAc;CAAgB,iBAAiB;CAAgB,CAClE"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../utils/dist/index.js","../../../node_modules/.pnpm/es-toolkit@1.40.0/node_modules/es-toolkit/dist/predicate/isPlainObject.mjs","../../../node_modules/.pnpm/es-toolkit@1.40.0/node_modules/es-toolkit/dist/_internal/isUnsafeProperty.mjs","../../../node_modules/.pnpm/es-toolkit@1.40.0/node_modules/es-toolkit/dist/object/merge.mjs","../lib/index.ts"],"sourcesContent":["const e = {\n\tvue: \"window.$$lib$$.Vue\",\n\tvant: \"window.$$lib$$.Vant\",\n\t\"naive-ui\": \"window.$$lib$$.Naive\",\n\taxios: \"window.$$lib$$.Axios\",\n\tpinia: \"window.$$lib$$.Pinia\",\n\t\"vue-router\": \"window.$$lib$$.VR\",\n\t\"@delta-comic/ui\": \"window.$$lib$$.DcUi\",\n\t\"@delta-comic/model\": \"window.$$lib$$.DcModel\",\n\t\"@delta-comic/core\": \"window.$$lib$$.DcCore\",\n\t\"@delta-comic/plugin\": \"window.$$lib$$.DcPlugin\",\n\t\"@delta-comic/utils\": \"window.$$lib$$.DcUtils\",\n\t\"@delta-comic/require\": \"window.$$lib$$.DcRequire\",\n\t\"@delta-comic/db\": \"window.$$lib$$.DcDb\"\n}, t = (e, t) => (window.$api.__core_lib__ ??= {})[t] ??= e;\nexport { e as extendsDepends, t as useGlobalVar };\n\n//# sourceMappingURL=index.js.map","function isPlainObject(value) {\n if (!value || typeof value !== 'object') {\n return false;\n }\n const proto = Object.getPrototypeOf(value);\n const hasObjectPrototype = proto === null ||\n proto === Object.prototype ||\n Object.getPrototypeOf(proto) === null;\n if (!hasObjectPrototype) {\n return false;\n }\n return Object.prototype.toString.call(value) === '[object Object]';\n}\n\nexport { isPlainObject };\n","function isUnsafeProperty(key) {\n return key === '__proto__';\n}\n\nexport { isUnsafeProperty };\n","import { isUnsafeProperty } from '../_internal/isUnsafeProperty.mjs';\nimport { isPlainObject } from '../predicate/isPlainObject.mjs';\n\nfunction merge(target, source) {\n const sourceKeys = Object.keys(source);\n for (let i = 0; i < sourceKeys.length; i++) {\n const key = sourceKeys[i];\n if (isUnsafeProperty(key)) {\n continue;\n }\n const sourceValue = source[key];\n const targetValue = target[key];\n if (Array.isArray(sourceValue)) {\n if (Array.isArray(targetValue)) {\n target[key] = merge(targetValue, sourceValue);\n }\n else {\n target[key] = merge([], sourceValue);\n }\n }\n else if (isPlainObject(sourceValue)) {\n if (isPlainObject(targetValue)) {\n target[key] = merge(targetValue, sourceValue);\n }\n else {\n target[key] = merge({}, sourceValue);\n }\n }\n else if (targetValue === undefined || sourceValue !== undefined) {\n target[key] = sourceValue;\n }\n }\n return target;\n}\n\nexport { merge };\n","import type { PluginMeta } from '@delta-comic/plugin'\nimport { extendsDepends } from '@delta-comic/utils'\nimport { merge } from 'es-toolkit'\nimport { viteExternalsPlugin as external } from 'vite-plugin-externals'\nimport monkey from 'vite-plugin-monkey'\n\nconst externals = Object.fromEntries(\n Object.entries(extendsDepends).map(([key, val]) => [key, val.split('.').slice(1)])\n)\n\n/** vite插件,自动配置了库的外部化与脚本头 */\nexport const deltaComic = (\n config: {\n name: string\n displayName: string\n version: string\n author?: string\n description: string\n /** 通过语义化版本号描述core支持版本,通过`semver.satisfies`判定,所有的`>=`会替换为`^`,除非`lockCoreVersion为`true` */\n supportCoreVersion: string\n /** 如果为`true`,则`supportCoreVersion`的`>=`不会替换为`^` */\n lockCoreVersion?: boolean\n /** @default ['core'] */\n require?: ({ id: string; download?: string } | string)[]\n /** @default 'src/main.ts' */\n entry?: string\n },\n command: 'build' | 'serve',\n packageJson: { dependencies: Record<string, string>; devDependencies: Record<string, string> }\n): any => {\n const allDependencies = { ...packageJson.dependencies, ...packageJson.devDependencies }\n const needExternalDepends = Object.fromEntries(\n Object.entries(extendsDepends).filter(([key]) => key in allDependencies)\n )\n\n const result = [\n monkey({\n entry: config.entry ?? 'src/main.ts',\n userscript: {\n name: { display: config.displayName, id: config.name },\n version: `${config.version}/${config.supportCoreVersion}/${!!config.lockCoreVersion}`,\n author: config.author,\n description: config.description,\n require: ['core', ...(config.require ?? [])].map(v => {\n if (typeof v == 'string') return `dc|${v}:`\n return `dc|${v.id}:${v.download ?? ''}`\n })\n },\n build: { externalGlobals: command == 'serve' ? {} : needExternalDepends },\n server: { mountGmApi: false, open: false, prefix: false }\n }),\n external(externals, { disableInServe: false })\n ]\n return result\n}\n\nexport const deltaComicPlus = (meta: PluginMeta, command: 'build' | 'serve'): any => {\n const plugin = {\n name: 'delta-comic-helper',\n config(config: any) {\n return merge(config, {\n build: {\n lib: {\n entry: './src/main.ts',\n fileName: 'index',\n cssFileName: 'index',\n name: `$$lib$$.__DcPlugin__${meta.name.id.replace('-', '_')}__`,\n formats: ['es']\n },\n rollupOptions: {}\n }\n })\n },\n generateBundle() {\n ;(this as any).emitFile({\n type: 'asset', // 指定类型为资源文件\n fileName: 'manifest.json', // 输出的文件名\n source: JSON.stringify(meta, null, 2) // 将 meta 对象转换为格式化的 JSON 字符串\n })\n }\n }\n return command == 'build'\n ? ([external(externals, { disableInServe: false }), plugin] as any)\n : deltaComic(\n {\n description: meta.description,\n displayName: meta.name.display,\n name: meta.name.id,\n supportCoreVersion: meta.version.supportCore,\n version: meta.version.plugin,\n author: meta.author,\n entry: 'src/main.ts',\n require: meta.require\n },\n command,\n { dependencies: extendsDepends, devDependencies: extendsDepends }\n )\n}"],"x_google_ignoreList":[1,2,3],"mappings":";;AAAA,IAAM,IAAI;CACT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S,EAAK,QAAQ;CACtB,QAAQ,EAAK;CACb,OAAO;CACP,SAAS,EAAK;CACf,EACD,GACA;CAAE,cAAc;CAAgB,iBAAiB;CAAgB,CAClE"}
@@ -1,2 +1,2 @@
1
- (function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require(`vite-plugin-externals`),require(`vite-plugin-monkey`)):typeof define==`function`&&define.amd?define([`exports`,`vite-plugin-externals`,`vite-plugin-monkey`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.DcVite={},e.vite_plugin_externals,e.vite_plugin_monkey))})(this,function(e,t,n){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var r=Object.create,i=Object.defineProperty,a=Object.getOwnPropertyDescriptor,o=Object.getOwnPropertyNames,s=Object.getPrototypeOf,c=Object.prototype.hasOwnProperty,l=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var s=o(t),l=0,u=s.length,d;l<u;l++)d=s[l],!c.call(e,d)&&d!==n&&i(e,d,{get:(e=>t[e]).bind(null,d),enumerable:!(r=a(t,d))||r.enumerable});return e};n=((e,t,n)=>(n=e==null?{}:r(s(e)),l(t||!e||!e.__esModule?i(n,`default`,{value:e,enumerable:!0}):n,e)))(n);var u={vue:`window.$$lib$$.Vue`,vant:`window.$$lib$$.Vant`,"naive-ui":`window.$$lib$$.Naive`,axios:`window.$$lib$$.Axios`,pinia:`window.$$lib$$.Pinia`,"vue-router":`window.$$lib$$.VR`,"@delta-comic/ui":`window.$$lib$$.DcUi`,"@delta-comic/model":`window.$$lib$$.DcModel`,"@delta-comic/core":`window.$$lib$$.DcCore`,"@delta-comic/plugin":`window.$$lib$$.DcPlugin`,"@delta-comic/utils":`window.$$lib$$.DcUtils`,"@delta-comic/require":`window.$$lib$$.DcRequire`,"@delta-comic/db":`window.$$lib$$.DcDb`};function d(e){if(!e||typeof e!=`object`)return!1;let t=Object.getPrototypeOf(e);return t===null||t===Object.prototype||Object.getPrototypeOf(t)===null?Object.prototype.toString.call(e)===`[object Object]`:!1}function f(e){return e===`__proto__`}function p(e,t){let n=Object.keys(t);for(let r=0;r<n.length;r++){let i=n[r];if(f(i))continue;let a=t[i],o=e[i];Array.isArray(a)?Array.isArray(o)?e[i]=p(o,a):e[i]=p([],a):d(a)?d(o)?e[i]=p(o,a):e[i]=p({},a):(o===void 0||a!==void 0)&&(e[i]=a)}return e}let m=(e,r,i)=>{let a={...i.dependencies,...i.devDependencies},o=Object.fromEntries(Object.entries(u).filter(([e])=>e in a));return[r==`build`?!1:(0,t.viteExternalsPlugin)(u),(0,n.default)({entry:e.entry??`src/main.ts`,userscript:{name:{display:e.displayName,id:e.name},version:`${e.version}/${e.supportCoreVersion}/${!!e.lockCoreVersion}`,author:e.author,description:e.description,require:[`core`,...e.require??[]].map(e=>typeof e==`string`?`dc|${e}:`:`dc|${e.id}:${e.download??``}`)},build:{externalGlobals:r==`serve`?{}:o},server:{mountGmApi:!1,open:!1,prefix:!1}})]};e.deltaComic=m,e.deltaComicPlus=(e,n)=>n==`build`?[(0,t.viteExternalsPlugin)(u),{name:`delta-comic-helper`,config(t){return p(t,{build:{lib:{entry:`./src/main.ts`,fileName:`index`,cssFileName:`index`,name:`$$lib$$.__DcPlugin__${e.name.id.replace(`-`,`_`)}__`,formats:[`es`]},rollupOptions:{}}})},generateBundle(){this.emitFile({type:`asset`,fileName:`manifest.json`,source:JSON.stringify(e,null,2)})}}]:m({description:e.description,displayName:e.name.display,name:e.name.id,supportCoreVersion:e.version.supportCore,version:e.version.plugin,author:e.author,entry:`src/main.ts`,require:e.require},n,{dependencies:u,devDependencies:u})});
1
+ (function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require(`vite-plugin-externals`),require(`vite-plugin-monkey`)):typeof define==`function`&&define.amd?define([`exports`,`vite-plugin-externals`,`vite-plugin-monkey`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.DcVite={},e.vite_plugin_externals,e.vite_plugin_monkey))})(this,function(e,t,n){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var r=Object.create,i=Object.defineProperty,a=Object.getOwnPropertyDescriptor,o=Object.getOwnPropertyNames,s=Object.getPrototypeOf,c=Object.prototype.hasOwnProperty,l=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var s=o(t),l=0,u=s.length,d;l<u;l++)d=s[l],!c.call(e,d)&&d!==n&&i(e,d,{get:(e=>t[e]).bind(null,d),enumerable:!(r=a(t,d))||r.enumerable});return e};n=((e,t,n)=>(n=e==null?{}:r(s(e)),l(t||!e||!e.__esModule?i(n,`default`,{value:e,enumerable:!0}):n,e)))(n);var u={vue:`window.$$lib$$.Vue`,vant:`window.$$lib$$.Vant`,"naive-ui":`window.$$lib$$.Naive`,axios:`window.$$lib$$.Axios`,pinia:`window.$$lib$$.Pinia`,"vue-router":`window.$$lib$$.VR`,"@delta-comic/ui":`window.$$lib$$.DcUi`,"@delta-comic/model":`window.$$lib$$.DcModel`,"@delta-comic/core":`window.$$lib$$.DcCore`,"@delta-comic/plugin":`window.$$lib$$.DcPlugin`,"@delta-comic/utils":`window.$$lib$$.DcUtils`,"@delta-comic/require":`window.$$lib$$.DcRequire`,"@delta-comic/db":`window.$$lib$$.DcDb`};function d(e){if(!e||typeof e!=`object`)return!1;let t=Object.getPrototypeOf(e);return t===null||t===Object.prototype||Object.getPrototypeOf(t)===null?Object.prototype.toString.call(e)===`[object Object]`:!1}function f(e){return e===`__proto__`}function p(e,t){let n=Object.keys(t);for(let r=0;r<n.length;r++){let i=n[r];if(f(i))continue;let a=t[i],o=e[i];Array.isArray(a)?Array.isArray(o)?e[i]=p(o,a):e[i]=p([],a):d(a)?d(o)?e[i]=p(o,a):e[i]=p({},a):(o===void 0||a!==void 0)&&(e[i]=a)}return e}var m=Object.fromEntries(Object.entries(u).map(([e,t])=>[e,t.split(`.`).slice(1)]));let h=(e,r,i)=>{let a={...i.dependencies,...i.devDependencies},o=Object.fromEntries(Object.entries(u).filter(([e])=>e in a));return[(0,n.default)({entry:e.entry??`src/main.ts`,userscript:{name:{display:e.displayName,id:e.name},version:`${e.version}/${e.supportCoreVersion}/${!!e.lockCoreVersion}`,author:e.author,description:e.description,require:[`core`,...e.require??[]].map(e=>typeof e==`string`?`dc|${e}:`:`dc|${e.id}:${e.download??``}`)},build:{externalGlobals:r==`serve`?{}:o},server:{mountGmApi:!1,open:!1,prefix:!1}}),(0,t.viteExternalsPlugin)(m,{disableInServe:!1})]};e.deltaComic=h,e.deltaComicPlus=(e,n)=>n==`build`?[(0,t.viteExternalsPlugin)(m,{disableInServe:!1}),{name:`delta-comic-helper`,config(t){return p(t,{build:{lib:{entry:`./src/main.ts`,fileName:`index`,cssFileName:`index`,name:`$$lib$$.__DcPlugin__${e.name.id.replace(`-`,`_`)}__`,formats:[`es`]},rollupOptions:{}}})},generateBundle(){this.emitFile({type:`asset`,fileName:`manifest.json`,source:JSON.stringify(e,null,2)})}}]:h({description:e.description,displayName:e.name.display,name:e.name.id,supportCoreVersion:e.version.supportCore,version:e.version.plugin,author:e.author,entry:`src/main.ts`,require:e.require},n,{dependencies:u,devDependencies:u})});
2
2
  //# sourceMappingURL=index.umd.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.umd.cjs","names":[],"sources":["../../utils/dist/index.js","../../../node_modules/.pnpm/es-toolkit@1.40.0/node_modules/es-toolkit/dist/predicate/isPlainObject.mjs","../../../node_modules/.pnpm/es-toolkit@1.40.0/node_modules/es-toolkit/dist/_internal/isUnsafeProperty.mjs","../../../node_modules/.pnpm/es-toolkit@1.40.0/node_modules/es-toolkit/dist/object/merge.mjs","../lib/index.ts"],"sourcesContent":["const extendsDepends = {\n\tvue: \"window.$$lib$$.Vue\",\n\tvant: \"window.$$lib$$.Vant\",\n\t\"naive-ui\": \"window.$$lib$$.Naive\",\n\taxios: \"window.$$lib$$.Axios\",\n\tpinia: \"window.$$lib$$.Pinia\",\n\t\"vue-router\": \"window.$$lib$$.VR\",\n\t\"@delta-comic/ui\": \"window.$$lib$$.DcUi\",\n\t\"@delta-comic/model\": \"window.$$lib$$.DcModel\",\n\t\"@delta-comic/core\": \"window.$$lib$$.DcCore\",\n\t\"@delta-comic/plugin\": \"window.$$lib$$.DcPlugin\",\n\t\"@delta-comic/utils\": \"window.$$lib$$.DcUtils\",\n\t\"@delta-comic/require\": \"window.$$lib$$.DcRequire\",\n\t\"@delta-comic/db\": \"window.$$lib$$.DcDb\"\n}, useGlobalVar = (e, t) => (window.$api.__core_lib__ ??= {})[t] ??= e;\nexport { extendsDepends, useGlobalVar };\n\n//# sourceMappingURL=index.js.map","function isPlainObject(value) {\n if (!value || typeof value !== 'object') {\n return false;\n }\n const proto = Object.getPrototypeOf(value);\n const hasObjectPrototype = proto === null ||\n proto === Object.prototype ||\n Object.getPrototypeOf(proto) === null;\n if (!hasObjectPrototype) {\n return false;\n }\n return Object.prototype.toString.call(value) === '[object Object]';\n}\n\nexport { isPlainObject };\n","function isUnsafeProperty(key) {\n return key === '__proto__';\n}\n\nexport { isUnsafeProperty };\n","import { isUnsafeProperty } from '../_internal/isUnsafeProperty.mjs';\nimport { isPlainObject } from '../predicate/isPlainObject.mjs';\n\nfunction merge(target, source) {\n const sourceKeys = Object.keys(source);\n for (let i = 0; i < sourceKeys.length; i++) {\n const key = sourceKeys[i];\n if (isUnsafeProperty(key)) {\n continue;\n }\n const sourceValue = source[key];\n const targetValue = target[key];\n if (Array.isArray(sourceValue)) {\n if (Array.isArray(targetValue)) {\n target[key] = merge(targetValue, sourceValue);\n }\n else {\n target[key] = merge([], sourceValue);\n }\n }\n else if (isPlainObject(sourceValue)) {\n if (isPlainObject(targetValue)) {\n target[key] = merge(targetValue, sourceValue);\n }\n else {\n target[key] = merge({}, sourceValue);\n }\n }\n else if (targetValue === undefined || sourceValue !== undefined) {\n target[key] = sourceValue;\n }\n }\n return target;\n}\n\nexport { merge };\n","import type { PluginMeta } from '@delta-comic/plugin'\r\n\r\nimport { extendsDepends } from '@delta-comic/utils'\r\nimport { merge } from 'es-toolkit'\r\nimport { viteExternalsPlugin as external } from 'vite-plugin-externals'\r\nimport monkey from 'vite-plugin-monkey'\r\n\r\n/** vite插件,自动配置了库的外部化与脚本头 */\r\nexport const deltaComic = (\r\n config: {\r\n name: string\r\n displayName: string\r\n version: string\r\n author?: string\r\n description: string\r\n /** 通过语义化版本号描述core支持版本,通过`semver.satisfies`判定,所有的`>=`会替换为`^`,除非`lockCoreVersion为`true` */\r\n supportCoreVersion: string\r\n /** 如果为`true`,则`supportCoreVersion`的`>=`不会替换为`^` */\r\n lockCoreVersion?: boolean\r\n /** @default ['core'] */\r\n require?: ({ id: string; download?: string } | string)[]\r\n /** @default 'src/main.ts' */\r\n entry?: string\r\n },\r\n command: 'build' | 'serve',\r\n packageJson: { dependencies: Record<string, string>; devDependencies: Record<string, string> }\r\n): any => {\r\n const allDependencies = { ...packageJson.dependencies, ...packageJson.devDependencies }\r\n const needExternalDepends = Object.fromEntries(\r\n Object.entries(extendsDepends).filter(([key]) => key in allDependencies)\r\n )\r\n\r\n const result = [\r\n command == 'build' ? false : external(extendsDepends),\r\n monkey({\r\n entry: config.entry ?? 'src/main.ts',\r\n userscript: {\r\n name: { display: config.displayName, id: config.name },\r\n version: `${config.version}/${config.supportCoreVersion}/${!!config.lockCoreVersion}`,\r\n author: config.author,\r\n description: config.description,\r\n require: ['core', ...(config.require ?? [])].map(v => {\r\n if (typeof v == 'string') return `dc|${v}:`\r\n return `dc|${v.id}:${v.download ?? ''}`\r\n })\r\n },\r\n build: { externalGlobals: command == 'serve' ? {} : needExternalDepends },\r\n server: { mountGmApi: false, open: false, prefix: false }\r\n })\r\n ]\r\n return result\r\n}\r\n\r\nexport const deltaComicPlus = (meta: PluginMeta, command: 'build' | 'serve'): any => {\r\n const plugin = {\r\n name: 'delta-comic-helper',\r\n config(config: any) {\r\n return merge(config, {\r\n build: {\r\n lib: {\r\n entry: './src/main.ts',\r\n fileName: 'index',\r\n cssFileName: 'index',\r\n name: `$$lib$$.__DcPlugin__${meta.name.id.replace('-', '_')}__`,\r\n formats: ['es']\r\n },\r\n rollupOptions: {}\r\n }\r\n })\r\n },\r\n generateBundle() {\r\n ;(this as any).emitFile({\r\n type: 'asset', // 指定类型为资源文件\r\n fileName: 'manifest.json', // 输出的文件名\r\n source: JSON.stringify(meta, null, 2) // 将 meta 对象转换为格式化的 JSON 字符串\r\n })\r\n }\r\n }\r\n return command == 'build'\r\n ? ([external(extendsDepends), plugin] as any)\r\n : deltaComic(\r\n {\r\n description: meta.description,\r\n displayName: meta.name.display,\r\n name: meta.name.id,\r\n supportCoreVersion: meta.version.supportCore,\r\n version: meta.version.plugin,\r\n author: meta.author,\r\n entry: 'src/main.ts',\r\n require: meta.require\r\n },\r\n command,\r\n { dependencies: extendsDepends, devDependencies: extendsDepends }\r\n )\r\n}"],"x_google_ignoreList":[1,2,3],"mappings":"84BAAA,IAAM,EAAiB,CACtB,IAAK,qBACL,KAAM,sBACN,WAAY,uBACZ,MAAO,uBACP,MAAO,uBACP,aAAc,oBACd,kBAAmB,sBACnB,qBAAsB,yBACtB,oBAAqB,wBACrB,sBAAuB,0BACvB,qBAAsB,yBACtB,uBAAwB,2BACxB,kBAAmB,sBACnB,CCdD,SAAS,EAAc,EAAO,CAC1B,GAAI,CAAC,GAAS,OAAO,GAAU,SAC3B,MAAO,GAEX,IAAM,EAAQ,OAAO,eAAe,EAAM,CAO1C,OAN2B,IAAU,MACjC,IAAU,OAAO,WACjB,OAAO,eAAe,EAAM,GAAK,KAI9B,OAAO,UAAU,SAAS,KAAK,EAAM,GAAK,kBAFtC,GCTf,SAAS,EAAiB,EAAK,CAC3B,OAAO,IAAQ,YCEnB,SAAS,EAAM,EAAQ,EAAQ,CAC3B,IAAM,EAAa,OAAO,KAAK,EAAO,CACtC,IAAK,IAAI,EAAI,EAAG,EAAI,EAAW,OAAQ,IAAK,CACxC,IAAM,EAAM,EAAW,GACvB,GAAI,EAAiB,EAAI,CACrB,SAEJ,IAAM,EAAc,EAAO,GACrB,EAAc,EAAO,GACvB,MAAM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MAAO,gBACP,SAAU,QACV,YAAa,QACb,KAAM,uBAAuB,EAAK,KAAK,GAAG,QAAQ,IAAK,IAAI,CAAC,IAC5D,QAAS,CAAC,KAAK,CAChB,CACD,cAAe,EAAE,CAClB,CACF,CAAC,EAEJ,gBAAiB,CACb,KAAa,SAAS,CACtB,KAAM,QACN,SAAU,gBACV,OAAQ,KAAK,UAAU,EAAM,KAAM,EAAE,CACtC,CAAC,EAEL,CAEsC,CACnC,EACE,CACE,YAAa,EAAK,YAClB,YAAa,EAAK,KAAK,QACvB,KAAM,EAAK,KAAK,GAChB,mBAAoB,EAAK,QAAQ,YACjC,QAAS,EAAK,QAAQ,OACtB,OAAQ,EAAK,OACb,MAAO,cACP,QAAS,EAAK,QACf,CACD,EACA,CAAE,aAAc,EAAgB,gBAAiB,EAAgB,CAClE"}
1
+ {"version":3,"file":"index.umd.cjs","names":[],"sources":["../../utils/dist/index.js","../../../node_modules/.pnpm/es-toolkit@1.40.0/node_modules/es-toolkit/dist/predicate/isPlainObject.mjs","../../../node_modules/.pnpm/es-toolkit@1.40.0/node_modules/es-toolkit/dist/_internal/isUnsafeProperty.mjs","../../../node_modules/.pnpm/es-toolkit@1.40.0/node_modules/es-toolkit/dist/object/merge.mjs","../lib/index.ts"],"sourcesContent":["const e = {\n\tvue: \"window.$$lib$$.Vue\",\n\tvant: \"window.$$lib$$.Vant\",\n\t\"naive-ui\": \"window.$$lib$$.Naive\",\n\taxios: \"window.$$lib$$.Axios\",\n\tpinia: \"window.$$lib$$.Pinia\",\n\t\"vue-router\": \"window.$$lib$$.VR\",\n\t\"@delta-comic/ui\": \"window.$$lib$$.DcUi\",\n\t\"@delta-comic/model\": \"window.$$lib$$.DcModel\",\n\t\"@delta-comic/core\": \"window.$$lib$$.DcCore\",\n\t\"@delta-comic/plugin\": \"window.$$lib$$.DcPlugin\",\n\t\"@delta-comic/utils\": \"window.$$lib$$.DcUtils\",\n\t\"@delta-comic/require\": \"window.$$lib$$.DcRequire\",\n\t\"@delta-comic/db\": \"window.$$lib$$.DcDb\"\n}, t = (e, t) => (window.$api.__core_lib__ ??= {})[t] ??= e;\nexport { e as extendsDepends, t as useGlobalVar };\n\n//# sourceMappingURL=index.js.map","function isPlainObject(value) {\n if (!value || typeof value !== 'object') {\n return false;\n }\n const proto = Object.getPrototypeOf(value);\n const hasObjectPrototype = proto === null ||\n proto === Object.prototype ||\n Object.getPrototypeOf(proto) === null;\n if (!hasObjectPrototype) {\n return false;\n }\n return Object.prototype.toString.call(value) === '[object Object]';\n}\n\nexport { isPlainObject };\n","function isUnsafeProperty(key) {\n return key === '__proto__';\n}\n\nexport { isUnsafeProperty };\n","import { isUnsafeProperty } from '../_internal/isUnsafeProperty.mjs';\nimport { isPlainObject } from '../predicate/isPlainObject.mjs';\n\nfunction merge(target, source) {\n const sourceKeys = Object.keys(source);\n for (let i = 0; i < sourceKeys.length; i++) {\n const key = sourceKeys[i];\n if (isUnsafeProperty(key)) {\n continue;\n }\n const sourceValue = source[key];\n const targetValue = target[key];\n if (Array.isArray(sourceValue)) {\n if (Array.isArray(targetValue)) {\n target[key] = merge(targetValue, sourceValue);\n }\n else {\n target[key] = merge([], sourceValue);\n }\n }\n else if (isPlainObject(sourceValue)) {\n if (isPlainObject(targetValue)) {\n target[key] = merge(targetValue, sourceValue);\n }\n else {\n target[key] = merge({}, sourceValue);\n }\n }\n else if (targetValue === undefined || sourceValue !== undefined) {\n target[key] = sourceValue;\n }\n }\n return target;\n}\n\nexport { merge };\n","import type { PluginMeta } from '@delta-comic/plugin'\nimport { extendsDepends } from '@delta-comic/utils'\nimport { merge } from 'es-toolkit'\nimport { viteExternalsPlugin as external } from 'vite-plugin-externals'\nimport monkey from 'vite-plugin-monkey'\n\nconst externals = Object.fromEntries(\n Object.entries(extendsDepends).map(([key, val]) => [key, val.split('.').slice(1)])\n)\n\n/** vite插件,自动配置了库的外部化与脚本头 */\nexport const deltaComic = (\n config: {\n name: string\n displayName: string\n version: string\n author?: string\n description: string\n /** 通过语义化版本号描述core支持版本,通过`semver.satisfies`判定,所有的`>=`会替换为`^`,除非`lockCoreVersion为`true` */\n supportCoreVersion: string\n /** 如果为`true`,则`supportCoreVersion`的`>=`不会替换为`^` */\n lockCoreVersion?: boolean\n /** @default ['core'] */\n require?: ({ id: string; download?: string } | string)[]\n /** @default 'src/main.ts' */\n entry?: string\n },\n command: 'build' | 'serve',\n packageJson: { dependencies: Record<string, string>; devDependencies: Record<string, string> }\n): any => {\n const allDependencies = { ...packageJson.dependencies, ...packageJson.devDependencies }\n const needExternalDepends = Object.fromEntries(\n Object.entries(extendsDepends).filter(([key]) => key in allDependencies)\n )\n\n const result = [\n monkey({\n entry: config.entry ?? 'src/main.ts',\n userscript: {\n name: { display: config.displayName, id: config.name },\n version: `${config.version}/${config.supportCoreVersion}/${!!config.lockCoreVersion}`,\n author: config.author,\n description: config.description,\n require: ['core', ...(config.require ?? [])].map(v => {\n if (typeof v == 'string') return `dc|${v}:`\n return `dc|${v.id}:${v.download ?? ''}`\n })\n },\n build: { externalGlobals: command == 'serve' ? {} : needExternalDepends },\n server: { mountGmApi: false, open: false, prefix: false }\n }),\n external(externals, { disableInServe: false })\n ]\n return result\n}\n\nexport const deltaComicPlus = (meta: PluginMeta, command: 'build' | 'serve'): any => {\n const plugin = {\n name: 'delta-comic-helper',\n config(config: any) {\n return merge(config, {\n build: {\n lib: {\n entry: './src/main.ts',\n fileName: 'index',\n cssFileName: 'index',\n name: `$$lib$$.__DcPlugin__${meta.name.id.replace('-', '_')}__`,\n formats: ['es']\n },\n rollupOptions: {}\n }\n })\n },\n generateBundle() {\n ;(this as any).emitFile({\n type: 'asset', // 指定类型为资源文件\n fileName: 'manifest.json', // 输出的文件名\n source: JSON.stringify(meta, null, 2) // 将 meta 对象转换为格式化的 JSON 字符串\n })\n }\n }\n return command == 'build'\n ? ([external(externals, { disableInServe: false }), plugin] as any)\n : deltaComic(\n {\n description: meta.description,\n displayName: meta.name.display,\n name: meta.name.id,\n supportCoreVersion: meta.version.supportCore,\n version: meta.version.plugin,\n author: meta.author,\n entry: 'src/main.ts',\n require: meta.require\n },\n command,\n { dependencies: extendsDepends, devDependencies: extendsDepends }\n )\n}"],"x_google_ignoreList":[1,2,3],"mappings":"84BAAA,IAAM,EAAI,CACT,IAAK,qBACL,KAAM,sBACN,WAAY,uBACZ,MAAO,uBACP,MAAO,uBACP,aAAc,oBACd,kBAAmB,sBACnB,qBAAsB,yBACtB,oBAAqB,wBACrB,sBAAuB,0BACvB,qBAAsB,yBACtB,uBAAwB,2BACxB,kBAAmB,sBACnB,CCdD,SAAS,EAAc,EAAO,CAC1B,GAAI,CAAC,GAAS,OAAO,GAAU,SAC3B,MAAO,GAEX,IAAM,EAAQ,OAAO,eAAe,EAAM,CAO1C,OAN2B,IAAU,MACjC,IAAU,OAAO,WACjB,OAAO,eAAe,EAAM,GAAK,KAI9B,OAAO,UAAU,SAAS,KAAK,EAAM,GAAK,kBAFtC,GCTf,SAAS,EAAiB,EAAK,CAC3B,OAAO,IAAQ,YCEnB,SAAS,EAAM,EAAQ,EAAQ,CAC3B,IAAM,EAAa,OAAO,KAAK,EAAO,CACtC,IAAK,IAAI,EAAI,EAAG,EAAI,EAAW,OAAQ,IAAK,CACxC,IAAM,EAAM,EAAW,GACvB,GAAI,EAAiB,EAAI,CACrB,SAEJ,IAAM,EAAc,EAAO,GACrB,EAAc,EAAO,GACvB,MAAM,QAAQ,EAAY,CACtB,MAAM,QAAQ,EAAY,CAC1B,EAAO,GAAO,EAAM,EAAa,EAAY,CAG7C,EAAO,GAAO,EAAM,EAAE,CAAE,EAAY,CAGnC,EAAc,EAAY,CAC3B,EAAc,EAAY,CAC1B,EAAO,GAAO,EAAM,EAAa,EAAY,CAG7C,EAAO,GAAO,EAAM,EAAE,CAAE,EAAY,EAGnC,IAAgB,IAAA,IAAa,IAAgB,IAAA,MAClD,EAAO,GAAO,GAGtB,OAAO,EC1BX,IAAM,EAAY,OAAO,YACvB,OAAO,QAAQ,EAAe,CAAC,KA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tB,KAAM,QACN,SAAU,gBACV,OAAQ,KAAK,UAAU,EAAM,KAAM,EAAE,CACtC,CAAC,EAEL,CAE4D,CACzD,EACE,CACE,YAAa,EAAK,YAClB,YAAa,EAAK,KAAK,QACvB,KAAM,EAAK,KAAK,GAChB,mBAAoB,EAAK,QAAQ,YACjC,QAAS,EAAK,QAAQ,OACtB,OAAQ,EAAK,OACb,MAAO,cACP,QAAS,EAAK,QACf,CACD,EACA,CAAE,aAAc,EAAgB,gBAAiB,EAAgB,CAClE"}
package/dist/pack.tgz CHANGED
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@delta-comic/vite",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "空阙虱楼",
5
5
  "homepage": "https://github.com/delta-comic/delta-comic-core",
6
6
  "license": "AGPL-3.0-only",
@@ -30,13 +30,14 @@
30
30
  "access": "public"
31
31
  },
32
32
  "devDependencies": {
33
- "lightningcss": "^1.30.2"
33
+ "lightningcss": "^1.30.2",
34
+ "vite": "8.0.0-beta.15"
34
35
  },
35
36
  "peerDependencies": {
36
37
  "vite-plugin-externals": "^0.6.2",
37
38
  "vite-plugin-monkey": "^7.1.8",
38
- "@delta-comic/plugin": "0.2.0",
39
- "@delta-comic/utils": "0.0.3"
39
+ "@delta-comic/utils": "0.0.5",
40
+ "@delta-comic/plugin": "0.3.3"
40
41
  },
41
42
  "release": {
42
43
  "tagFormat": "vite-${version}"
@@ -47,8 +48,8 @@
47
48
  "readme": "./README.md",
48
49
  "scripts": {
49
50
  "build": "vite build && pnpm pack --out ./dist/pack.tgz",
50
- "version:major": "pnpm version major --no-git-tag-version",
51
- "version:minor": "pnpm version minor --no-git-tag-version",
52
- "version:patch": "pnpm version patch --no-git-tag-version"
51
+ "version:major": "pnpm version major --no-git-tag-version || true",
52
+ "version:minor": "pnpm version minor --no-git-tag-version || true",
53
+ "version:patch": "pnpm version patch --no-git-tag-version || true"
53
54
  }
54
55
  }