jiek 0.1.10 → 0.1.12-alpha.1
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/index.esm.js +5 -2
- package/dist/index.esm.js.map +1 -1
- package/dist/index.esm.min.js +1 -1
- package/dist/index.esm.min.js.map +1 -1
- package/dist/index.iife.js +164 -58
- package/dist/index.iife.js.map +1 -1
- package/dist/index.iife.min.js +1 -1
- package/dist/index.iife.min.js.map +1 -1
- package/dist/index.umd.js +166 -60
- package/dist/index.umd.js.map +1 -1
- package/dist/index.umd.min.js +1 -1
- package/dist/index.umd.min.js.map +1 -1
- package/dist/package.json.esm.js +58 -0
- package/dist/package.json.esm.js.map +1 -0
- package/dist/package.json.esm.min.js +2 -0
- package/dist/package.json.esm.min.js.map +1 -0
- package/dist/rollup/utils/commonOptions.esm.js +1 -0
- package/dist/rollup/utils/commonOptions.esm.js.map +1 -1
- package/dist/rollup/utils/commonOptions.esm.min.js +1 -1
- package/dist/rollup/utils/commonOptions.esm.min.js.map +1 -1
- package/dist/rollup.esm.js +14 -8
- package/dist/rollup.esm.js.map +1 -1
- package/dist/rollup.esm.min.js +1 -1
- package/dist/rollup.esm.min.js.map +1 -1
- package/dist/rollup.iife.js +23 -10
- package/dist/rollup.iife.js.map +1 -1
- package/dist/rollup.iife.min.js +1 -1
- package/dist/rollup.iife.min.js.map +1 -1
- package/dist/rollup.umd.js +25 -12
- package/dist/rollup.umd.js.map +1 -1
- package/dist/rollup.umd.min.js +1 -1
- package/dist/rollup.umd.min.js.map +1 -1
- package/dist/src/commands/build.esm.js +53 -0
- package/dist/src/commands/build.esm.js.map +1 -0
- package/dist/src/commands/build.esm.min.js +2 -0
- package/dist/src/commands/build.esm.min.js.map +1 -0
- package/dist/src/commands/publish.esm.js +54 -0
- package/dist/src/commands/publish.esm.js.map +1 -0
- package/dist/src/commands/publish.esm.min.js +2 -0
- package/dist/src/commands/publish.esm.min.js.map +1 -0
- package/dist/src/inner.esm.js +10 -0
- package/dist/src/inner.esm.js.map +1 -0
- package/dist/src/inner.esm.min.js +2 -0
- package/dist/src/inner.esm.min.js.map +1 -0
- package/dist/src/merge-package-json.esm.js +16 -0
- package/dist/src/merge-package-json.esm.js.map +1 -0
- package/dist/src/merge-package-json.esm.min.js +2 -0
- package/dist/src/merge-package-json.esm.min.js.map +1 -0
- package/dist/src/rollup/plugins/globals.esm.js +31 -0
- package/dist/src/rollup/plugins/globals.esm.js.map +1 -0
- package/dist/src/rollup/plugins/globals.esm.min.js +2 -0
- package/dist/src/rollup/plugins/globals.esm.min.js.map +1 -0
- package/dist/src/rollup/plugins/skip.esm.js +16 -0
- package/dist/src/rollup/plugins/skip.esm.js.map +1 -0
- package/dist/src/rollup/plugins/skip.esm.min.js +2 -0
- package/dist/src/rollup/plugins/skip.esm.min.js.map +1 -0
- package/dist/src/rollup/utils/commonOptions.esm.js +10 -0
- package/dist/src/rollup/utils/commonOptions.esm.js.map +1 -0
- package/dist/src/rollup/utils/commonOptions.esm.min.js +2 -0
- package/dist/src/rollup/utils/commonOptions.esm.min.js.map +1 -0
- package/dist/src/rollup/utils/externalResolver.esm.js +10 -0
- package/dist/src/rollup/utils/externalResolver.esm.js.map +1 -0
- package/dist/src/rollup/utils/externalResolver.esm.min.js +2 -0
- package/dist/src/rollup/utils/externalResolver.esm.min.js.map +1 -0
- package/dist/src/rollup/utils/globalResolver.esm.js +26 -0
- package/dist/src/rollup/utils/globalResolver.esm.js.map +1 -0
- package/dist/src/rollup/utils/globalResolver.esm.min.js +2 -0
- package/dist/src/rollup/utils/globalResolver.esm.min.js.map +1 -0
- package/dist/src/rollup/utils/withMinify.esm.js +15 -0
- package/dist/src/rollup/utils/withMinify.esm.js.map +1 -0
- package/dist/src/rollup/utils/withMinify.esm.min.js +2 -0
- package/dist/src/rollup/utils/withMinify.esm.min.js.map +1 -0
- package/dist/src/utils/filterSupport.esm.js +78 -0
- package/dist/src/utils/filterSupport.esm.js.map +1 -0
- package/dist/src/utils/filterSupport.esm.min.js +2 -0
- package/dist/src/utils/filterSupport.esm.min.js.map +1 -0
- package/package.json +5 -2
@@ -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 @@
|
|
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,78 @@
|
|
1
|
+
import fs from 'node:fs';
|
2
|
+
import path from 'node:path';
|
3
|
+
import { getWorkspaceDir } from '@jiek/utils/getWorkspaceDir';
|
4
|
+
import { filterPackagesFromDir } from '@pnpm/filter-workspace-packages';
|
5
|
+
import { program } from 'commander';
|
6
|
+
import { load } from 'js-yaml';
|
7
|
+
|
8
|
+
let type = "";
|
9
|
+
try {
|
10
|
+
require.resolve("@pnpm/filter-workspace-packages");
|
11
|
+
type = "pnpm";
|
12
|
+
} catch {
|
13
|
+
}
|
14
|
+
if (type !== "") {
|
15
|
+
program.option("-f, --filter <filter>", "filter packages");
|
16
|
+
}
|
17
|
+
async function getSelectedProjectsGraph() {
|
18
|
+
let filter = program.getOptionValue("filter");
|
19
|
+
const rootOption = program.getOptionValue("root");
|
20
|
+
const root = rootOption ? path.isAbsolute(rootOption) ? rootOption : path.resolve(process.cwd(), rootOption) : process.cwd();
|
21
|
+
let notWorkspace = false;
|
22
|
+
let wd;
|
23
|
+
try {
|
24
|
+
wd = getWorkspaceDir(root, type);
|
25
|
+
} catch (e) {
|
26
|
+
if ("message" in e && e.message === "workspace root not found") {
|
27
|
+
wd = root;
|
28
|
+
notWorkspace = true;
|
29
|
+
} else {
|
30
|
+
throw e;
|
31
|
+
}
|
32
|
+
}
|
33
|
+
if (!notWorkspace && type === "pnpm") {
|
34
|
+
const pnpmWorkspaceFilePath = path.resolve(wd, "pnpm-workspace.yaml");
|
35
|
+
const pnpmWorkspaceFileContent = fs.readFileSync(pnpmWorkspaceFilePath, "utf-8");
|
36
|
+
const pnpmWorkspace = load(pnpmWorkspaceFileContent);
|
37
|
+
if (root === wd && !filter) {
|
38
|
+
throw new Error("root path is workspace root, please provide a filter");
|
39
|
+
}
|
40
|
+
if (root !== wd && !filter) {
|
41
|
+
const packageJSONIsExist = fs.existsSync(path.resolve(root, "package.json"));
|
42
|
+
if (!packageJSONIsExist) {
|
43
|
+
throw new Error("root path is not workspace root, please provide a filter");
|
44
|
+
}
|
45
|
+
const packageJSON = JSON.parse(fs.readFileSync(path.resolve(root, "package.json"), "utf-8"));
|
46
|
+
if (!packageJSON.name) {
|
47
|
+
throw new Error("root path is not workspace root, please provide a filter");
|
48
|
+
}
|
49
|
+
filter = packageJSON.name;
|
50
|
+
}
|
51
|
+
const { selectedProjectsGraph } = await filterPackagesFromDir(wd, [{
|
52
|
+
filter: filter ?? "",
|
53
|
+
followProdDepsOnly: true
|
54
|
+
}], {
|
55
|
+
prefix: root,
|
56
|
+
workspaceDir: wd,
|
57
|
+
patterns: pnpmWorkspace.packages
|
58
|
+
});
|
59
|
+
return {
|
60
|
+
wd,
|
61
|
+
root,
|
62
|
+
value: Object.entries(selectedProjectsGraph).reduce((acc, [key, value]) => {
|
63
|
+
acc[key] = value.package.manifest;
|
64
|
+
return acc;
|
65
|
+
}, {})
|
66
|
+
};
|
67
|
+
}
|
68
|
+
return {
|
69
|
+
wd,
|
70
|
+
root,
|
71
|
+
value: {
|
72
|
+
[wd]: JSON.parse(fs.readFileSync(path.resolve(wd, "package.json"), "utf-8"))
|
73
|
+
}
|
74
|
+
};
|
75
|
+
}
|
76
|
+
|
77
|
+
export { getSelectedProjectsGraph, type };
|
78
|
+
//# sourceMappingURL=filterSupport.esm.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"filterSupport.esm.js","sources":["../../../src/utils/filterSupport.ts"],"sourcesContent":["import fs from 'node:fs'\nimport path from 'node:path'\n\nimport { getWorkspaceDir } from '@jiek/utils/getWorkspaceDir'\nimport { filterPackagesFromDir } from '@pnpm/filter-workspace-packages'\nimport { program } from 'commander'\nimport { load } from 'js-yaml'\n\nexport let type = ''\n\ntry {\n require.resolve('@pnpm/filter-workspace-packages')\n type = 'pnpm'\n} catch { /* empty */ }\nif (type !== '') {\n program\n .option('-f, --filter <filter>', 'filter packages')\n}\n\ninterface ProjectsGraph {\n wd: string\n root: string\n value?: Record<string, {\n name?: string\n }>\n}\n\nexport async function getSelectedProjectsGraph(): Promise<ProjectsGraph> {\n let filter = program.getOptionValue('filter')\n const rootOption = program.getOptionValue('root')\n const root = rootOption\n ? path.isAbsolute(rootOption)\n ? rootOption\n : path.resolve(process.cwd(), rootOption)\n : process.cwd()\n let notWorkspace = false\n let wd: string\n try {\n wd = getWorkspaceDir(root, type)\n } catch (e) {\n // @ts-ignore\n if ('message' in e && e.message === 'workspace root not found') {\n wd = root\n notWorkspace = true\n } else {\n throw e\n }\n }\n if (!notWorkspace && type === 'pnpm') {\n const pnpmWorkspaceFilePath = path.resolve(wd, 'pnpm-workspace.yaml')\n const pnpmWorkspaceFileContent = fs.readFileSync(pnpmWorkspaceFilePath, 'utf-8')\n const pnpmWorkspace = load(pnpmWorkspaceFileContent) as {\n packages: string[]\n }\n if (root === wd && !filter) {\n throw new Error('root path is workspace root, please provide a filter')\n // TODO inquirer prompt support user select packages\n }\n if (root !== wd && !filter) {\n const packageJSONIsExist = fs.existsSync(path.resolve(root, 'package.json'))\n if (!packageJSONIsExist) {\n throw new Error('root path is not workspace root, please provide a filter')\n }\n const packageJSON = JSON.parse(fs.readFileSync(path.resolve(root, 'package.json'), 'utf-8'))\n if (!packageJSON.name) {\n throw new Error('root path is not workspace root, please provide a filter')\n }\n filter = packageJSON.name\n }\n const { selectedProjectsGraph } = await filterPackagesFromDir(wd, [{\n filter: filter ?? '',\n followProdDepsOnly: true\n }], {\n prefix: root,\n workspaceDir: wd,\n patterns: pnpmWorkspace.packages\n })\n return {\n wd, root,\n value: Object.entries(selectedProjectsGraph)\n .reduce((acc, [key, value]) => {\n acc[key] = value.package.manifest\n return acc\n }, {} as NonNullable<ProjectsGraph['value']>)\n }\n }\n return {\n wd, root,\n value: {\n [wd]: JSON.parse(fs.readFileSync(path.resolve(wd, 'package.json'), 'utf-8'))\n }\n }\n}\n"],"names":[],"mappings":";;;;;;;AAQO,IAAI,IAAO,GAAA,GAAA;AAElB,IAAI;AACF,EAAA,OAAA,CAAQ,QAAQ,iCAAiC,CAAA,CAAA;AACjD,EAAO,IAAA,GAAA,MAAA,CAAA;AACT,CAAQ,CAAA,MAAA;AAAc,CAAA;AACtB,IAAI,SAAS,EAAI,EAAA;AACf,EACG,OAAA,CAAA,MAAA,CAAO,yBAAyB,iBAAiB,CAAA,CAAA;AACtD,CAAA;AAUA,eAAsB,wBAAmD,GAAA;AACvE,EAAI,IAAA,MAAA,GAAS,OAAQ,CAAA,cAAA,CAAe,QAAQ,CAAA,CAAA;AAC5C,EAAM,MAAA,UAAA,GAAa,OAAQ,CAAA,cAAA,CAAe,MAAM,CAAA,CAAA;AAChD,EAAA,MAAM,IAAO,GAAA,UAAA,GACT,IAAK,CAAA,UAAA,CAAW,UAAU,CACxB,GAAA,UAAA,GACA,IAAK,CAAA,OAAA,CAAQ,QAAQ,GAAI,EAAA,EAAG,UAAU,CAAA,GACxC,QAAQ,GAAI,EAAA,CAAA;AAChB,EAAA,IAAI,YAAe,GAAA,KAAA,CAAA;AACnB,EAAI,IAAA,EAAA,CAAA;AACJ,EAAI,IAAA;AACF,IAAK,EAAA,GAAA,eAAA,CAAgB,MAAM,IAAI,CAAA,CAAA;AAAA,WACxB,CAAG,EAAA;AAEV,IAAA,IAAI,SAAa,IAAA,CAAA,IAAK,CAAE,CAAA,OAAA,KAAY,0BAA4B,EAAA;AAC9D,MAAK,EAAA,GAAA,IAAA,CAAA;AACL,MAAe,YAAA,GAAA,IAAA,CAAA;AAAA,KACV,MAAA;AACL,MAAM,MAAA,CAAA,CAAA;AAAA,KACR;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AA,MACR,YAAc,EAAA,EAAA;AAAA,MACd,UAAU,aAAc,CAAA,QAAA;AAAA,KACzB,CAAA,CAAA;AACD,IAAO,OAAA;AAAA,MACL,EAAA;AAAA,MAAI,IAAA;AAAA,MACJ,KAAA,EAAO,MAAO,CAAA,OAAA,CAAQ,qBAAqB,CAAA,CACxC,MAAO,CAAA,CAAC,GAAK,EAAA,CAAC,GAAK,EAAA,KAAK,CAAM,KAAA;AAC7B,QAAI,GAAA,CAAA,GAAG,CAAI,GAAA,KAAA,CAAM,OAAQ,CAAA,QAAA,CAAA;AACzB,QAAO,OAAA,GAAA,CAAA;AAAA,OACT,EAAG,EAAyC,CAAA;AAAA,KAChD,CAAA;AAAA,GACF;AACA,EAAO,OAAA;AAAA,IACL,EAAA;AAAA,IAAI,IAAA;AAAA,IACJ,KAAO,EAAA;AAAA,MACL,CAAC,EAAE,GAAG,IAAA,CAAK,KAAM,CAAA,EAAA,CAAG,YAAa,CAAA,IAAA,CAAK,OAAQ,CAAA,EAAA,EAAI,cAAc,CAAA,EAAG,OAAO,CAAC,CAAA;AAAA,KAC7E;AAAA,GACF,CAAA;AACF;;;;"}
|
@@ -0,0 +1,2 @@
|
|
1
|
+
import e from"node:fs";import r from"node:path";import{getWorkspaceDir as o}from"@jiek/utils/getWorkspaceDir";import{filterPackagesFromDir as t}from"@pnpm/filter-workspace-packages";import{program as a}from"commander";import{load as s}from"js-yaml";let p="";try{require.resolve("@pnpm/filter-workspace-packages"),p="pnpm"}catch{}async function i(){let i=a.getOptionValue("filter");const n=a.getOptionValue("root"),c=n?r.isAbsolute(n)?n:r.resolve(process.cwd(),n):process.cwd();let l,f=!1;try{l=o(c,p)}catch(e){if(!("message"in e)||"workspace root not found"!==e.message)throw e;l=c,f=!0}if(!f&&"pnpm"===p){const o=r.resolve(l,"pnpm-workspace.yaml"),a=e.readFileSync(o,"utf-8"),p=s(a);if(c===l&&!i)throw new Error("root path is workspace root, please provide a filter");if(c!==l&&!i){if(!e.existsSync(r.resolve(c,"package.json")))throw new Error("root path is not workspace root, please provide a filter");const o=JSON.parse(e.readFileSync(r.resolve(c,"package.json"),"utf-8"));if(!o.name)throw new Error("root path is not workspace root, please provide a filter");i=o.name}const{selectedProjectsGraph:n}=await t(l,[{filter:i??"",followProdDepsOnly:!0}],{prefix:c,workspaceDir:l,patterns:p.packages});return{wd:l,root:c,value:Object.entries(n).reduce(((e,[r,o])=>(e[r]=o.package.manifest,e)),{})}}return{wd:l,root:c,value:{[l]:JSON.parse(e.readFileSync(r.resolve(l,"package.json"),"utf-8"))}}}""!==p&&a.option("-f, --filter <filter>","filter packages");export{i as getSelectedProjectsGraph,p as type};
|
2
|
+
//# sourceMappingURL=filterSupport.esm.min.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"filterSupport.esm.min.js","sources":["../../../src/utils/filterSupport.ts"],"sourcesContent":["import fs from 'node:fs'\nimport path from 'node:path'\n\nimport { getWorkspaceDir } from '@jiek/utils/getWorkspaceDir'\nimport { filterPackagesFromDir } from '@pnpm/filter-workspace-packages'\nimport { program } from 'commander'\nimport { load } from 'js-yaml'\n\nexport let type = ''\n\ntry {\n require.resolve('@pnpm/filter-workspace-packages')\n type = 'pnpm'\n} catch { /* empty */ }\nif (type !== '') {\n program\n .option('-f, --filter <filter>', 'filter packages')\n}\n\ninterface ProjectsGraph {\n wd: string\n root: string\n value?: Record<string, {\n name?: string\n }>\n}\n\nexport async function getSelectedProjectsGraph(): Promise<ProjectsGraph> {\n let filter = program.getOptionValue('filter')\n const rootOption = program.getOptionValue('root')\n const root = rootOption\n ? path.isAbsolute(rootOption)\n ? rootOption\n : path.resolve(process.cwd(), rootOption)\n : process.cwd()\n let notWorkspace = false\n let wd: string\n try {\n wd = getWorkspaceDir(root, type)\n } catch (e) {\n // @ts-ignore\n if ('message' in e && e.message === 'workspace root not found') {\n wd = root\n notWorkspace = true\n } else {\n throw e\n }\n }\n if (!notWorkspace && type === 'pnpm') {\n const pnpmWorkspaceFilePath = path.resolve(wd, 'pnpm-workspace.yaml')\n const pnpmWorkspaceFileContent = fs.readFileSync(pnpmWorkspaceFilePath, 'utf-8')\n const pnpmWorkspace = load(pnpmWorkspaceFileContent) as {\n packages: string[]\n }\n if (root === wd && !filter) {\n throw new Error('root path is workspace root, please provide a filter')\n // TODO inquirer prompt support user select packages\n }\n if (root !== wd && !filter) {\n const packageJSONIsExist = fs.existsSync(path.resolve(root, 'package.json'))\n if (!packageJSONIsExist) {\n throw new Error('root path is not workspace root, please provide a filter')\n }\n const packageJSON = JSON.parse(fs.readFileSync(path.resolve(root, 'package.json'), 'utf-8'))\n if (!packageJSON.name) {\n throw new Error('root path is not workspace root, please provide a filter')\n }\n filter = packageJSON.name\n }\n const { selectedProjectsGraph } = await filterPackagesFromDir(wd, [{\n filter: filter ?? '',\n followProdDepsOnly: true\n }], {\n prefix: root,\n workspaceDir: wd,\n patterns: pnpmWorkspace.packages\n })\n return {\n wd, root,\n value: Object.entries(selectedProjectsGraph)\n .reduce((acc, [key, value]) => {\n acc[key] = value.package.manifest\n return acc\n }, {} as NonNullable<ProjectsGraph['value']>)\n }\n }\n return {\n wd, root,\n value: {\n [wd]: JSON.parse(fs.readFileSync(path.resolve(wd, 'package.json'), 'utf-8'))\n }\n }\n}\n"],"names":["type","require","resolve","async","getSelectedProjectsGraph","filter","program","getOptionValue","rootOption","root","path","isAbsolute","process","cwd","wd","notWorkspace","getWorkspaceDir","e","message","pnpmWorkspaceFilePath","pnpmWorkspaceFileContent","fs","readFileSync","pnpmWorkspace","load","Error","existsSync","packageJSON","JSON","parse","name","selectedProjectsGraph","filterPackagesFromDir","followProdDepsOnly","prefix","workspaceDir","patterns","packages","value","Object","entries","reduce","acc","key","package","manifest","option"],"mappings":"yPAQO,IAAIA,EAAO,GAElB,IACEC,QAAQC,QAAQ,mCACTF,EAAA,MACT,CAAQ,MAAc,CActBG,eAAsBC,IAChB,IAAAC,EAASC,EAAQC,eAAe,UAC9B,MAAAC,EAAaF,EAAQC,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
2
2
|
"name": "jiek",
|
3
|
-
"version": "0.1.
|
3
|
+
"version": "0.1.12-alpha.1",
|
4
4
|
"description": "YiJie's personal kits.",
|
5
5
|
"bin": {
|
6
6
|
"jiek": "bin/jiek.js",
|
@@ -13,7 +13,6 @@
|
|
13
13
|
]
|
14
14
|
},
|
15
15
|
"dependencies": {
|
16
|
-
"@pnpm/filter-workspace-packages": "^7.2.13",
|
17
16
|
"@rollup/plugin-json": "^6.0.1",
|
18
17
|
"@rollup/plugin-terser": "^0.4.4",
|
19
18
|
"autoprefixer": "^10.4.16",
|
@@ -27,9 +26,13 @@
|
|
27
26
|
"@jiek/pkger": "0.1.8",
|
28
27
|
"@jiek/utils": "0.1.6"
|
29
28
|
},
|
29
|
+
"optionalDependencies": {
|
30
|
+
"@pnpm/filter-workspace-packages": "^7.2.13"
|
31
|
+
},
|
30
32
|
"devDependencies": {
|
31
33
|
"@npm/types": "^1.0.2",
|
32
34
|
"@pnpm/workspace.pkgs-graph": "^2.0.15",
|
35
|
+
"@pnpm/filter-workspace-packages": "^7.2.13",
|
33
36
|
"@types/js-yaml": "^4.0.9",
|
34
37
|
"esbuild-register": "^3.5.0"
|
35
38
|
},
|