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.
Files changed (77) hide show
  1. package/dist/index.esm.js +5 -2
  2. package/dist/index.esm.js.map +1 -1
  3. package/dist/index.esm.min.js +1 -1
  4. package/dist/index.esm.min.js.map +1 -1
  5. package/dist/index.iife.js +164 -58
  6. package/dist/index.iife.js.map +1 -1
  7. package/dist/index.iife.min.js +1 -1
  8. package/dist/index.iife.min.js.map +1 -1
  9. package/dist/index.umd.js +166 -60
  10. package/dist/index.umd.js.map +1 -1
  11. package/dist/index.umd.min.js +1 -1
  12. package/dist/index.umd.min.js.map +1 -1
  13. package/dist/package.json.esm.js +58 -0
  14. package/dist/package.json.esm.js.map +1 -0
  15. package/dist/package.json.esm.min.js +2 -0
  16. package/dist/package.json.esm.min.js.map +1 -0
  17. package/dist/rollup/utils/commonOptions.esm.js +1 -0
  18. package/dist/rollup/utils/commonOptions.esm.js.map +1 -1
  19. package/dist/rollup/utils/commonOptions.esm.min.js +1 -1
  20. package/dist/rollup/utils/commonOptions.esm.min.js.map +1 -1
  21. package/dist/rollup.esm.js +14 -8
  22. package/dist/rollup.esm.js.map +1 -1
  23. package/dist/rollup.esm.min.js +1 -1
  24. package/dist/rollup.esm.min.js.map +1 -1
  25. package/dist/rollup.iife.js +23 -10
  26. package/dist/rollup.iife.js.map +1 -1
  27. package/dist/rollup.iife.min.js +1 -1
  28. package/dist/rollup.iife.min.js.map +1 -1
  29. package/dist/rollup.umd.js +25 -12
  30. package/dist/rollup.umd.js.map +1 -1
  31. package/dist/rollup.umd.min.js +1 -1
  32. package/dist/rollup.umd.min.js.map +1 -1
  33. package/dist/src/commands/build.esm.js +53 -0
  34. package/dist/src/commands/build.esm.js.map +1 -0
  35. package/dist/src/commands/build.esm.min.js +2 -0
  36. package/dist/src/commands/build.esm.min.js.map +1 -0
  37. package/dist/src/commands/publish.esm.js +54 -0
  38. package/dist/src/commands/publish.esm.js.map +1 -0
  39. package/dist/src/commands/publish.esm.min.js +2 -0
  40. package/dist/src/commands/publish.esm.min.js.map +1 -0
  41. package/dist/src/inner.esm.js +10 -0
  42. package/dist/src/inner.esm.js.map +1 -0
  43. package/dist/src/inner.esm.min.js +2 -0
  44. package/dist/src/inner.esm.min.js.map +1 -0
  45. package/dist/src/merge-package-json.esm.js +16 -0
  46. package/dist/src/merge-package-json.esm.js.map +1 -0
  47. package/dist/src/merge-package-json.esm.min.js +2 -0
  48. package/dist/src/merge-package-json.esm.min.js.map +1 -0
  49. package/dist/src/rollup/plugins/globals.esm.js +31 -0
  50. package/dist/src/rollup/plugins/globals.esm.js.map +1 -0
  51. package/dist/src/rollup/plugins/globals.esm.min.js +2 -0
  52. package/dist/src/rollup/plugins/globals.esm.min.js.map +1 -0
  53. package/dist/src/rollup/plugins/skip.esm.js +16 -0
  54. package/dist/src/rollup/plugins/skip.esm.js.map +1 -0
  55. package/dist/src/rollup/plugins/skip.esm.min.js +2 -0
  56. package/dist/src/rollup/plugins/skip.esm.min.js.map +1 -0
  57. package/dist/src/rollup/utils/commonOptions.esm.js +10 -0
  58. package/dist/src/rollup/utils/commonOptions.esm.js.map +1 -0
  59. package/dist/src/rollup/utils/commonOptions.esm.min.js +2 -0
  60. package/dist/src/rollup/utils/commonOptions.esm.min.js.map +1 -0
  61. package/dist/src/rollup/utils/externalResolver.esm.js +10 -0
  62. package/dist/src/rollup/utils/externalResolver.esm.js.map +1 -0
  63. package/dist/src/rollup/utils/externalResolver.esm.min.js +2 -0
  64. package/dist/src/rollup/utils/externalResolver.esm.min.js.map +1 -0
  65. package/dist/src/rollup/utils/globalResolver.esm.js +26 -0
  66. package/dist/src/rollup/utils/globalResolver.esm.js.map +1 -0
  67. package/dist/src/rollup/utils/globalResolver.esm.min.js +2 -0
  68. package/dist/src/rollup/utils/globalResolver.esm.min.js.map +1 -0
  69. package/dist/src/rollup/utils/withMinify.esm.js +15 -0
  70. package/dist/src/rollup/utils/withMinify.esm.js.map +1 -0
  71. package/dist/src/rollup/utils/withMinify.esm.min.js +2 -0
  72. package/dist/src/rollup/utils/withMinify.esm.min.js.map +1 -0
  73. package/dist/src/utils/filterSupport.esm.js +78 -0
  74. package/dist/src/utils/filterSupport.esm.js.map +1 -0
  75. package/dist/src/utils/filterSupport.esm.min.js +2 -0
  76. package/dist/src/utils/filterSupport.esm.min.js.map +1 -0
  77. package/package.json +5 -2
