auklet 0.0.18 → 0.0.20

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.
Files changed (93) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +255 -174
  3. package/bin/entry.mjs +5 -0
  4. package/dist/build/bundleConfig.js +1 -1
  5. package/dist/build/cliOverrides.d.ts +22 -0
  6. package/dist/build/cliOverrides.js +22 -0
  7. package/dist/build/moduleConfig.js +1 -1
  8. package/dist/build/runTsdown.d.ts +2 -0
  9. package/dist/build/runTsdown.js +4 -3
  10. package/dist/build/tsdown/common.d.ts +2 -2
  11. package/dist/build/tsdown/context.d.ts +2 -1
  12. package/dist/build/tsdown/context.js +2 -1
  13. package/dist/build/tsdown/define.js +3 -2
  14. package/dist/build/tsdown/dependencies.js +3 -1
  15. package/dist/build/tsdown/entries.d.ts +2 -2
  16. package/dist/build/tsdown/entries.js +10 -10
  17. package/dist/build/tsdown/types.d.ts +1 -0
  18. package/dist/cli/build.d.ts +5 -0
  19. package/dist/cli/build.js +30 -0
  20. package/dist/cli/buildArgs.d.ts +8 -0
  21. package/dist/cli/buildArgs.js +114 -0
  22. package/dist/cli/buildCss.d.ts +12 -0
  23. package/dist/cli/buildCss.js +53 -0
  24. package/dist/cli/dev.d.ts +1 -0
  25. package/dist/cli/dev.js +39 -0
  26. package/dist/cli/main.d.ts +1 -0
  27. package/dist/cli/main.js +95 -0
  28. package/dist/cli/publish.d.ts +2 -0
  29. package/dist/cli/publish.js +9 -0
  30. package/dist/css/production/buildReporter.d.ts +3 -0
  31. package/dist/css/production/buildReporter.js +19 -0
  32. package/dist/css/production/builder.d.ts +8 -3
  33. package/dist/css/production/builder.js +9 -13
  34. package/dist/css/vite/hmr.js +7 -6
  35. package/dist/css/vite/moduleGraph/graph.js +0 -1
  36. package/dist/css/vite/moduleGraph/packageSource/monorepo.d.ts +5 -1
  37. package/dist/css/vite/moduleGraph/packageSource/monorepo.js +40 -31
  38. package/dist/css/vite/moduleGraph/types.d.ts +0 -1
  39. package/dist/css/watch/watcher.d.ts +0 -1
  40. package/dist/css/watch/watcher.js +3 -10
  41. package/dist/index.d.ts +5 -7
  42. package/dist/index.js +4 -5
  43. package/dist/logger.d.ts +5 -0
  44. package/dist/logger.js +14 -0
  45. package/dist/publish/api/gitApi.d.ts +7 -0
  46. package/dist/publish/api/gitApi.js +55 -0
  47. package/dist/publish/api/packageJsonApi.d.ts +7 -0
  48. package/dist/publish/api/packageJsonApi.js +34 -0
  49. package/dist/publish/api/pnpmApi.d.ts +9 -0
  50. package/dist/publish/api/pnpmApi.js +85 -0
  51. package/dist/publish/api/pnpmPublishApi.d.ts +4 -0
  52. package/dist/publish/api/pnpmPublishApi.js +7 -0
  53. package/dist/publish/api/publishArgs.d.ts +2 -0
  54. package/dist/publish/api/publishArgs.js +25 -0
  55. package/dist/publish/api/publishHookApi.d.ts +10 -0
  56. package/dist/publish/api/publishHookApi.js +52 -0
  57. package/dist/publish/cli.d.ts +2 -0
  58. package/dist/publish/cli.js +94 -0
  59. package/dist/publish/ownerRunner.d.ts +6 -0
  60. package/dist/publish/ownerRunner.js +22 -0
  61. package/dist/publish/publishRunner.d.ts +16 -0
  62. package/dist/publish/publishRunner.js +108 -0
  63. package/dist/publish/runner/packageBuilder.d.ts +4 -0
  64. package/dist/publish/runner/packageBuilder.js +15 -0
  65. package/dist/publish/runner/packagePublisher.d.ts +7 -0
  66. package/dist/publish/runner/packagePublisher.js +21 -0
  67. package/dist/publish/runner/publishFailureReporter.d.ts +3 -0
  68. package/dist/publish/runner/publishFailureReporter.js +14 -0
  69. package/dist/publish/runner/publishOutputFormatter.d.ts +2 -0
  70. package/dist/publish/runner/publishOutputFormatter.js +83 -0
  71. package/dist/publish/runner/publishPreflight.d.ts +8 -0
  72. package/dist/publish/runner/publishPreflight.js +26 -0
  73. package/dist/publish/runner/publishSummaryReporter.d.ts +10 -0
  74. package/dist/publish/runner/publishSummaryReporter.js +81 -0
  75. package/dist/publish/runner/publishTargetError.d.ts +9 -0
  76. package/dist/publish/runner/publishTargetError.js +14 -0
  77. package/dist/publish/runner/releaseGitController.d.ts +10 -0
  78. package/dist/publish/runner/releaseGitController.js +41 -0
  79. package/dist/publish/runner/versionWriter.d.ts +13 -0
  80. package/dist/publish/runner/versionWriter.js +78 -0
  81. package/dist/publish/targetResolver.d.ts +7 -0
  82. package/dist/publish/targetResolver.js +195 -0
  83. package/dist/publish/types.d.ts +70 -0
  84. package/dist/publish/types.js +0 -0
  85. package/dist/publish/version.d.ts +5 -0
  86. package/dist/publish/version.js +55 -0
  87. package/dist/types.d.ts +8 -7
  88. package/dist/workspace/packages.d.ts +9 -0
  89. package/dist/workspace/packages.js +62 -0
  90. package/dist/workspace/root.d.ts +1 -0
  91. package/dist/workspace/root.js +14 -0
  92. package/package.json +15 -6
  93. package/bin/entry.cjs +0 -163
