@delta-comic/vite 0.1.2 → 0.1.4
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/dist/index.js +16 -14
- package/dist/index.js.map +1 -1
- package/dist/index.umd.cjs +1 -1
- package/dist/index.umd.cjs.map +1 -1
- package/dist/pack.tgz +0 -0
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -25,21 +25,23 @@ function i(e) {
|
|
|
25
25
|
}
|
|
26
26
|
function a(e, t) {
|
|
27
27
|
let n = Object.keys(t);
|
|
28
|
-
for (let
|
|
29
|
-
let
|
|
30
|
-
if (i(
|
|
31
|
-
let
|
|
32
|
-
|
|
28
|
+
for (let s = 0; s < n.length; s++) {
|
|
29
|
+
let c = n[s];
|
|
30
|
+
if (i(c)) continue;
|
|
31
|
+
let l = t[c], u = e[c];
|
|
32
|
+
o(l) && o(u) ? e[c] = a(u, l) : Array.isArray(l) ? e[c] = a([], l) : r(l) ? e[c] = a({}, l) : (u === void 0 || l !== void 0) && (e[c] = l);
|
|
33
33
|
}
|
|
34
34
|
return e;
|
|
35
35
|
}
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
36
|
+
function o(e) {
|
|
37
|
+
return r(e) || Array.isArray(e);
|
|
38
|
+
}
|
|
39
|
+
var s = Object.fromEntries(Object.entries(n).map(([e, t]) => [e, t.split(".").slice(1)]));
|
|
40
|
+
const c = (r, i, a) => {
|
|
41
|
+
let o = {
|
|
40
42
|
...a.dependencies,
|
|
41
43
|
...a.devDependencies
|
|
42
|
-
}, c = Object.fromEntries(Object.entries(n).filter(([e]) => e in
|
|
44
|
+
}, c = Object.fromEntries(Object.entries(n).filter(([e]) => e in o));
|
|
43
45
|
return [t({
|
|
44
46
|
entry: r.entry ?? "src/main.ts",
|
|
45
47
|
userscript: {
|
|
@@ -58,8 +60,8 @@ const s = (r, i, a) => {
|
|
|
58
60
|
open: !1,
|
|
59
61
|
prefix: !1
|
|
60
62
|
}
|
|
61
|
-
}), e(
|
|
62
|
-
},
|
|
63
|
+
}), e(s, { disableInServe: !1 })];
|
|
64
|
+
}, l = (t, r) => r == "build" ? [e(s, { disableInServe: !1 }), {
|
|
63
65
|
name: "delta-comic-helper",
|
|
64
66
|
config(e) {
|
|
65
67
|
return a(e, { build: {
|
|
@@ -80,7 +82,7 @@ const s = (r, i, a) => {
|
|
|
80
82
|
source: JSON.stringify(t, null, 2)
|
|
81
83
|
});
|
|
82
84
|
}
|
|
83
|
-
}] :
|
|
85
|
+
}] : c({
|
|
84
86
|
description: t.description,
|
|
85
87
|
displayName: t.name.display,
|
|
86
88
|
name: t.name.id,
|
|
@@ -93,6 +95,6 @@ const s = (r, i, a) => {
|
|
|
93
95
|
dependencies: n,
|
|
94
96
|
devDependencies: n
|
|
95
97
|
});
|
|
96
|
-
export {
|
|
98
|
+
export { c as deltaComic, l as deltaComicPlus };
|
|
97
99
|
|
|
98
100
|
//# 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.
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../utils/dist/index.js","../../../node_modules/.pnpm/es-toolkit@1.45.0/node_modules/es-toolkit/dist/predicate/isPlainObject.mjs","../../../node_modules/.pnpm/es-toolkit@1.45.0/node_modules/es-toolkit/dist/_internal/isUnsafeProperty.mjs","../../../node_modules/.pnpm/es-toolkit@1.45.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 (isMergeableValue(sourceValue) && isMergeableValue(targetValue)) {\n target[key] = merge(targetValue, sourceValue);\n }\n else if (Array.isArray(sourceValue)) {\n target[key] = merge([], sourceValue);\n }\n else if (isPlainObject(sourceValue)) {\n target[key] = merge({}, sourceValue);\n }\n else if (targetValue === undefined || sourceValue !== undefined) {\n target[key] = sourceValue;\n }\n }\n return target;\n}\nfunction isMergeableValue(value) {\n return isPlainObject(value) || Array.isArray(value);\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,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,EAAiB,EAAY,IAAI,EAAiB,EAAY,GAC9D,EAAO,KAAO,EAAM,GAAa,EAAY,GAExC,MAAM,QAAQ,EAAY,GAC/B,EAAO,KAAO,EAAM,EAAE,EAAE,EAAY,GAE/B,EAA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,GAAQ,EACnB,OAAO;GACL,KAAK;IACH,OAAO;IACP,UAAU;IACV,aAAa;IACb,MAAM,uBAAuB,EAAK,KAAK,GAAG,QAAQ,KAAK,IAAI,CAAC;IAC5D,SAAS,CAAC,KAAK;IAChB;GACD,eAAe,EAAE;GAClB,EACF,CAAC;;CAEJ,iBAAiB;AACb,OAAa,SAAS;GACtB,MAAM;GACN,UAAU;GACV,QAAQ,KAAK,UAAU,GAAM,MAAM,EAAE;GACtC,CAAC;;CAEL,CAE4D,GACzD,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"}
|
package/dist/index.umd.cjs
CHANGED
|
@@ -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];
|
|
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];m(a)&&m(o)?e[i]=p(o,a):Array.isArray(a)?e[i]=p([],a):d(a)?e[i]=p({},a):(o===void 0||a!==void 0)&&(e[i]=a)}return e}function m(e){return d(e)||Array.isArray(e)}var h=Object.fromEntries(Object.entries(u).map(([e,t])=>[e,t.split(`.`).slice(1)]));let g=(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)(h,{disableInServe:!1})]};e.deltaComic=g,e.deltaComicPlus=(e,n)=>n==`build`?[(0,t.viteExternalsPlugin)(h,{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)})}}]:g({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
|
package/dist/index.umd.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.umd.cjs","names":[],"sources":["../../utils/dist/index.js","../../../node_modules/.pnpm/es-toolkit@1.
|
|
1
|
+
{"version":3,"file":"index.umd.cjs","names":[],"sources":["../../utils/dist/index.js","../../../node_modules/.pnpm/es-toolkit@1.45.0/node_modules/es-toolkit/dist/predicate/isPlainObject.mjs","../../../node_modules/.pnpm/es-toolkit@1.45.0/node_modules/es-toolkit/dist/_internal/isUnsafeProperty.mjs","../../../node_modules/.pnpm/es-toolkit@1.45.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 (isMergeableValue(sourceValue) && isMergeableValue(targetValue)) {\n target[key] = merge(targetValue, sourceValue);\n }\n else if (Array.isArray(sourceValue)) {\n target[key] = merge([], sourceValue);\n }\n else if (isPlainObject(sourceValue)) {\n target[key] = merge({}, sourceValue);\n }\n else if (targetValue === undefined || sourceValue !== undefined) {\n target[key] = sourceValue;\n }\n }\n return target;\n}\nfunction isMergeableValue(value) {\n return isPlainObject(value) || Array.isArray(value);\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.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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.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"description": "空阙虱楼",
|
|
5
5
|
"homepage": "https://github.com/delta-comic/delta-comic-core",
|
|
6
6
|
"license": "AGPL-3.0-only",
|
|
@@ -30,14 +30,14 @@
|
|
|
30
30
|
"access": "public"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
|
-
"lightningcss": "^1.
|
|
34
|
-
"vite": "8.0.0-beta.
|
|
33
|
+
"lightningcss": "^1.31.1",
|
|
34
|
+
"vite": "8.0.0-beta.16"
|
|
35
35
|
},
|
|
36
36
|
"peerDependencies": {
|
|
37
37
|
"vite-plugin-externals": "^0.6.2",
|
|
38
38
|
"vite-plugin-monkey": "^7.1.8",
|
|
39
|
-
"@delta-comic/
|
|
40
|
-
"@delta-comic/
|
|
39
|
+
"@delta-comic/plugin": "0.3.5",
|
|
40
|
+
"@delta-comic/utils": "0.0.7"
|
|
41
41
|
},
|
|
42
42
|
"release": {
|
|
43
43
|
"tagFormat": "vite-${version}"
|