package/dist/index.umd.js CHANGED
@@ -1,10 +1,13 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(require('node:fs'), require('node:path'), require('@jiek/utils/bumper'), require('@jiek/utils/getWorkspaceDir'), require('@pnpm/filter-workspace-packages'), require('child_process'), require('commander'), require('@jiek/pkger'), require('node:child_process'), require('js-yaml')) :
3
- typeof define === 'function' && define.amd ? define(['node:fs', 'node:path', '@jiek/utils/bumper', '@jiek/utils/getWorkspaceDir', '@pnpm/filter-workspace-packages', 'child_process', 'commander', '@jiek/pkger', 'node:child_process', 'js-yaml'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.fs, global.path, global.bumper, global.getWorkspaceDir, global.filterWorkspacePackages, global.childProcess, global.commander, global.pkger, global.childProcess$1, global.jsYaml));
5
- })(this, (function (fs, path, bumper, getWorkspaceDir, filterWorkspacePackages, childProcess, commander, pkger, childProcess$1, jsYaml) { 'use strict';
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(require('node:fs'), require('node:path'), require('@jiek/utils/getWorkspaceDir'), require('@pnpm/filter-workspace-packages'), require('commander'), require('js-yaml'), require('@jiek/utils/bumper'), require('child_process'), require('@jiek/pkger'), require('node:child_process')) :
3
+ typeof define === 'function' && define.amd ? define(['node:fs', 'node:path', '@jiek/utils/getWorkspaceDir', '@pnpm/filter-workspace-packages', 'commander', 'js-yaml', '@jiek/utils/bumper', 'child_process', '@jiek/pkger', 'node:child_process'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.fs, global.path, global.getWorkspaceDir, global.filterWorkspacePackages, global.commander, global.jsYaml, global.bumper, global.childProcess, global.pkger, global.childProcess$1));
5
+ })(this, (function (fs, path, getWorkspaceDir, filterWorkspacePackages, commander, jsYaml, bumper, childProcess, pkger, childProcess$1) { 'use strict';
6
6
 
7
- function _interopNamespaceDefault(e) {
7
+ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
8
+
9
+ function _interopNamespace(e) {
10
+ if (e && e.__esModule) return e;
8
11
  var n = Object.create(null);
9
12
  if (e) {
10
13
  Object.keys(e).forEach(function (k) {
@@ -21,8 +24,79 @@
21
24
  return Object.freeze(n);
22
25
  }
23
26
 
24
- var childProcess__namespace = /*#__PURE__*/_interopNamespaceDefault(childProcess);
25
- var childProcess__namespace$1 = /*#__PURE__*/_interopNamespaceDefault(childProcess$1);
27
+ var fs__default = /*#__PURE__*/_interopDefault(fs);
28
+ var path__default = /*#__PURE__*/_interopDefault(path);
29
+ var childProcess__namespace = /*#__PURE__*/_interopNamespace(childProcess);
30
+ var childProcess__namespace$1 = /*#__PURE__*/_interopNamespace(childProcess$1);
31
+
32
+ let type = "";
33
+ try {
34
+ require.resolve("@pnpm/filter-workspace-packages");
35
+ type = "pnpm";
36
+ } catch {
37
+ }
38
+ if (type !== "") {
39
+ commander.program.option("-f, --filter <filter>", "filter packages");
40
+ }
41
+ async function getSelectedProjectsGraph() {
42
+ let filter = commander.program.getOptionValue("filter");
43
+ const rootOption = commander.program.getOptionValue("root");
44
+ const root = rootOption ? path__default.default.isAbsolute(rootOption) ? rootOption : path__default.default.resolve(process.cwd(), rootOption) : process.cwd();
45
+ let notWorkspace = false;
46
+ let wd;
47
+ try {
48
+ wd = getWorkspaceDir.getWorkspaceDir(root, type);
49
+ } catch (e) {
50
+ if ("message" in e && e.message === "workspace root not found") {
51
+ wd = root;
52
+ notWorkspace = true;
53
+ } else {
54
+ throw e;
55
+ }
56
+ }
57
+ if (!notWorkspace && type === "pnpm") {
58
+ const pnpmWorkspaceFilePath = path__default.default.resolve(wd, "pnpm-workspace.yaml");
59
+ const pnpmWorkspaceFileContent = fs__default.default.readFileSync(pnpmWorkspaceFilePath, "utf-8");
60
+ const pnpmWorkspace = jsYaml.load(pnpmWorkspaceFileContent);
61
+ if (root === wd && !filter) {
62
+ throw new Error("root path is workspace root, please provide a filter");
63
+ }
64
+ if (root !== wd && !filter) {
65
+ const packageJSONIsExist = fs__default.default.existsSync(path__default.default.resolve(root, "package.json"));
66
+ if (!packageJSONIsExist) {
67
+ throw new Error("root path is not workspace root, please provide a filter");
68
+ }
69
+ const packageJSON = JSON.parse(fs__default.default.readFileSync(path__default.default.resolve(root, "package.json"), "utf-8"));
70
+ if (!packageJSON.name) {
71
+ throw new Error("root path is not workspace root, please provide a filter");
72
+ }
73
+ filter = packageJSON.name;
74
+ }
75
+ const { selectedProjectsGraph } = await filterWorkspacePackages.filterPackagesFromDir(wd, [{
76
+ filter: filter ?? "",
77
+ followProdDepsOnly: true
78
+ }], {
79
+ prefix: root,
80
+ workspaceDir: wd,
81
+ patterns: pnpmWorkspace.packages
82
+ });
83
+ return {
84
+ wd,
85
+ root,
86
+ value: Object.entries(selectedProjectsGraph).reduce((acc, [key, value]) => {
87
+ acc[key] = value.package.manifest;
88
+ return acc;
89
+ }, {})
90
+ };
91
+ }
92
+ return {
93
+ wd,
94
+ root,
95
+ value: {
96
+ [wd]: JSON.parse(fs__default.default.readFileSync(path__default.default.resolve(wd, "package.json"), "utf-8"))
97
+ }
98
+ };
99
+ }
26
100
 
27
101
  let resolve;
28
102
  function actionDone() {
@@ -44,28 +118,23 @@
44
118
  };
45
119
  }
46
120
 
47
- commander.program.command("publish").aliases(["pub", "p"]).option("--filter <filter>", "filter packages").option("--root <root>", "root path").option("--bumper <bumper>", "bump version", "patch").action(async ({ root: rootOption, filter, bumper: bumper$1, ...options }) => {
121
+ commander.program.command("publish").aliases(["pub", "p"]).option("--bumper <bumper>", "bump version", "patch").action(async ({ bumper: bumper$1, ...options }) => {
48
122
  actionRestore();
49
- const root = rootOption ? path.isAbsolute(rootOption) ? rootOption : path.resolve(process.cwd(), rootOption) : process.cwd();
50
- const wd = getWorkspaceDir.getWorkspaceDir(root);
51
- const { selectedProjectsGraph } = await filterWorkspacePackages.filterPackagesFromDir(wd, [{
52
- filter: filter ?? "",
53
- followProdDepsOnly: true
54
- }], {
55
- prefix: root,
56
- workspaceDir: wd,
57
- patterns: ["packages/*"]
58
- });
123
+ const { value = {} } = await getSelectedProjectsGraph() ?? {};
124
+ const selectedProjectsGraphEntries = Object.entries(value);
125
+ if (selectedProjectsGraphEntries.length === 0) {
126
+ throw new Error("no packages selected");
127
+ }
59
128
  const mainfests = [];
60
- Object.entries(selectedProjectsGraph).forEach(([, { package: { dir, manifest } }]) => {
129
+ selectedProjectsGraphEntries.forEach(([dir, manifest]) => {
61
130
  mainfests.push([
62
131
  dir,
63
132
  mergePackageJson(manifest, dir)
64
133
  ]);
65
134
  });
66
- const passArgs = Object.entries(options).reduce((acc, [key, value]) => {
67
- if (value) {
68
- acc.push(`--${key}`, value);
135
+ const passArgs = Object.entries(options).reduce((acc, [key, value2]) => {
136
+ if (value2) {
137
+ acc.push(`--${key}`, value2);
69
138
  }
70
139
  return acc;
71
140
  }, []);
@@ -75,20 +144,20 @@
75
144
  ...m,
76
145
  version: newVersion
77
146
  };
78
- fs.renameSync(path.join(dir, "package.json"), path.join(dir, "package.json.bak"));
79
- fs.writeFileSync(path.join(dir, "package.json"), JSON.stringify(newManifest, null, 2));
147
+ fs__default.default.renameSync(path__default.default.join(dir, "package.json"), path__default.default.join(dir, "package.json.bak"));
148
+ fs__default.default.writeFileSync(path__default.default.join(dir, "package.json"), JSON.stringify(newManifest, null, 2));
80
149
  console.log(newManifest);
81
150
  try {
82
151
  childProcess__namespace.execSync(["pnpm", "publish", "--access", "public", "--no-git-checks", ...passArgs].join(" "), {
83
152
  cwd: dir,
84
153
  stdio: "inherit"
85
154
  });
86
- const oldPackageJson = JSON.parse(fs.readFileSync(path.join(dir, "package.json.bak"), "utf-8"));
155
+ const oldPackageJson = JSON.parse(fs__default.default.readFileSync(path__default.default.join(dir, "package.json.bak"), "utf-8"));
87
156
  oldPackageJson.version = newVersion;
88
- fs.writeFileSync(path.join(dir, "package.json.bak"), JSON.stringify(oldPackageJson, null, 2));
157
+ fs__default.default.writeFileSync(path__default.default.join(dir, "package.json.bak"), JSON.stringify(oldPackageJson, null, 2));
89
158
  } finally {
90
- fs.unlinkSync(path.join(dir, "package.json"));
91
- fs.renameSync(path.join(dir, "package.json.bak"), path.join(dir, "package.json"));
159
+ fs__default.default.unlinkSync(path__default.default.join(dir, "package.json"));
160
+ fs__default.default.renameSync(path__default.default.join(dir, "package.json.bak"), path__default.default.join(dir, "package.json"));
92
161
  }
93
162
  }
94
163
  actionDone();
@@ -104,47 +173,27 @@ const templateArg = jiek.templateArgFilePath
104
173
  }
105
174
  module.exports = require('${process.env.NODE_ENV === "test" ? "jiek/src/rollup/index.ts" : "jiek/rollup"}').template(templateArg, pkg)
106
175
  `.trimStart();
107
- commander.program.command("build").option("--filter <filter>", "filter packages").option("--root <root>", "root path").action(async ({ root: rootOption, filter, ...options }) => {
176
+ commander.program.command("build").action(async () => {
108
177
  actionRestore();
109
- const root = rootOption ? path.isAbsolute(rootOption) ? rootOption : path.resolve(process.cwd(), rootOption) : process.cwd();
110
- const wd = getWorkspaceDir.getWorkspaceDir(root);
111
- const pnpmWorkspaceFilePath = path.resolve(wd, "pnpm-workspace.yaml");
112
- const pnpmWorkspaceFileContent = fs.readFileSync(pnpmWorkspaceFilePath, "utf-8");
113
- const pnpmWorkspace = jsYaml.load(pnpmWorkspaceFileContent);
114
- if (root === wd && !filter) {
115
- throw new Error("root path is workspace root, please provide a filter");
116
- }
117
- if (root !== wd && !filter) {
118
- const packageJSONIsExist = fs.existsSync(path.resolve(root, "package.json"));
119
- if (!packageJSONIsExist) {
120
- throw new Error("root path is not workspace root, please provide a filter");
121
- }
122
- const packageJSON = JSON.parse(fs.readFileSync(path.resolve(root, "package.json"), "utf-8"));
123
- if (!packageJSON.name) {
124
- throw new Error("root path is not workspace root, please provide a filter");
125
- }
126
- filter = packageJSON.name;
178
+ const {
179
+ wd,
180
+ value = {}
181
+ } = await getSelectedProjectsGraph() ?? {};
182
+ if (Object.keys(value).length === 0) {
183
+ throw new Error("no package found");
127
184
  }
128
- const { selectedProjectsGraph } = await filterWorkspacePackages.filterPackagesFromDir(wd, [{
129
- filter: filter ?? "",
130
- followProdDepsOnly: true
131
- }], {
132
- prefix: root,
133
- workspaceDir: wd,
134
- patterns: pnpmWorkspace.packages
135
- });
136
- const jiekTempDir = (...paths) => path.resolve(wd, "node_modules/.jiek", ...paths);
137
- if (!fs.existsSync(jiekTempDir()))
138
- fs.mkdirSync(jiekTempDir());
185
+ const jiekTempDir = (...paths) => path__default.default.resolve(wd, "node_modules/.jiek", ...paths);
186
+ if (!fs__default.default.existsSync(jiekTempDir()))
187
+ fs__default.default.mkdirSync(jiekTempDir());
139
188
  const rollupBinaryPath = require.resolve("rollup").replace(/dist\/rollup.js$/, "dist/bin/rollup");
140
189
  let i = 0;
141
- for (const [dir, { package: { manifest } }] of Object.entries(selectedProjectsGraph)) {
190
+ for (const [dir, manifest] of Object.entries(value)) {
142
191
  const newManifest = mergePackageJson(manifest, dir);
143
192
  const escapeManifestName = manifest.name?.replace(/^@/g, "").replace(/\//g, "+");
144
193
  const configFile = jiekTempDir(
145
194
  `${escapeManifestName ?? `anonymous-${i++}`}.rollup.config.js`
146
195
  );
147
- fs.writeFileSync(configFile, FILE_TEMPLATE(newManifest));
196
+ fs__default.default.writeFileSync(configFile, FILE_TEMPLATE(newManifest));
148
197
  let prefix = "";
149
198
  if (process.env.NODE_ENV === "test") {
150
199
  const registerPath = require.resolve("esbuild-register");
@@ -159,6 +208,63 @@ module.exports = require('${process.env.NODE_ENV === "test" ? "jiek/src/rollup/i
159
208
  actionDone();
160
209
  });
161
210
 
211
+ var name = "jiek";
212
+ var version = "0.1.12";
213
+ var description = "YiJie's personal kits.";
214
+ var bin = {
215
+ jiek: "bin/jiek.js",
216
+ "jiek-dev": "bin/jiek-dev.js"
217
+ };
218
+ var jiek = {
219
+ inputs: [
220
+ "index.ts",
221
+ "rollup/index.ts"
222
+ ]
223
+ };
224
+ var scripts = {
225
+ build: "jiek-dev build"
226
+ };
227
+ var dependencies = {
228
+ "@jiek/pkger": "workspace:^*",
229
+ "@jiek/utils": "workspace:^*",
230
+ "@rollup/plugin-json": "^6.0.1",
231
+ "@rollup/plugin-terser": "^0.4.4",
232
+ autoprefixer: "^10.4.16",
233
+ commander: "^12.0.0",
234
+ "js-yaml": "^4.1.0",
235
+ rollup: "^4.1.5",
236
+ "rollup-plugin-copy": "^3.5.0",
237
+ "rollup-plugin-dts": "^6.1.0",
238
+ "rollup-plugin-esbuild": "^6.1.0",
239
+ "rollup-plugin-postcss": "^4.0.2"
240
+ };
241
+ var optionalDependencies = {
242
+ "@pnpm/filter-workspace-packages": "^7.2.13"
243
+ };
244
+ var devDependencies = {
245
+ "@npm/types": "^1.0.2",
246
+ "@pnpm/workspace.pkgs-graph": "^2.0.15",
247
+ "@pnpm/filter-workspace-packages": "^7.2.13",
248
+ "@types/js-yaml": "^4.0.9",
249
+ "esbuild-register": "^3.5.0"
250
+ };
251
+ var files = [
252
+ "dist"
253
+ ];
254
+ var pkg = {
255
+ name: name,
256
+ version: version,
257
+ description: description,
258
+ bin: bin,
259
+ jiek: jiek,
260
+ scripts: scripts,
261
+ dependencies: dependencies,
262
+ optionalDependencies: optionalDependencies,
263
+ devDependencies: devDependencies,
264
+ files: files
265
+ };
266
+
267
+ commander.program.version(pkg.version).description(pkg.description).option("--root <root>", "root path");
162
268
  commander.program.parse(process.argv);
163
269
 
164
270
  }));
@@ -1 +1 @@
1
- {"version":3,"file":"index.umd.js","sources":["../src/inner.ts","../src/merge-package-json.ts","../src/commands/publish.ts","../src/commands/build.ts","../src/index.ts"],"sourcesContent":["let resolve: () => void\n\nexport let actionFuture: Promise<void>\n\nexport function actionDone() {\n resolve()\n}\n\nexport function actionRestore() {\n actionFuture = new Promise<void>(r => resolve = r)\n}\n","import { type Options, pkger } from '@jiek/pkger'\nimport type { PackageJson } from '@npm/types'\nimport type { Manifest } from '@pnpm/workspace.pkgs-graph'\n\nexport function mergePackageJson(manifest: Manifest & {\n jiek?: Options\n exports?: unknown | unknown[]\n}, cwd: string) {\n const {\n jiek: { inputs: jiekInputs, cwd: _, ...jiek } = {}, exports\n } = manifest\n const inputs = jiekInputs ?? (\n Array.isArray(exports) ? exports : undefined\n )\n return {\n ...manifest,\n ...pkger({ inputs, cwd, ...jiek })\n } as PackageJson\n}\n","import fs from 'node:fs'\nimport path from 'node:path'\n\nimport { bump, type BumperType } from '@jiek/utils/bumper'\nimport { getWorkspaceDir } from '@jiek/utils/getWorkspaceDir'\nimport type { PackageJson } from '@npm/types'\nimport { filterPackagesFromDir } from '@pnpm/filter-workspace-packages'\nimport * as childProcess from 'child_process'\nimport { program } from 'commander'\n\nimport { actionDone, actionRestore } from '../inner'\nimport { mergePackageJson } from '../merge-package-json'\n\nprogram\n .command('publish')\n .aliases(['pub', 'p'])\n .option('--filter <filter>', 'filter packages')\n .option('--root <root>', 'root path')\n .option('--bumper <bumper>', 'bump version', 'patch')\n .action(async ({ root: rootOption, filter, bumper, ...options }: {\n root?: string\n filter?: string\n bumper: BumperType\n }) => {\n actionRestore()\n const root = rootOption\n ? path.isAbsolute(rootOption)\n ? rootOption\n : path.resolve(process.cwd(), rootOption)\n : process.cwd()\n const wd = getWorkspaceDir(root)\n const { selectedProjectsGraph } = await filterPackagesFromDir(wd, [{\n filter: filter ?? '',\n followProdDepsOnly: true\n }], {\n prefix: root,\n workspaceDir: wd,\n patterns: ['packages/*']\n })\n const mainfests: [dir: string, PackageJson][] = []\n Object\n .entries(selectedProjectsGraph)\n .forEach(([, { package: { dir, manifest } }]) => {\n mainfests.push([\n dir, mergePackageJson(manifest, dir)\n ])\n })\n const passArgs = Object\n .entries(options)\n .reduce((acc, [key, value]) => {\n if (value) {\n acc.push(`--${key}`, value as string)\n }\n return acc\n }, [] as string[])\n for (const [dir, m] of mainfests) {\n const newVersion = bump(m.version, bumper)\n const newManifest = {\n ...m,\n version: newVersion\n }\n fs.renameSync(path.join(dir, 'package.json'), path.join(dir, 'package.json.bak'))\n fs.writeFileSync(path.join(dir, 'package.json'), JSON.stringify(newManifest, null, 2))\n console.log(newManifest)\n try {\n childProcess.execSync(['pnpm', 'publish', '--access', 'public', '--no-git-checks', ...passArgs].join(' '), {\n cwd: dir,\n stdio: 'inherit'\n })\n const oldPackageJson = JSON.parse(fs.readFileSync(path.join(dir, 'package.json.bak'), 'utf-8'))\n oldPackageJson.version = newVersion\n fs.writeFileSync(path.join(dir, 'package.json.bak'), JSON.stringify(oldPackageJson, null, 2))\n } finally {\n fs.unlinkSync(path.join(dir, 'package.json'))\n fs.renameSync(path.join(dir, 'package.json.bak'), path.join(dir, 'package.json'))\n }\n }\n actionDone()\n })\n","import * as childProcess from 'node:child_process'\nimport 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\nimport { actionDone, actionRestore } from '../inner'\nimport { mergePackageJson } from '../merge-package-json'\n\nconst FILE_TEMPLATE = (manifest: unknown) => `\nconst pkg = ${JSON.stringify(manifest, null, 2)}\nconst { jiek = {} } = pkg\nconst templateArg = jiek.templateArgFilePath\n ? require.resolve(jiek.templateArgFilePath)\n : {\n styled: jiek.styled\n }\nmodule.exports = require('${\n process.env.NODE_ENV === 'test'\n ? 'jiek/src/rollup/index.ts'\n : 'jiek/rollup'\n}').template(templateArg, pkg)\n`.trimStart()\n\nprogram\n .command('build')\n .option('--filter <filter>', 'filter packages')\n .option('--root <root>', 'root path')\n .action(async ({ root: rootOption, filter, ...options }: {\n root?: string\n filter?: string\n }) => {\n actionRestore()\n const root = rootOption\n ? path.isAbsolute(rootOption)\n ? rootOption\n : path.resolve(process.cwd(), rootOption)\n : process.cwd()\n const wd = getWorkspaceDir(root)\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 const jiekTempDir = (...paths: string[]) => path.resolve(wd, 'node_modules/.jiek', ...paths)\n if (!fs.existsSync(jiekTempDir())) fs.mkdirSync(jiekTempDir())\n\n const rollupBinaryPath = require.resolve('rollup')\n .replace(/dist\\/rollup.js$/, 'dist/bin/rollup')\n let i = 0\n for (const [dir, { package: { manifest } }] of Object.entries(selectedProjectsGraph)) {\n const newManifest = mergePackageJson(manifest, dir)\n // TODO support auto build child packages in workspaces\n const escapeManifestName = manifest.name?.replace(/^@/g, '').replace(/\\//g, '+')\n const configFile = jiekTempDir(\n `${escapeManifestName ?? `anonymous-${i++}`}.rollup.config.js`\n )\n fs.writeFileSync(configFile, FILE_TEMPLATE(newManifest))\n let prefix = ''\n if (process.env.NODE_ENV === 'test') {\n const registerPath = require.resolve('esbuild-register')\n const loaderPath = require.resolve('esbuild-register/loader')\n prefix = `node --import ${registerPath} -r ${loaderPath} `\n }\n // TODO replace with `spawn` to support watch mode\n childProcess.execSync(`${prefix}${rollupBinaryPath} -c ${configFile}`, {\n cwd: dir, stdio: 'inherit'\n })\n }\n\n actionDone()\n })\n","import './commands/publish'\nimport './commands/build'\n\nimport { program } from 'commander'\n\nprogram.parse(process.argv)\n"],"names":["pkger","program","bumper","getWorkspaceDir","filterPackagesFromDir","bump","childProcess","load"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;EAAA,IAAI,OAAA,CAAA;EAIG,SAAS,UAAa,GAAA;EAC3B,EAAQ,OAAA,EAAA,CAAA;EACV,CAAA;EAEO,SAAS,aAAgB,GAAA;EAC9B,EAAe,IAAI,OAAA,CAAc,CAAK,CAAA,KAAA,OAAA,GAAU,CAAC,CAAA,CAAA;EACnD;;ECNgB,SAAA,gBAAA,CAAiB,UAG9B,GAAa,EAAA;EACd,EAAM,MAAA;EAAA,IACJ,IAAA,EAAM,EAAE,MAAQ,EAAA,UAAA,EAAY,KAAK,CAAG,EAAA,GAAG,IAAK,EAAA,GAAI,EAAC;EAAA,IAAG,OAAA;EAAA,GAClD,GAAA,QAAA,CAAA;EACJ,EAAA,MAAM,SAAS,UACb,KAAA,KAAA,CAAM,OAAQ,CAAA,OAAO,IAAI,OAAU,GAAA,KAAA,CAAA,CAAA,CAAA;EAErC,EAAO,OAAA;EAAA,IACL,GAAG,QAAA;EAAA,IACH,GAAGA,WAAM,CAAA,EAAE,QAAQ,GAAK,EAAA,GAAG,MAAM,CAAA;EAAA,GACnC,CAAA;EACF;;ACLAC,mBAAA,CACG,OAAQ,CAAA,SAAS,CACjB,CAAA,OAAA,CAAQ,CAAC,KAAA,EAAO,GAAG,CAAC,CACpB,CAAA,MAAA,CAAO,mBAAqB,EAAA,iBAAiB,EAC7C,MAAO,CAAA,eAAA,EAAiB,WAAW,CAAA,CACnC,MAAO,CAAA,mBAAA,EAAqB,cAAgB,EAAA,OAAO,EACnD,MAAO,CAAA,OAAO,EAAE,IAAA,EAAM,UAAY,EAAA,MAAA,UAAQC,QAAQ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AAY,CAAA,IAAA,EAAO,UAAU,CAAA,CAAA,CAAA,CAAA;EAAA,KACzD;EAEA,IAAAE,yBAAA,CAAa,SAAS,CAAG,EAAA,MAAM,GAAG,gBAAgB,CAAA,IAAA,EAAO,UAAU,CAAI,CAAA,EAAA;EAAA,MACrE,GAAK,EAAA,GAAA;EAAA,MAAK,KAAO,EAAA,SAAA;EAAA,KAClB,CAAA,CAAA;EAAA,GACH;EAEA,EAAW,UAAA,EAAA,CAAA;EACb,CAAC,CAAA;;AC5FHL,mBAAQ,CAAA,KAAA,CAAM,QAAQ,IAAI,CAAA;;;;;;"}
1
+ {"version":3,"file":"index.umd.js","sources":["../src/utils/filterSupport.ts","../src/inner.ts","../src/merge-package-json.ts","../src/commands/publish.ts","../src/commands/build.ts","../src/index.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","let resolve: () => void\n\nexport let actionFuture: Promise<void>\n\nexport function actionDone() {\n resolve()\n}\n\nexport function actionRestore() {\n actionFuture = new Promise<void>(r => resolve = r)\n}\n","import { type Options, pkger } from '@jiek/pkger'\nimport type { PackageJson } from '@npm/types'\nimport type { Manifest } from '@pnpm/workspace.pkgs-graph'\n\nexport function mergePackageJson(manifest: Manifest & {\n jiek?: Options\n exports?: unknown | unknown[]\n}, cwd: string) {\n const {\n jiek: { inputs: jiekInputs, cwd: _, ...jiek } = {}, exports\n } = manifest\n const inputs = jiekInputs ?? (\n Array.isArray(exports) ? exports : undefined\n )\n return {\n ...manifest,\n ...pkger({ inputs, cwd, ...jiek })\n } as PackageJson\n}\n","import fs from 'node:fs'\nimport path from 'node:path'\n\nimport { bump, type BumperType } from '@jiek/utils/bumper'\nimport type { PackageJson } from '@npm/types'\nimport * as childProcess from 'child_process'\nimport { program } from 'commander'\n\nimport { actionDone, actionRestore } from '../inner'\nimport { mergePackageJson } from '../merge-package-json'\nimport { getSelectedProjectsGraph } from '../utils/filterSupport'\n\nprogram\n .command('publish')\n .aliases(['pub', 'p'])\n .option('--bumper <bumper>', 'bump version', 'patch')\n .action(async ({ bumper, ...options }: {\n root?: string\n filter?: string\n bumper: BumperType\n }) => {\n actionRestore()\n\n const { value = {} } = await getSelectedProjectsGraph() ?? {}\n const selectedProjectsGraphEntries = Object.entries(value)\n if (selectedProjectsGraphEntries.length === 0) {\n throw new Error('no packages selected')\n }\n const mainfests: [dir: string, PackageJson][] = []\n selectedProjectsGraphEntries\n .forEach(([dir, manifest]) => {\n mainfests.push([\n dir, mergePackageJson(manifest, dir)\n ])\n })\n const passArgs = Object\n .entries(options)\n .reduce((acc, [key, value]) => {\n if (value) {\n acc.push(`--${key}`, value as string)\n }\n return acc\n }, [] as string[])\n for (const [dir, m] of mainfests) {\n const newVersion = bump(m.version, bumper)\n const newManifest = {\n ...m,\n version: newVersion\n }\n fs.renameSync(path.join(dir, 'package.json'), path.join(dir, 'package.json.bak'))\n fs.writeFileSync(path.join(dir, 'package.json'), JSON.stringify(newManifest, null, 2))\n console.log(newManifest)\n try {\n childProcess.execSync(['pnpm', 'publish', '--access', 'public', '--no-git-checks', ...passArgs].join(' '), {\n cwd: dir,\n stdio: 'inherit'\n })\n const oldPackageJson = JSON.parse(fs.readFileSync(path.join(dir, 'package.json.bak'), 'utf-8'))\n oldPackageJson.version = newVersion\n fs.writeFileSync(path.join(dir, 'package.json.bak'), JSON.stringify(oldPackageJson, null, 2))\n } finally {\n fs.unlinkSync(path.join(dir, 'package.json'))\n fs.renameSync(path.join(dir, 'package.json.bak'), path.join(dir, 'package.json'))\n }\n }\n actionDone()\n })\n","import * as childProcess from 'node:child_process'\nimport fs from 'node:fs'\nimport path from 'node:path'\n\nimport { program } from 'commander'\n\nimport { actionDone, actionRestore } from '../inner'\nimport { mergePackageJson } from '../merge-package-json'\nimport { getSelectedProjectsGraph } from '../utils/filterSupport'\n\nconst FILE_TEMPLATE = (manifest: unknown) => `\nconst pkg = ${JSON.stringify(manifest, null, 2)}\nconst { jiek = {} } = pkg\nconst templateArg = jiek.templateArgFilePath\n ? require.resolve(jiek.templateArgFilePath)\n : {\n styled: jiek.styled\n }\nmodule.exports = require('${\n process.env.NODE_ENV === 'test'\n ? 'jiek/src/rollup/index.ts'\n : 'jiek/rollup'\n}').template(templateArg, pkg)\n`.trimStart()\n\nprogram\n .command('build')\n .action(async () => {\n actionRestore()\n const {\n wd, value = {}\n } = await getSelectedProjectsGraph() ?? {}\n\n if (Object.keys(value).length === 0) {\n throw new Error('no package found')\n }\n const jiekTempDir = (...paths: string[]) => path.resolve(wd, 'node_modules/.jiek', ...paths)\n if (!fs.existsSync(jiekTempDir())) fs.mkdirSync(jiekTempDir())\n\n const rollupBinaryPath = require.resolve('rollup')\n .replace(/dist\\/rollup.js$/, 'dist/bin/rollup')\n let i = 0\n for (const [dir, manifest] of Object.entries(value)) {\n const newManifest = mergePackageJson(manifest, dir)\n // TODO support auto build child packages in workspaces\n const escapeManifestName = manifest.name?.replace(/^@/g, '').replace(/\\//g, '+')\n const configFile = jiekTempDir(\n `${escapeManifestName ?? `anonymous-${i++}`}.rollup.config.js`\n )\n fs.writeFileSync(configFile, FILE_TEMPLATE(newManifest))\n let prefix = ''\n if (process.env.NODE_ENV === 'test') {\n const registerPath = require.resolve('esbuild-register')\n const loaderPath = require.resolve('esbuild-register/loader')\n prefix = `node --import ${registerPath} -r ${loaderPath} `\n }\n // TODO replace with `spawn` to support watch mode\n childProcess.execSync(`${prefix}${rollupBinaryPath} -c ${configFile}`, {\n cwd: dir, stdio: 'inherit'\n })\n }\n\n actionDone()\n })\n","import './utils/filterSupport'\nimport './commands/publish'\nimport './commands/build'\n\nimport { program } from 'commander'\n\nimport pkg from '../package.json'\n\nprogram\n .version(pkg.version)\n .description(pkg.description)\n .option('--root <root>', 'root path')\n\nprogram.parse(process.argv)\n"],"names":["program","path","getWorkspaceDir","fs","load","filterPackagesFromDir","pkger","bumper","value","bump","childProcess"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAQO,IAAI,IAAO,GAAA,EAAA,CAAA;EAElB,IAAI;EACF,EAAA,OAAA,CAAQ,QAAQ,iCAAiC,CAAA,CAAA;EACjD,EAAO,IAAA,GAAA,MAAA,CAAA;EACT,CAAQ,CAAA,MAAA;EAAc,CAAA;EACtB,IAAI,SAAS,EAAI,EAAA;EACf,EACGA,iBAAA,CAAA,MAAA,CAAO,yBAAyB,iBAAiB,CAAA,CAAA;EACtD,CAAA;EAUA,eAAsB,wBAAmD,GAAA;EACvE,EAAI,IAAA,MAAA,GAASA,iBAAQ,CAAA,cAAA,CAAe,QAAQ,CAAA,CAAA;EAC5C,EAAM,MAAA,UAAA,GAAaA,iBAAQ,CAAA,cAAA,CAAe,MAAM,CAAA,CAAA;EAChD,EAAA,MAAM,IAAO,GAAA,UAAA,GACTC,qBAAK,CAAA,UAAA,CAAW,UAAU,CACxB,GAAA,UAAA,GACAA,qBAAK,CAAA,OAAA,CAAQ,QAAQ,GAAI,EAAA,EAAG,UAAU,CAAA,GACxC,QAAQ,GAAI,EAAA,CAAA;EAChB,EAAA,IAAI,YAAe,GAAA,KAAA,CAAA;EACnB,EAAI,IAAA,EAAA,CAAA;EACJ,EAAI,IAAA;EACF,IAAK,EAAA,GAAAC,+BAAA,CAAgB,MAAM,IAAI,CAAA,CAAA;EAAA,WACxB,CAAG,EAAA;EAEV,IAAA,IAAI,SAAa,IAAA,CAAA,IAAK,CAAE,CAAA,OAAA,KAAY,0BAA4B,EAAA;EAC9D,MAAK,EAAA,GAAA,IAAA,CAAA;EACL,MAAe,YAAA,GAAA,IAAA,CAAA;EAAA,KACV,MAAA;EACL,MAAM,MAAA,CAAA,CAAA;EAAA,KACR;EAAA,GACF;EACA,EAA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AAU,CAAI,CAAA,EAAA;EAAA,MACrE,GAAK,EAAA,GAAA;EAAA,MAAK,KAAO,EAAA,SAAA;EAAA,KAClB,CAAA,CAAA;EAAA,GACH;EAEA,EAAW,UAAA,EAAA,CAAA;EACb,CAAC,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACvDHV,mBACG,CAAA,OAAA,CAAQ,GAAI,CAAA,OAAO,CACnB,CAAA,WAAA,CAAY,IAAI,WAAW,CAAA,CAC3B,MAAO,CAAA,eAAA,EAAiB,WAAW,CAAA,CAAA;AAEtCA,mBAAQ,CAAA,KAAA,CAAM,QAAQ,IAAI,CAAA;;;;;;"}
@@ -1,2 +1,2 @@
1
- !function(e,r){"object"==typeof exports&&"undefined"!=typeof module?r(require("node:fs"),require("node:path"),require("@jiek/utils/bumper"),require("@jiek/utils/getWorkspaceDir"),require("@pnpm/filter-workspace-packages"),require("child_process"),require("commander"),require("@jiek/pkger"),require("node:child_process"),require("js-yaml")):"function"==typeof define&&define.amd?define(["node:fs","node:path","@jiek/utils/bumper","@jiek/utils/getWorkspaceDir","@pnpm/filter-workspace-packages","child_process","commander","@jiek/pkger","node:child_process","js-yaml"],r):r((e="undefined"!=typeof globalThis?globalThis:e||self).fs,e.path,e.bumper,e.getWorkspaceDir,e.filterWorkspacePackages,e.childProcess,e.commander,e.pkger,e.childProcess$1,e.jsYaml)}(this,(function(e,r,o,t,i,s,n,a,c,p){"use strict";function l(e){var r=Object.create(null);return e&&Object.keys(e).forEach((function(o){if("default"!==o){var t=Object.getOwnPropertyDescriptor(e,o);Object.defineProperty(r,o,t.get?t:{enumerable:!0,get:function(){return e[o]}})}})),r.default=e,Object.freeze(r)}var u=l(s),f=l(c);let d;function k(){d()}function g(){new Promise((e=>d=e))}function m(e,r){const{jiek:{inputs:o,cwd:t,...i}={},exports:s}=e,n=o??(Array.isArray(s)?s:void 0);return{...e,...a.pkger({inputs:n,cwd:r,...i})}}n.program.command("publish").aliases(["pub","p"]).option("--filter <filter>","filter packages").option("--root <root>","root path").option("--bumper <bumper>","bump version","patch").action((async({root:s,filter:n,bumper:a,...c})=>{g();const p=s?r.isAbsolute(s)?s:r.resolve(process.cwd(),s):process.cwd(),l=t.getWorkspaceDir(p),{selectedProjectsGraph:f}=await i.filterPackagesFromDir(l,[{filter:n??"",followProdDepsOnly:!0}],{prefix:p,workspaceDir:l,patterns:["packages/*"]}),d=[];Object.entries(f).forEach((([,{package:{dir:e,manifest:r}}])=>{d.push([e,m(r,e)])}));const j=Object.entries(c).reduce(((e,[r,o])=>(o&&e.push(`--${r}`,o),e)),[]);for(const[t,i]of d){const s=o.bump(i.version,a),n={...i,version:s};e.renameSync(r.join(t,"package.json"),r.join(t,"package.json.bak")),e.writeFileSync(r.join(t,"package.json"),JSON.stringify(n,null,2)),console.log(n);try{u.execSync(["pnpm","publish","--access","public","--no-git-checks",...j].join(" "),{cwd:t,stdio:"inherit"});const o=JSON.parse(e.readFileSync(r.join(t,"package.json.bak"),"utf-8"));o.version=s,e.writeFileSync(r.join(t,"package.json.bak"),JSON.stringify(o,null,2))}finally{e.unlinkSync(r.join(t,"package.json")),e.renameSync(r.join(t,"package.json.bak"),r.join(t,"package.json"))}}k()}));const j=e=>`\nconst pkg = ${JSON.stringify(e,null,2)}\nconst { jiek = {} } = pkg\nconst templateArg = jiek.templateArgFilePath\n ? require.resolve(jiek.templateArgFilePath)\n : {\n styled: jiek.styled\n }\nmodule.exports = require('${"test"===process.env.NODE_ENV?"jiek/src/rollup/index.ts":"jiek/rollup"}').template(templateArg, pkg)\n`.trimStart();n.program.command("build").option("--filter <filter>","filter packages").option("--root <root>","root path").action((async({root:o,filter:s,...n})=>{g();const a=o?r.isAbsolute(o)?o:r.resolve(process.cwd(),o):process.cwd(),c=t.getWorkspaceDir(a),l=r.resolve(c,"pnpm-workspace.yaml"),u=e.readFileSync(l,"utf-8"),d=p.load(u);if(a===c&&!s)throw new Error("root path is workspace root, please provide a filter");if(a!==c&&!s){if(!e.existsSync(r.resolve(a,"package.json")))throw new Error("root path is not workspace root, please provide a filter");const o=JSON.parse(e.readFileSync(r.resolve(a,"package.json"),"utf-8"));if(!o.name)throw new Error("root path is not workspace root, please provide a filter");s=o.name}const{selectedProjectsGraph:y}=await i.filterPackagesFromDir(c,[{filter:s??"",followProdDepsOnly:!0}],{prefix:a,workspaceDir:c,patterns:d.packages}),b=(...e)=>r.resolve(c,"node_modules/.jiek",...e);e.existsSync(b())||e.mkdirSync(b());const h=require.resolve("rollup").replace(/dist\/rollup.js$/,"dist/bin/rollup");let w=0;for(const[r,{package:{manifest:o}}]of Object.entries(y)){const t=m(o,r),i=o.name?.replace(/^@/g,"").replace(/\//g,"+"),s=b(`${i??"anonymous-"+w++}.rollup.config.js`);e.writeFileSync(s,j(t));let n="";if("test"===process.env.NODE_ENV){n=`node --import ${require.resolve("esbuild-register")} -r ${require.resolve("esbuild-register/loader")} `}f.execSync(`${n}${h} -c ${s}`,{cwd:r,stdio:"inherit"})}k()})),n.program.parse(process.argv)}));
1
+ !function(e,r){"object"==typeof exports&&"undefined"!=typeof module?r(require("node:fs"),require("node:path"),require("@jiek/utils/getWorkspaceDir"),require("@pnpm/filter-workspace-packages"),require("commander"),require("js-yaml"),require("@jiek/utils/bumper"),require("child_process"),require("@jiek/pkger"),require("node:child_process")):"function"==typeof define&&define.amd?define(["node:fs","node:path","@jiek/utils/getWorkspaceDir","@pnpm/filter-workspace-packages","commander","js-yaml","@jiek/utils/bumper","child_process","@jiek/pkger","node:child_process"],r):r((e="undefined"!=typeof globalThis?globalThis:e||self).fs,e.path,e.getWorkspaceDir,e.filterWorkspacePackages,e.commander,e.jsYaml,e.bumper,e.childProcess,e.pkger,e.childProcess$1)}(this,(function(e,r,t,o,a,n,s,i,l,c){"use strict";function p(e){return e&&e.__esModule?e:{default:e}}function u(e){if(e&&e.__esModule)return e;var r=Object.create(null);return e&&Object.keys(e).forEach((function(t){if("default"!==t){var o=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(r,t,o.get?o:{enumerable:!0,get:function(){return e[t]}})}})),r.default=e,Object.freeze(r)}var d=p(e),f=p(r),k=u(i),g=u(c);let m,j="";try{require.resolve("@pnpm/filter-workspace-packages"),j="pnpm"}catch{}async function y(){let e=a.program.getOptionValue("filter");const r=a.program.getOptionValue("root"),s=r?f.default.isAbsolute(r)?r:f.default.resolve(process.cwd(),r):process.cwd();let i,l=!1;try{i=t.getWorkspaceDir(s,j)}catch(e){if(!("message"in e)||"workspace root not found"!==e.message)throw e;i=s,l=!0}if(!l&&"pnpm"===j){const r=f.default.resolve(i,"pnpm-workspace.yaml"),t=d.default.readFileSync(r,"utf-8"),a=n.load(t);if(s===i&&!e)throw new Error("root path is workspace root, please provide a filter");if(s!==i&&!e){if(!d.default.existsSync(f.default.resolve(s,"package.json")))throw new Error("root path is not workspace root, please provide a filter");const r=JSON.parse(d.default.readFileSync(f.default.resolve(s,"package.json"),"utf-8"));if(!r.name)throw new Error("root path is not workspace root, please provide a filter");e=r.name}const{selectedProjectsGraph:l}=await o.filterPackagesFromDir(i,[{filter:e??"",followProdDepsOnly:!0}],{prefix:s,workspaceDir:i,patterns:a.packages});return{wd:i,root:s,value:Object.entries(l).reduce(((e,[r,t])=>(e[r]=t.package.manifest,e)),{})}}return{wd:i,root:s,value:{[i]:JSON.parse(d.default.readFileSync(f.default.resolve(i,"package.json"),"utf-8"))}}}function h(){m()}function w(){new Promise((e=>m=e))}function b(e,r){const{jiek:{inputs:t,cwd:o,...a}={},exports:n}=e,s=t??(Array.isArray(n)?n:void 0);return{...e,...l.pkger({inputs:s,cwd:r,...a})}}""!==j&&a.program.option("-f, --filter <filter>","filter packages"),a.program.command("publish").aliases(["pub","p"]).option("--bumper <bumper>","bump version","patch").action((async({bumper:e,...r})=>{w();const{value:t={}}=await y()??{},o=Object.entries(t);if(0===o.length)throw new Error("no packages selected");const a=[];o.forEach((([e,r])=>{a.push([e,b(r,e)])}));const n=Object.entries(r).reduce(((e,[r,t])=>(t&&e.push(`--${r}`,t),e)),[]);for(const[r,t]of a){const o=s.bump(t.version,e),a={...t,version:o};d.default.renameSync(f.default.join(r,"package.json"),f.default.join(r,"package.json.bak")),d.default.writeFileSync(f.default.join(r,"package.json"),JSON.stringify(a,null,2)),console.log(a);try{k.execSync(["pnpm","publish","--access","public","--no-git-checks",...n].join(" "),{cwd:r,stdio:"inherit"});const e=JSON.parse(d.default.readFileSync(f.default.join(r,"package.json.bak"),"utf-8"));e.version=o,d.default.writeFileSync(f.default.join(r,"package.json.bak"),JSON.stringify(e,null,2))}finally{d.default.unlinkSync(f.default.join(r,"package.json")),d.default.renameSync(f.default.join(r,"package.json.bak"),f.default.join(r,"package.json"))}}h()}));const v=e=>`\nconst pkg = ${JSON.stringify(e,null,2)}\nconst { jiek = {} } = pkg\nconst templateArg = jiek.templateArgFilePath\n ? require.resolve(jiek.templateArgFilePath)\n : {\n styled: jiek.styled\n }\nmodule.exports = require('${"test"===process.env.NODE_ENV?"jiek/src/rollup/index.ts":"jiek/rollup"}').template(templateArg, pkg)\n`.trimStart();a.program.command("build").action((async()=>{w();const{wd:e,value:r={}}=await y()??{};if(0===Object.keys(r).length)throw new Error("no package found");const t=(...r)=>f.default.resolve(e,"node_modules/.jiek",...r);d.default.existsSync(t())||d.default.mkdirSync(t());const o=require.resolve("rollup").replace(/dist\/rollup.js$/,"dist/bin/rollup");let a=0;for(const[e,n]of Object.entries(r)){const r=b(n,e),s=n.name?.replace(/^@/g,"").replace(/\//g,"+"),i=t(`${s??"anonymous-"+a++}.rollup.config.js`);d.default.writeFileSync(i,v(r));let l="";if("test"===process.env.NODE_ENV){l=`node --import ${require.resolve("esbuild-register")} -r ${require.resolve("esbuild-register/loader")} `}g.execSync(`${l}${o} -c ${i}`,{cwd:e,stdio:"inherit"})}h()}));var O="0.1.12",S="YiJie's personal kits.";a.program.version(O).description(S).option("--root <root>","root path"),a.program.parse(process.argv)}));
2
2
  //# sourceMappingURL=index.umd.min.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.umd.min.js","sources":["../src/inner.ts","../src/merge-package-json.ts","../src/commands/publish.ts","../src/commands/build.ts","../src/index.ts"],"sourcesContent":["let resolve: () => void\n\nexport let actionFuture: Promise<void>\n\nexport function actionDone() {\n resolve()\n}\n\nexport function actionRestore() {\n actionFuture = new Promise<void>(r => resolve = r)\n}\n","import { type Options, pkger } from '@jiek/pkger'\nimport type { PackageJson } from '@npm/types'\nimport type { Manifest } from '@pnpm/workspace.pkgs-graph'\n\nexport function mergePackageJson(manifest: Manifest & {\n jiek?: Options\n exports?: unknown | unknown[]\n}, cwd: string) {\n const {\n jiek: { inputs: jiekInputs, cwd: _, ...jiek } = {}, exports\n } = manifest\n const inputs = jiekInputs ?? (\n Array.isArray(exports) ? exports : undefined\n )\n return {\n ...manifest,\n ...pkger({ inputs, cwd, ...jiek })\n } as PackageJson\n}\n","import fs from 'node:fs'\nimport path from 'node:path'\n\nimport { bump, type BumperType } from '@jiek/utils/bumper'\nimport { getWorkspaceDir } from '@jiek/utils/getWorkspaceDir'\nimport type { PackageJson } from '@npm/types'\nimport { filterPackagesFromDir } from '@pnpm/filter-workspace-packages'\nimport * as childProcess from 'child_process'\nimport { program } from 'commander'\n\nimport { actionDone, actionRestore } from '../inner'\nimport { mergePackageJson } from '../merge-package-json'\n\nprogram\n .command('publish')\n .aliases(['pub', 'p'])\n .option('--filter <filter>', 'filter packages')\n .option('--root <root>', 'root path')\n .option('--bumper <bumper>', 'bump version', 'patch')\n .action(async ({ root: rootOption, filter, bumper, ...options }: {\n root?: string\n filter?: string\n bumper: BumperType\n }) => {\n actionRestore()\n const root = rootOption\n ? path.isAbsolute(rootOption)\n ? rootOption\n : path.resolve(process.cwd(), rootOption)\n : process.cwd()\n const wd = getWorkspaceDir(root)\n const { selectedProjectsGraph } = await filterPackagesFromDir(wd, [{\n filter: filter ?? '',\n followProdDepsOnly: true\n }], {\n prefix: root,\n workspaceDir: wd,\n patterns: ['packages/*']\n })\n const mainfests: [dir: string, PackageJson][] = []\n Object\n .entries(selectedProjectsGraph)\n .forEach(([, { package: { dir, manifest } }]) => {\n mainfests.push([\n dir, mergePackageJson(manifest, dir)\n ])\n })\n const passArgs = Object\n .entries(options)\n .reduce((acc, [key, value]) => {\n if (value) {\n acc.push(`--${key}`, value as string)\n }\n return acc\n }, [] as string[])\n for (const [dir, m] of mainfests) {\n const newVersion = bump(m.version, bumper)\n const newManifest = {\n ...m,\n version: newVersion\n }\n fs.renameSync(path.join(dir, 'package.json'), path.join(dir, 'package.json.bak'))\n fs.writeFileSync(path.join(dir, 'package.json'), JSON.stringify(newManifest, null, 2))\n console.log(newManifest)\n try {\n childProcess.execSync(['pnpm', 'publish', '--access', 'public', '--no-git-checks', ...passArgs].join(' '), {\n cwd: dir,\n stdio: 'inherit'\n })\n const oldPackageJson = JSON.parse(fs.readFileSync(path.join(dir, 'package.json.bak'), 'utf-8'))\n oldPackageJson.version = newVersion\n fs.writeFileSync(path.join(dir, 'package.json.bak'), JSON.stringify(oldPackageJson, null, 2))\n } finally {\n fs.unlinkSync(path.join(dir, 'package.json'))\n fs.renameSync(path.join(dir, 'package.json.bak'), path.join(dir, 'package.json'))\n }\n }\n actionDone()\n })\n","import * as childProcess from 'node:child_process'\nimport 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\nimport { actionDone, actionRestore } from '../inner'\nimport { mergePackageJson } from '../merge-package-json'\n\nconst FILE_TEMPLATE = (manifest: unknown) => `\nconst pkg = ${JSON.stringify(manifest, null, 2)}\nconst { jiek = {} } = pkg\nconst templateArg = jiek.templateArgFilePath\n ? require.resolve(jiek.templateArgFilePath)\n : {\n styled: jiek.styled\n }\nmodule.exports = require('${\n process.env.NODE_ENV === 'test'\n ? 'jiek/src/rollup/index.ts'\n : 'jiek/rollup'\n}').template(templateArg, pkg)\n`.trimStart()\n\nprogram\n .command('build')\n .option('--filter <filter>', 'filter packages')\n .option('--root <root>', 'root path')\n .action(async ({ root: rootOption, filter, ...options }: {\n root?: string\n filter?: string\n }) => {\n actionRestore()\n const root = rootOption\n ? path.isAbsolute(rootOption)\n ? rootOption\n : path.resolve(process.cwd(), rootOption)\n : process.cwd()\n const wd = getWorkspaceDir(root)\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 const jiekTempDir = (...paths: string[]) => path.resolve(wd, 'node_modules/.jiek', ...paths)\n if (!fs.existsSync(jiekTempDir())) fs.mkdirSync(jiekTempDir())\n\n const rollupBinaryPath = require.resolve('rollup')\n .replace(/dist\\/rollup.js$/, 'dist/bin/rollup')\n let i = 0\n for (const [dir, { package: { manifest } }] of Object.entries(selectedProjectsGraph)) {\n const newManifest = mergePackageJson(manifest, dir)\n // TODO support auto build child packages in workspaces\n const escapeManifestName = manifest.name?.replace(/^@/g, '').replace(/\\//g, '+')\n const configFile = jiekTempDir(\n `${escapeManifestName ?? `anonymous-${i++}`}.rollup.config.js`\n )\n fs.writeFileSync(configFile, FILE_TEMPLATE(newManifest))\n let prefix = ''\n if (process.env.NODE_ENV === 'test') {\n const registerPath = require.resolve('esbuild-register')\n const loaderPath = require.resolve('esbuild-register/loader')\n prefix = `node --import ${registerPath} -r ${loaderPath} `\n }\n // TODO replace with `spawn` to support watch mode\n childProcess.execSync(`${prefix}${rollupBinaryPath} -c ${configFile}`, {\n cwd: dir, stdio: 'inherit'\n })\n }\n\n actionDone()\n })\n","import './commands/publish'\nimport './commands/build'\n\nimport { program } from 'commander'\n\nprogram.parse(process.argv)\n"],"names":["resolve","actionDone","actionRestore","Promise","r","mergePackageJson","manifest","cwd","jiek","inputs","jiekInputs","_","exports","Array","isArray","pkger","commander","program","command","aliases","option","action","async","root","rootOption","filter","bumper","options","path","isAbsolute","process","wd","getWorkspaceDir","selectedProjectsGraph","filterPackagesFromDir","followProdDepsOnly","prefix","workspaceDir","patterns","mainfests","Object","entries","forEach","package","dir","push","passArgs","reduce","acc","key","value","m","newVersion","bump","version","newManifest","fs","renameSync","join","writeFileSync","JSON","stringify","console","log","childProcess","execSync","stdio","oldPackageJson","parse","readFileSync","unlinkSync","FILE_TEMPLATE","env","NODE_ENV","trimStart","pnpmWorkspaceFilePath","pnpmWorkspaceFileContent","pnpmWorkspace","load","Error","existsSync","packageJSON","name","packages","jiekTempDir","paths","mkdirSync","rollupBinaryPath","require","replace","i","escapeManifestName","configFile","argv"],"mappings":"ujCAAA,IAAIA,EAIG,SAASC,IACND,GACV,CAEO,SAASE,IACC,IAAIC,SAAmBC,GAAAJ,EAAUI,GAClD,CCNgB,SAAAC,EAAiBC,EAG9BC,GACK,MACJC,MAAQC,OAAQC,EAAYH,IAAKI,KAAMH,GAAS,CAAC,EAAAI,QAAGA,GAClDN,EACEG,EAASC,IACbG,MAAMC,QAAQF,GAAWA,OAAU,GAE9B,MAAA,IACFN,KACAS,EAAMA,MAAA,CAAEN,SAAQF,SAAQC,IAE/B,CCLAQ,EAAAC,QACGC,QAAQ,WAC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,EAAK5B,QAAQ+B,EAAI,wBAAyBsD,GACjF7B,EAAGwB,WAAWI,MAAmB5B,EAAA8B,UAAUF,KAEhD,MAAMG,EAAmBC,QAAQxF,QAAQ,UACtCyF,QAAQ,mBAAoB,mBAC/B,IAAIC,EAAI,EACR,IAAA,MAAY9C,GAAOD,SAASrC,SAAEA,OAAiBkC,OAAOC,QAAQR,GAAwB,CAC9E,MAAAsB,EAAclD,EAAiBC,EAAUsC,GAEzC+C,EAAqBrF,EAAS4E,MAAMO,QAAQ,MAAO,IAAIA,QAAQ,MAAO,KACtEG,EAAaR,EACjB,GAAGO,GAAsB,aAAaD,wBAExClC,EAAGG,cAAciC,EAAYrB,EAAchB,IAC3C,IAAInB,EAAS,GACT,GAAyB,SAAzBN,QAAQ0C,IAAIC,SAAqB,CAG1BrC,EAAA,iBAFYoD,QAAQxF,QAAQ,0BAClBwF,QAAQxF,QAAQ,6BAErC,CAEAgE,EAAaC,SAAS,GAAG7B,IAASmD,QAAuBK,IAAc,CACrErF,IAAKqC,EAAKsB,MAAO,WAErB,CAEWjE,GAAA,IC3FfgB,EAAAA,QAAQmD,MAAMtC,QAAQ+D"}
1
+ {"version":3,"file":"index.umd.min.js","sources":["../src/utils/filterSupport.ts","../src/inner.ts","../src/merge-package-json.ts","../src/commands/publish.ts","../src/commands/build.ts","../src/index.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","let resolve: () => void\n\nexport let actionFuture: Promise<void>\n\nexport function actionDone() {\n resolve()\n}\n\nexport function actionRestore() {\n actionFuture = new Promise<void>(r => resolve = r)\n}\n","import { type Options, pkger } from '@jiek/pkger'\nimport type { PackageJson } from '@npm/types'\nimport type { Manifest } from '@pnpm/workspace.pkgs-graph'\n\nexport function mergePackageJson(manifest: Manifest & {\n jiek?: Options\n exports?: unknown | unknown[]\n}, cwd: string) {\n const {\n jiek: { inputs: jiekInputs, cwd: _, ...jiek } = {}, exports\n } = manifest\n const inputs = jiekInputs ?? (\n Array.isArray(exports) ? exports : undefined\n )\n return {\n ...manifest,\n ...pkger({ inputs, cwd, ...jiek })\n } as PackageJson\n}\n","import fs from 'node:fs'\nimport path from 'node:path'\n\nimport { bump, type BumperType } from '@jiek/utils/bumper'\nimport type { PackageJson } from '@npm/types'\nimport * as childProcess from 'child_process'\nimport { program } from 'commander'\n\nimport { actionDone, actionRestore } from '../inner'\nimport { mergePackageJson } from '../merge-package-json'\nimport { getSelectedProjectsGraph } from '../utils/filterSupport'\n\nprogram\n .command('publish')\n .aliases(['pub', 'p'])\n .option('--bumper <bumper>', 'bump version', 'patch')\n .action(async ({ bumper, ...options }: {\n root?: string\n filter?: string\n bumper: BumperType\n }) => {\n actionRestore()\n\n const { value = {} } = await getSelectedProjectsGraph() ?? {}\n const selectedProjectsGraphEntries = Object.entries(value)\n if (selectedProjectsGraphEntries.length === 0) {\n throw new Error('no packages selected')\n }\n const mainfests: [dir: string, PackageJson][] = []\n selectedProjectsGraphEntries\n .forEach(([dir, manifest]) => {\n mainfests.push([\n dir, mergePackageJson(manifest, dir)\n ])\n })\n const passArgs = Object\n .entries(options)\n .reduce((acc, [key, value]) => {\n if (value) {\n acc.push(`--${key}`, value as string)\n }\n return acc\n }, [] as string[])\n for (const [dir, m] of mainfests) {\n const newVersion = bump(m.version, bumper)\n const newManifest = {\n ...m,\n version: newVersion\n }\n fs.renameSync(path.join(dir, 'package.json'), path.join(dir, 'package.json.bak'))\n fs.writeFileSync(path.join(dir, 'package.json'), JSON.stringify(newManifest, null, 2))\n console.log(newManifest)\n try {\n childProcess.execSync(['pnpm', 'publish', '--access', 'public', '--no-git-checks', ...passArgs].join(' '), {\n cwd: dir,\n stdio: 'inherit'\n })\n const oldPackageJson = JSON.parse(fs.readFileSync(path.join(dir, 'package.json.bak'), 'utf-8'))\n oldPackageJson.version = newVersion\n fs.writeFileSync(path.join(dir, 'package.json.bak'), JSON.stringify(oldPackageJson, null, 2))\n } finally {\n fs.unlinkSync(path.join(dir, 'package.json'))\n fs.renameSync(path.join(dir, 'package.json.bak'), path.join(dir, 'package.json'))\n }\n }\n actionDone()\n })\n","import * as childProcess from 'node:child_process'\nimport fs from 'node:fs'\nimport path from 'node:path'\n\nimport { program } from 'commander'\n\nimport { actionDone, actionRestore } from '../inner'\nimport { mergePackageJson } from '../merge-package-json'\nimport { getSelectedProjectsGraph } from '../utils/filterSupport'\n\nconst FILE_TEMPLATE = (manifest: unknown) => `\nconst pkg = ${JSON.stringify(manifest, null, 2)}\nconst { jiek = {} } = pkg\nconst templateArg = jiek.templateArgFilePath\n ? require.resolve(jiek.templateArgFilePath)\n : {\n styled: jiek.styled\n }\nmodule.exports = require('${\n process.env.NODE_ENV === 'test'\n ? 'jiek/src/rollup/index.ts'\n : 'jiek/rollup'\n}').template(templateArg, pkg)\n`.trimStart()\n\nprogram\n .command('build')\n .action(async () => {\n actionRestore()\n const {\n wd, value = {}\n } = await getSelectedProjectsGraph() ?? {}\n\n if (Object.keys(value).length === 0) {\n throw new Error('no package found')\n }\n const jiekTempDir = (...paths: string[]) => path.resolve(wd, 'node_modules/.jiek', ...paths)\n if (!fs.existsSync(jiekTempDir())) fs.mkdirSync(jiekTempDir())\n\n const rollupBinaryPath = require.resolve('rollup')\n .replace(/dist\\/rollup.js$/, 'dist/bin/rollup')\n let i = 0\n for (const [dir, manifest] of Object.entries(value)) {\n const newManifest = mergePackageJson(manifest, dir)\n // TODO support auto build child packages in workspaces\n const escapeManifestName = manifest.name?.replace(/^@/g, '').replace(/\\//g, '+')\n const configFile = jiekTempDir(\n `${escapeManifestName ?? `anonymous-${i++}`}.rollup.config.js`\n )\n fs.writeFileSync(configFile, FILE_TEMPLATE(newManifest))\n let prefix = ''\n if (process.env.NODE_ENV === 'test') {\n const registerPath = require.resolve('esbuild-register')\n const loaderPath = require.resolve('esbuild-register/loader')\n prefix = `node --import ${registerPath} -r ${loaderPath} `\n }\n // TODO replace with `spawn` to support watch mode\n childProcess.execSync(`${prefix}${rollupBinaryPath} -c ${configFile}`, {\n cwd: dir, stdio: 'inherit'\n })\n }\n\n actionDone()\n })\n","import './utils/filterSupport'\nimport './commands/publish'\nimport './commands/build'\n\nimport { program } from 'commander'\n\nimport pkg from '../package.json'\n\nprogram\n .version(pkg.version)\n .description(pkg.description)\n .option('--root <root>', 'root path')\n\nprogram.parse(process.argv)\n"],"names":["resolve","type","require","async","getSelectedProjectsGraph","filter","program","getOptionValue","rootOption","root","path","isAbsolute","process","cwd","wd","notWorkspace","getWorkspaceDir","e","message","pnpmWorkspaceFilePath","default","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","actionDone","actionRestore","Promise","r","mergePackageJson","jiek","inputs","jiekInputs","_","exports","Array","isArray","pkger","option","command","aliases","action","bumper","options","selectedProjectsGraphEntries","length","mainfests","forEach","dir","push","passArgs","m","newVersion","bump","version","newManifest","renameSync","join","writeFileSync","stringify","console","log","childProcess","execSync","stdio","oldPackageJson","unlinkSync","FILE_TEMPLATE","env","NODE_ENV","trimStart","commander","keys","jiekTempDir","paths","mkdirSync","rollupBinaryPath","replace","i","escapeManifestName","configFile","pkg","description","argv"],"mappings":"opCAQO,ICRHA,EDQOC,EAAO,GAElB,IACEC,QAAQF,QAAQ,mCACTC,EAAA,MACT,CAAQ,MAAc,CActBE,eAAsBC,IAChB,IAAAC,EAASC,EAAAA,QAAQC,eAAe,UAC9B,MAAAC,EAAaF,EAAAA,QAAQC,eAAe,QACpCE,EAAOD,EACTE,EAAAA,QAAKC,WAA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AAI1C,EAAS,GACT,GAAyB,SAAzBvB,QAAQ8E,IAAIC,SAAqB,CAG1BxD,EAAA,iBAFYjC,QAAQF,QAAQ,0BAClBE,QAAQF,QAAQ,6BAErC,CAEAoF,EAAaC,SAAS,GAAGlD,IAAS+D,QAAuBI,IAAc,CACrEzF,IAAKyD,EAAKgB,MAAO,WAErB,CAEWvC,GAAA,8CCrDZ8C,EAAAvF,QAAAsE,QAAQ2B,GACRC,YAAYD,GACZ3C,OAAO,gBAAiB,aAE3BtD,EAAAA,QAAQwB,MAAMlB,QAAQ6F"}
@@ -0,0 +1,58 @@
1
+ var name = "jiek";
2
+ var version = "0.1.12";
3
+ var description = "YiJie's personal kits.";
4
+ var bin = {
5
+ jiek: "bin/jiek.js",
6
+ "jiek-dev": "bin/jiek-dev.js"
7
+ };
8
+ var jiek = {
9
+ inputs: [
10
+ "index.ts",
11
+ "rollup/index.ts"
12
+ ]
13
+ };
14
+ var scripts = {
15
+ build: "jiek-dev build"
16
+ };
17
+ var dependencies = {
18
+ "@jiek/pkger": "workspace:^*",
19
+ "@jiek/utils": "workspace:^*",
20
+ "@rollup/plugin-json": "^6.0.1",
21
+ "@rollup/plugin-terser": "^0.4.4",
22
+ autoprefixer: "^10.4.16",
23
+ commander: "^12.0.0",
24
+ "js-yaml": "^4.1.0",
25
+ rollup: "^4.1.5",
26
+ "rollup-plugin-copy": "^3.5.0",
27
+ "rollup-plugin-dts": "^6.1.0",
28
+ "rollup-plugin-esbuild": "^6.1.0",
29
+ "rollup-plugin-postcss": "^4.0.2"
30
+ };
31
+ var optionalDependencies = {
32
+ "@pnpm/filter-workspace-packages": "^7.2.13"
33
+ };
34
+ var devDependencies = {
35
+ "@npm/types": "^1.0.2",
36
+ "@pnpm/workspace.pkgs-graph": "^2.0.15",
37
+ "@pnpm/filter-workspace-packages": "^7.2.13",
38
+ "@types/js-yaml": "^4.0.9",
39
+ "esbuild-register": "^3.5.0"
40
+ };
41
+ var files = [
42
+ "dist"
43
+ ];
44
+ var pkg = {
45
+ name: name,
46
+ version: version,
47
+ description: description,
48
+ bin: bin,
49
+ jiek: jiek,
50
+ scripts: scripts,
51
+ dependencies: dependencies,
52
+ optionalDependencies: optionalDependencies,
53
+ devDependencies: devDependencies,
54
+ files: files
55
+ };
56
+
57
+ export { bin, pkg as default, dependencies, description, devDependencies, files, jiek, name, optionalDependencies, scripts, version };
58
+ //# sourceMappingURL=package.json.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"package.json.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -0,0 +1,2 @@
1
+ var e="jiek",p="0.1.12",i="YiJie's personal kits.",s={jiek:"bin/jiek.js","jiek-dev":"bin/jiek-dev.js"},l={inputs:["index.ts","rollup/index.ts"]},r={build:"jiek-dev build"},n={"@jiek/pkger":"workspace:^*","@jiek/utils":"workspace:^*","@rollup/plugin-json":"^6.0.1","@rollup/plugin-terser":"^0.4.4",autoprefixer:"^10.4.16",commander:"^12.0.0","js-yaml":"^4.1.0",rollup:"^4.1.5","rollup-plugin-copy":"^3.5.0","rollup-plugin-dts":"^6.1.0","rollup-plugin-esbuild":"^6.1.0","rollup-plugin-postcss":"^4.0.2"},o={"@pnpm/filter-workspace-packages":"^7.2.13"},u={"@npm/types":"^1.0.2","@pnpm/workspace.pkgs-graph":"^2.0.15","@pnpm/filter-workspace-packages":"^7.2.13","@types/js-yaml":"^4.0.9","esbuild-register":"^3.5.0"},a=["dist"],t={name:e,version:p,description:i,bin:s,jiek:l,scripts:r,dependencies:n,optionalDependencies:o,devDependencies:u,files:a};export{s as bin,t as default,n as dependencies,i as description,u as devDependencies,a as files,l as jiek,e as name,o as optionalDependencies,r as scripts,p as version};
2
+ //# sourceMappingURL=package.json.esm.min.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"package.json.esm.min.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -2,6 +2,7 @@ const defineOutput = (output) => output;
2
2
  const commonOutputOptions = defineOutput({
3
3
  dir: "dist",
4
4
  exports: "named",
5
+ interop: "auto",
5
6
  sourcemap: true
6
7
  });
7
8
 
@@ -1 +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;;;;"}
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 interop: 'auto',\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,OAAS,EAAA,MAAA;AAAA,EACT,SAAW,EAAA,IAAA;AACb,CAAC;;;;"}
@@ -1,2 +1,2 @@
1
- const e={dir:"dist",exports:"named",sourcemap:!0};export{e as commonOutputOptions};
1
+ const o={dir:"dist",exports:"named",interop:"auto",sourcemap:!0};export{o as commonOutputOptions};
2
2
  //# sourceMappingURL=commonOptions.esm.min.js.map
@@ -1 +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"}
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 interop: 'auto',\n sourcemap: true\n})\n"],"names":["commonOutputOptions","dir","exports","interop","sourcemap"],"mappings":"AAEA,MAEaA,EAAmC,CAC9CC,IAAK,OACLC,QAAS,QACTC,QAAS,OACTC,WAAW"}