package/bin/entry.cjs DELETED
@@ -1,163 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- const fs = require('node:fs');
4
- const path = require('node:path');
5
- const minimist = require('minimist');
6
-
7
- const getPackageVersion = () => {
8
- const packageJson = JSON.parse(
9
- fs.readFileSync(path.resolve(__dirname, '../package.json'), 'utf8'),
10
- );
11
- return packageJson.version;
12
- };
13
-
14
- const runVersion = async () => {
15
- console.log(getPackageVersion());
16
- return 0;
17
- };
18
-
19
- const loadCurrentAukletConfig = async (options) => {
20
- const { loadAukletConfig } = await import('../dist/configLoader.js');
21
- return loadAukletConfig(process.cwd(), options);
22
- };
23
-
24
- const runBuildStyle = async (args, options = {}) => {
25
- const shouldWatch = args.includes('--watch') || args.includes('-w');
26
- const aukletConfig =
27
- options.aukletConfig ??
28
- (await loadCurrentAukletConfig({
29
- cacheBust: shouldWatch,
30
- }));
31
-
32
- if (shouldWatch) {
33
- const { ModuleStyleWatcher } = await import('../dist/css/watch/watcher.js');
34
- const watcher = new ModuleStyleWatcher({ aukletConfig, logger: console });
35
- await watcher.watch();
36
- const close = () => {
37
- watcher
38
- .close()
39
- .catch(console.error)
40
- .finally(() => process.exit(0));
41
- };
42
- process.once('SIGINT', close);
43
- process.once('SIGTERM', close);
44
- await new Promise(() => {});
45
- return 0;
46
- }
47
-
48
- const { ModuleStyleBuilder } =
49
- await import('../dist/css/production/builder.js');
50
- const builder = new ModuleStyleBuilder({ aukletConfig, logger: console });
51
- await builder.build();
52
- return 0;
53
- };
54
-
55
- const runBuildJs = async (args) => {
56
- const { runTsdown } = await import('../dist/build/runTsdown.js');
57
- return runTsdown(args, { cwd: process.cwd() });
58
- };
59
-
60
- const runBuild = async (args) => {
61
- const aukletConfig = await loadCurrentAukletConfig();
62
- const { cleanAukletOutputByConfig } =
63
- await import('../dist/build/cleanOutput.js');
64
- cleanAukletOutputByConfig(process.cwd(), aukletConfig);
65
-
66
- const jsExitCode = await runBuildJs(args);
67
- if (jsExitCode) return jsExitCode;
68
-
69
- return runBuildStyle([], { aukletConfig });
70
- };
71
-
72
- const runDev = async () => {
73
- const { execa } = await import('execa');
74
- const { createTsdownArgs } = await import('../dist/build/runTsdown.js');
75
- const entries = [
76
- createTsdownArgs(['--watch']),
77
- [path.resolve(__dirname, './entry.cjs'), 'build-css', '--watch'],
78
- ];
79
- const processes = entries.map((args) =>
80
- execa(process.execPath, args, {
81
- cwd: process.cwd(),
82
- stdio: 'inherit',
83
- reject: false,
84
- }),
85
- );
86
-
87
- const close = () => {
88
- for (const item of processes) {
89
- item.kill('SIGTERM');
90
- }
91
- };
92
-
93
- process.once('SIGINT', close);
94
- process.once('SIGTERM', close);
95
-
96
- for (const item of processes) {
97
- item.then((result) => {
98
- if (result.exitCode) close();
99
- });
100
- }
101
-
102
- const results = await Promise.all(processes);
103
- const failed = results.find((result) => result.exitCode);
104
- return failed?.exitCode ?? 0;
105
- };
106
-
107
- const argv = minimist(process.argv.slice(2), {
108
- boolean: ['help', 'version'],
109
- alias: {
110
- h: 'help',
111
- v: 'version',
112
- },
113
- });
114
- const [command, ...args] = argv._;
115
- const commandIndex = process.argv.indexOf(command);
116
- const commandArgs =
117
- commandIndex >= 0 ? process.argv.slice(commandIndex + 1) : args;
118
-
119
- if (argv.version) {
120
- console.log(getPackageVersion());
121
- process.exit(0);
122
- }
123
-
124
- if (argv.help || !command) {
125
- console.log('Usage: auk <command>');
126
- console.log('');
127
- console.log('Commands:');
128
- console.log(' build Build package JavaScript and CSS output');
129
- console.log(' build-js Build package JavaScript output with tsdown');
130
- console.log(' build-css Build package module CSS output, supports --watch');
131
- console.log(' dev Watch package JavaScript and CSS output');
132
- console.log(' version Print auklet version');
133
- console.log('');
134
- console.log('Options:');
135
- console.log(' -v, --version Print auklet version');
136
- console.log(' -h, --help Print help');
137
- process.exit(argv.help ? 0 : 1);
138
- }
139
-
140
- const runners = {
141
- build: runBuild,
142
- 'build-js': runBuildJs,
143
- 'build-css': runBuildStyle,
144
- dev: runDev,
145
- version: runVersion,
146
- };
147
-
148
- const runner = runners[command];
149
-
150
- if (runner) {
151
- runner(commandArgs)
152
- .then((exitCode) => {
153
- process.exit(exitCode ?? 0);
154
- })
155
- .catch((error) => {
156
- console.error(error);
157
- process.exit(1);
158
- });
159
- return;
160
- }
161
-
162
- console.error(`Unknown auk command: ${command}`);
163
- process.exit(1);