@visulima/cerebro 3.0.0-alpha.9 → 3.0.1

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 (96) hide show
  1. package/CHANGELOG.md +593 -0
  2. package/LICENSE.md +1295 -3950
  3. package/README.md +182 -2
  4. package/dist/commands/completion-command.d.ts +6 -5
  5. package/dist/commands/completion-command.js +5 -203
  6. package/dist/commands/help-command.d.ts +10 -9
  7. package/dist/commands/help-command.js +1 -3
  8. package/dist/commands/readme-command.d.ts +6 -5
  9. package/dist/commands/readme-command.js +32 -330
  10. package/dist/commands/version-command.d.ts +4 -3
  11. package/dist/commands/version-command.js +1 -18
  12. package/dist/index.d.ts +516 -95
  13. package/dist/index.js +1 -7
  14. package/dist/logger/create-pail-logger.d.ts +770 -8
  15. package/dist/logger/create-pail-logger.js +1 -34
  16. package/dist/packem_chunks/has-new-version.js +1 -259
  17. package/dist/packem_shared/Cerebro-Czc4t-75.js +4 -0
  18. package/dist/packem_shared/VERBOSITY_DEBUG-XPultrIA.js +1 -0
  19. package/dist/packem_shared/VisulimaError-C90oeIMu.js +76 -0
  20. package/dist/packem_shared/VisulimaError-DTMgXonA-CzaryRgZ.js +1 -0
  21. package/dist/packem_shared/cerebro-error-BjBcYVRO.js +1 -0
  22. package/dist/packem_shared/command.d-DbhtfXF4.d.ts +639 -0
  23. package/dist/packem_shared/index-DvVGK4kr.js +29 -0
  24. package/dist/packem_shared/index.d-BL4NtVR3.d.ts +127 -0
  25. package/dist/packem_shared/lazyNamed-DMUm8mZe.js +1 -0
  26. package/dist/packem_shared/renderError-B3ePOoBG-BmZlyMcr.js +25 -0
  27. package/dist/packem_shared/runtime-process-Dmz0vCJy.js +1 -0
  28. package/dist/packem_shared/split-by-case-Dbpgd7rf.js +1 -0
  29. package/dist/plugins/error-handler-plugin.d.ts +21 -19
  30. package/dist/plugins/error-handler-plugin.js +1 -636
  31. package/dist/plugins/runtime-version-check-plugin.d.ts +22 -20
  32. package/dist/plugins/runtime-version-check-plugin.js +1 -77
  33. package/dist/plugins/update-notifier/update-notifier-plugin.d.ts +28 -8
  34. package/dist/plugins/update-notifier/update-notifier-plugin.js +1 -517
  35. package/dist/util/general/compile-cache.d.ts +41 -0
  36. package/dist/util/general/compile-cache.js +1 -0
  37. package/dist/util/general/heap-tuning.d.ts +18 -0
  38. package/dist/util/general/heap-tuning.js +1 -0
  39. package/package.json +53 -48
  40. package/dist/cli.d.ts +0 -203
  41. package/dist/constants.d.ts +0 -29
  42. package/dist/default-env.d.ts +0 -7
  43. package/dist/default-options.d.ts +0 -3
  44. package/dist/empty-toolbox.d.ts +0 -15
  45. package/dist/errors/cerebro-error.d.ts +0 -10
  46. package/dist/errors/command-not-found-error.d.ts +0 -9
  47. package/dist/errors/command-validation-error.d.ts +0 -10
  48. package/dist/errors/completion-error.d.ts +0 -9
  49. package/dist/errors/conflicting-options-error.d.ts +0 -10
  50. package/dist/errors/plugin-error.d.ts +0 -9
  51. package/dist/errors/update-notifier-error.d.ts +0 -7
  52. package/dist/packem_shared/Cerebro-C2mnCyQf.js +0 -3313
  53. package/dist/packem_shared/VERBOSITY_QUIET-Dp46zlLW.js +0 -10
  54. package/dist/packem_shared/VisulimaError-DA7QsCxH.js +0 -34
  55. package/dist/packem_shared/cerebro-error-GmJ3jN7Q.js +0 -16
  56. package/dist/packem_shared/help-command-BY7rQUvM.js +0 -249
  57. package/dist/packem_shared/index-C2-8b3A4.js +0 -259
  58. package/dist/packem_shared/runtime-process-B6ZplyWn.js +0 -187
  59. package/dist/plugin-manager.d.ts +0 -53
  60. package/dist/plugins/update-notifier/cache.d.ts +0 -11
  61. package/dist/plugins/update-notifier/get-distribution-version.d.ts +0 -2
  62. package/dist/plugins/update-notifier/has-new-version.d.ts +0 -14
  63. package/dist/types/cli.d.ts +0 -102
  64. package/dist/types/command-line-usage.d.ts +0 -37
  65. package/dist/types/command.d.ts +0 -136
  66. package/dist/types/option-types.d.ts +0 -83
  67. package/dist/types/options.d.ts +0 -4
  68. package/dist/types/plugin.d.ts +0 -53
  69. package/dist/types/toolbox.d.ts +0 -96
  70. package/dist/util/arg-processing/get-boolean-values.d.ts +0 -7
  71. package/dist/util/arg-processing/get-parameter-option.d.ts +0 -7
  72. package/dist/util/arg-processing/map-option-type-label.d.ts +0 -3
  73. package/dist/util/arg-processing/option-is-boolean.d.ts +0 -9
  74. package/dist/util/arg-processing/remove-boolean-values.d.ts +0 -9
  75. package/dist/util/command-line-commands.d.ts +0 -10
  76. package/dist/util/command-line-usage/get-terminal-width.d.ts +0 -7
  77. package/dist/util/command-line-usage/index.d.ts +0 -3
  78. package/dist/util/command-line-usage/section/base-section.d.ts +0 -8
  79. package/dist/util/command-line-usage/section/content-section.d.ts +0 -65
  80. package/dist/util/command-line-usage/section/option-list-section.d.ts +0 -44
  81. package/dist/util/command-processing/command-processor.d.ts +0 -37
  82. package/dist/util/command-processing/command-validation.d.ts +0 -17
  83. package/dist/util/command-processing/nested-command-parser.d.ts +0 -25
  84. package/dist/util/command-processing/option-processor.d.ts +0 -44
  85. package/dist/util/data-processing/list-missing-arguments.d.ts +0 -15
  86. package/dist/util/data-processing/merge-arguments.d.ts +0 -7
  87. package/dist/util/general/find-alternatives.d.ts +0 -8
  88. package/dist/util/general/hide-bin.d.ts +0 -2
  89. package/dist/util/general/parse-raw-command.d.ts +0 -7
  90. package/dist/util/general/register-exception-handler.d.ts +0 -9
  91. package/dist/util/general/runtime-process.d.ts +0 -65
  92. package/dist/util/general/semver-gt.d.ts +0 -2
  93. package/dist/util/general/validate-input.d.ts +0 -24
  94. package/dist/util/process-env-variables.d.ts +0 -9
  95. package/dist/util/security.d.ts +0 -58
  96. package/dist/util/text-processing/template-format.d.ts +0 -5
@@ -1,77 +1 @@
1
- import { d as getEnv, e as exitProcess, a as getVersions } from '../packem_shared/runtime-process-B6ZplyWn.js';
2
-
3
- const parseMajorVersion = (versionString) => {
4
- if (!versionString || typeof versionString !== "string") {
5
- return 0;
6
- }
7
- const parts = versionString.split(".");
8
- if (parts.length === 0 || !parts[0]) {
9
- return 0;
10
- }
11
- const major = Number.parseInt(parts[0], 10);
12
- return Number.isNaN(major) ? 0 : major;
13
- };
14
- const extractNodeVersion = (processVersion) => {
15
- if (!processVersion || typeof processVersion !== "string") {
16
- return "";
17
- }
18
- return processVersion.replace("v", "");
19
- };
20
- const detectRuntime = () => {
21
- if (typeof Bun !== "undefined") {
22
- const version2 = Bun.version || "";
23
- const major2 = parseMajorVersion(version2);
24
- return { major: major2, type: "bun", version: version2 };
25
- }
26
- if (typeof Deno !== "undefined") {
27
- const version2 = Deno.version?.deno || "";
28
- const major2 = parseMajorVersion(version2);
29
- return { major: major2, type: "deno", version: version2 };
30
- }
31
- const versions = getVersions();
32
- const nodeVersion = versions.node ?? "";
33
- const version = extractNodeVersion(nodeVersion);
34
- const major = parseMajorVersion(version);
35
- return { major, type: "node", version };
36
- };
37
- const runtimeVersionCheckPlugin = (options = {}) => {
38
- return {
39
- description: "Checks if the current runtime version meets the minimum requirement",
40
- init: async (context) => {
41
- const runtime = detectRuntime();
42
- const defaultMinVersions = {
43
- bun: 1,
44
- deno: 1,
45
- node: 18
46
- };
47
- let envMinVersion;
48
- try {
49
- const env = getEnv();
50
- const envRaw = env.CEREBRO_MIN_NODE_VERSION;
51
- const parsed = envRaw === void 0 ? void 0 : Number.parseInt(envRaw, 10);
52
- envMinVersion = Number.isNaN(parsed) ? void 0 : parsed;
53
- } catch {
54
- envMinVersion = void 0;
55
- }
56
- let minVersion;
57
- if (options.runtimes?.[runtime.type]?.minVersion !== void 0) {
58
- minVersion = options.runtimes[runtime.type].minVersion;
59
- } else if (runtime.type === "node" && envMinVersion !== void 0) {
60
- minVersion = envMinVersion;
61
- } else {
62
- minVersion = defaultMinVersions[runtime.type];
63
- }
64
- if (runtime.major < minVersion) {
65
- context.logger.error(
66
- `cerebro requires ${runtime.type} version ${minVersion} or higher. You have ${runtime.type} ${runtime.version}. Read our version support policy: https://github.com/visulima/visulima#supported-runtimes`
67
- );
68
- exitProcess(1);
69
- }
70
- context.logger.debug(`Runtime version check passed: ${runtime.type} ${runtime.version} >= ${minVersion}`);
71
- },
72
- name: "runtime-version-check",
73
- version: "1.0.0"
74
- };
75
- };
76
-
77
- export { runtimeVersionCheckPlugin };
1
+ import{c as p,e as c,g as v}from"../packem_shared/runtime-process-Dmz0vCJy.js";const i=r=>{if(!r||typeof r!="string")return 0;const o=r.split(".");if(o.length===0||!o[0])return 0;const e=Number.parseInt(o[0],10);return Number.isNaN(e)?0:e},a=r=>!r||typeof r!="string"?"":r.replace("v",""),d=()=>{if(typeof Bun<"u"){const e=Bun.version||"";return{major:i(e),type:"bun",version:e}}if(typeof Deno<"u"){const e=Deno.version?.deno||"";return{major:i(e),type:"deno",version:e}}const r=v().node??"",o=a(r);return{major:i(o),type:"node",version:o}},y=(r={})=>({description:"Checks if the current runtime version meets the minimum requirement",init:o=>{const e=d(),m={bun:1,deno:1,node:18};let n;try{const s=p().CEREBRO_MIN_NODE_VERSION,u=s===void 0?void 0:Number.parseInt(s,10);n=Number.isNaN(u)?void 0:u}catch{n=void 0}let t;r.runtimes?.[e.type]?.minVersion!==void 0?t=r.runtimes[e.type].minVersion:e.type==="node"&&n!==void 0?t=n:t=m[e.type],e.major<t&&(o.logger.error(`cerebro requires ${e.type} version ${String(t)} or higher. You have ${e.type} ${e.version}. Read our version support policy: https://github.com/visulima/visulima#supported-runtimes`),c(1)),o.logger.debug(`Runtime version check passed: ${e.type} ${e.version} >= ${String(t)}`)},name:"runtime-version-check",version:"1.0.0"});export{y as runtimeVersionCheckPlugin};
@@ -1,9 +1,29 @@
1
- import type { Plugin } from "../../types/plugin.d.ts";
2
- import type { UpdateNotifierOptions } from "./has-new-version.d.ts";
3
- export type UpdateNotifierPluginOptions = Partial<Omit<UpdateNotifierOptions, "debug" | "pkg">>;
1
+ import { a as CerebroFs, P as Plugin } from "../../packem_shared/command.d-DbhtfXF4.js";
2
+ import '@visulima/tabular';
3
+ type UpdateNotifierOptions = {
4
+ alwaysRun?: boolean;
5
+ debug?: boolean;
6
+ distTag?: string;
7
+ /**
8
+ * Injectable filesystem adapter used to read/write the last-update-check
9
+ * cache. The plugin passes `toolbox.fs` so MCP / sandboxed runtimes can swap
10
+ * the filesystem; defaults to a `node:fs/promises` wrapper when omitted.
11
+ */
12
+ fs?: Pick<CerebroFs, "access" | "mkdir" | "readFile" | "writeFile">;
13
+ pkg: {
14
+ name: string;
15
+ version: string;
16
+ };
17
+ registryUrl?: string;
18
+ shouldNotifyInNpmScript?: boolean; /** Timeout (ms) for the registry request. Defaults to 5000. */
19
+ timeout?: number;
20
+ updateCheckInterval?: number;
21
+ };
22
+ type UpdateNotifierPluginOptions = Partial<Omit<UpdateNotifierOptions, "debug" | "fs" | "pkg">>;
4
23
  /**
5
- * Create an update notifier plugin that checks for package updates.
6
- * @param options Update notifier configuration options.
7
- * @returns Plugin instance.
8
- */
9
- export declare const updateNotifierPlugin: (options?: UpdateNotifierPluginOptions) => Plugin;
24
+ * Create an update notifier plugin that checks for package updates.
25
+ * @param options Update notifier configuration options.
26
+ * @returns Plugin instance.
27
+ */
28
+ declare const updateNotifierPlugin: (options?: UpdateNotifierPluginOptions) => Plugin;
29
+ export { type UpdateNotifierPluginOptions, updateNotifierPlugin };
@@ -1,517 +1 @@
1
- import { d as getEnv } from '../../packem_shared/runtime-process-B6ZplyWn.js';
2
-
3
- var ciInfo = {};
4
-
5
- var vendors;
6
- var hasRequiredVendors;
7
-
8
- function requireVendors () {
9
- if (hasRequiredVendors) return vendors;
10
- hasRequiredVendors = 1;
11
- vendors = [
12
- {
13
- name: "Agola CI",
14
- constant: "AGOLA",
15
- env: "AGOLA_GIT_REF",
16
- pr: "AGOLA_PULL_REQUEST_ID"
17
- },
18
- {
19
- name: "Alpic",
20
- constant: "ALPIC",
21
- env: "ALPIC_HOST"
22
- },
23
- {
24
- name: "Appcircle",
25
- constant: "APPCIRCLE",
26
- env: "AC_APPCIRCLE",
27
- pr: {
28
- env: "AC_GIT_PR",
29
- ne: "false"
30
- }
31
- },
32
- {
33
- name: "AppVeyor",
34
- constant: "APPVEYOR",
35
- env: "APPVEYOR",
36
- pr: "APPVEYOR_PULL_REQUEST_NUMBER"
37
- },
38
- {
39
- name: "AWS CodeBuild",
40
- constant: "CODEBUILD",
41
- env: "CODEBUILD_BUILD_ARN",
42
- pr: {
43
- env: "CODEBUILD_WEBHOOK_EVENT",
44
- any: [
45
- "PULL_REQUEST_CREATED",
46
- "PULL_REQUEST_UPDATED",
47
- "PULL_REQUEST_REOPENED"
48
- ]
49
- }
50
- },
51
- {
52
- name: "Azure Pipelines",
53
- constant: "AZURE_PIPELINES",
54
- env: "TF_BUILD",
55
- pr: {
56
- BUILD_REASON: "PullRequest"
57
- }
58
- },
59
- {
60
- name: "Bamboo",
61
- constant: "BAMBOO",
62
- env: "bamboo_planKey"
63
- },
64
- {
65
- name: "Bitbucket Pipelines",
66
- constant: "BITBUCKET",
67
- env: "BITBUCKET_COMMIT",
68
- pr: "BITBUCKET_PR_ID"
69
- },
70
- {
71
- name: "Bitrise",
72
- constant: "BITRISE",
73
- env: "BITRISE_IO",
74
- pr: "BITRISE_PULL_REQUEST"
75
- },
76
- {
77
- name: "Buddy",
78
- constant: "BUDDY",
79
- env: "BUDDY_WORKSPACE_ID",
80
- pr: "BUDDY_EXECUTION_PULL_REQUEST_ID"
81
- },
82
- {
83
- name: "Buildkite",
84
- constant: "BUILDKITE",
85
- env: "BUILDKITE",
86
- pr: {
87
- env: "BUILDKITE_PULL_REQUEST",
88
- ne: "false"
89
- }
90
- },
91
- {
92
- name: "CircleCI",
93
- constant: "CIRCLE",
94
- env: "CIRCLECI",
95
- pr: "CIRCLE_PULL_REQUEST"
96
- },
97
- {
98
- name: "Cirrus CI",
99
- constant: "CIRRUS",
100
- env: "CIRRUS_CI",
101
- pr: "CIRRUS_PR"
102
- },
103
- {
104
- name: "Cloudflare Pages",
105
- constant: "CLOUDFLARE_PAGES",
106
- env: "CF_PAGES"
107
- },
108
- {
109
- name: "Cloudflare Workers",
110
- constant: "CLOUDFLARE_WORKERS",
111
- env: "WORKERS_CI"
112
- },
113
- {
114
- name: "Codefresh",
115
- constant: "CODEFRESH",
116
- env: "CF_BUILD_ID",
117
- pr: {
118
- any: [
119
- "CF_PULL_REQUEST_NUMBER",
120
- "CF_PULL_REQUEST_ID"
121
- ]
122
- }
123
- },
124
- {
125
- name: "Codemagic",
126
- constant: "CODEMAGIC",
127
- env: "CM_BUILD_ID",
128
- pr: "CM_PULL_REQUEST"
129
- },
130
- {
131
- name: "Codeship",
132
- constant: "CODESHIP",
133
- env: {
134
- CI_NAME: "codeship"
135
- }
136
- },
137
- {
138
- name: "Drone",
139
- constant: "DRONE",
140
- env: "DRONE",
141
- pr: {
142
- DRONE_BUILD_EVENT: "pull_request"
143
- }
144
- },
145
- {
146
- name: "dsari",
147
- constant: "DSARI",
148
- env: "DSARI"
149
- },
150
- {
151
- name: "Earthly",
152
- constant: "EARTHLY",
153
- env: "EARTHLY_CI"
154
- },
155
- {
156
- name: "Expo Application Services",
157
- constant: "EAS",
158
- env: "EAS_BUILD"
159
- },
160
- {
161
- name: "Gerrit",
162
- constant: "GERRIT",
163
- env: "GERRIT_PROJECT"
164
- },
165
- {
166
- name: "Gitea Actions",
167
- constant: "GITEA_ACTIONS",
168
- env: "GITEA_ACTIONS"
169
- },
170
- {
171
- name: "GitHub Actions",
172
- constant: "GITHUB_ACTIONS",
173
- env: "GITHUB_ACTIONS",
174
- pr: {
175
- GITHUB_EVENT_NAME: "pull_request"
176
- }
177
- },
178
- {
179
- name: "GitLab CI",
180
- constant: "GITLAB",
181
- env: "GITLAB_CI",
182
- pr: "CI_MERGE_REQUEST_ID"
183
- },
184
- {
185
- name: "GoCD",
186
- constant: "GOCD",
187
- env: "GO_PIPELINE_LABEL"
188
- },
189
- {
190
- name: "Google Cloud Build",
191
- constant: "GOOGLE_CLOUD_BUILD",
192
- env: "BUILDER_OUTPUT"
193
- },
194
- {
195
- name: "Harness CI",
196
- constant: "HARNESS",
197
- env: "HARNESS_BUILD_ID"
198
- },
199
- {
200
- name: "Heroku",
201
- constant: "HEROKU",
202
- env: {
203
- env: "NODE",
204
- includes: "/app/.heroku/node/bin/node"
205
- }
206
- },
207
- {
208
- name: "Hudson",
209
- constant: "HUDSON",
210
- env: "HUDSON_URL"
211
- },
212
- {
213
- name: "Jenkins",
214
- constant: "JENKINS",
215
- env: [
216
- "JENKINS_URL",
217
- "BUILD_ID"
218
- ],
219
- pr: {
220
- any: [
221
- "ghprbPullId",
222
- "CHANGE_ID"
223
- ]
224
- }
225
- },
226
- {
227
- name: "LayerCI",
228
- constant: "LAYERCI",
229
- env: "LAYERCI",
230
- pr: "LAYERCI_PULL_REQUEST"
231
- },
232
- {
233
- name: "Magnum CI",
234
- constant: "MAGNUM",
235
- env: "MAGNUM"
236
- },
237
- {
238
- name: "Netlify CI",
239
- constant: "NETLIFY",
240
- env: "NETLIFY",
241
- pr: {
242
- env: "PULL_REQUEST",
243
- ne: "false"
244
- }
245
- },
246
- {
247
- name: "Nevercode",
248
- constant: "NEVERCODE",
249
- env: "NEVERCODE",
250
- pr: {
251
- env: "NEVERCODE_PULL_REQUEST",
252
- ne: "false"
253
- }
254
- },
255
- {
256
- name: "Prow",
257
- constant: "PROW",
258
- env: "PROW_JOB_ID"
259
- },
260
- {
261
- name: "ReleaseHub",
262
- constant: "RELEASEHUB",
263
- env: "RELEASE_BUILD_ID"
264
- },
265
- {
266
- name: "Render",
267
- constant: "RENDER",
268
- env: "RENDER",
269
- pr: {
270
- IS_PULL_REQUEST: "true"
271
- }
272
- },
273
- {
274
- name: "Sail CI",
275
- constant: "SAIL",
276
- env: "SAILCI",
277
- pr: "SAIL_PULL_REQUEST_NUMBER"
278
- },
279
- {
280
- name: "Screwdriver",
281
- constant: "SCREWDRIVER",
282
- env: "SCREWDRIVER",
283
- pr: {
284
- env: "SD_PULL_REQUEST",
285
- ne: "false"
286
- }
287
- },
288
- {
289
- name: "Semaphore",
290
- constant: "SEMAPHORE",
291
- env: "SEMAPHORE",
292
- pr: "PULL_REQUEST_NUMBER"
293
- },
294
- {
295
- name: "Sourcehut",
296
- constant: "SOURCEHUT",
297
- env: {
298
- CI_NAME: "sourcehut"
299
- }
300
- },
301
- {
302
- name: "Strider CD",
303
- constant: "STRIDER",
304
- env: "STRIDER"
305
- },
306
- {
307
- name: "TaskCluster",
308
- constant: "TASKCLUSTER",
309
- env: [
310
- "TASK_ID",
311
- "RUN_ID"
312
- ]
313
- },
314
- {
315
- name: "TeamCity",
316
- constant: "TEAMCITY",
317
- env: "TEAMCITY_VERSION"
318
- },
319
- {
320
- name: "Travis CI",
321
- constant: "TRAVIS",
322
- env: "TRAVIS",
323
- pr: {
324
- env: "TRAVIS_PULL_REQUEST",
325
- ne: "false"
326
- }
327
- },
328
- {
329
- name: "Vela",
330
- constant: "VELA",
331
- env: "VELA",
332
- pr: {
333
- VELA_PULL_REQUEST: "1"
334
- }
335
- },
336
- {
337
- name: "Vercel",
338
- constant: "VERCEL",
339
- env: {
340
- any: [
341
- "NOW_BUILDER",
342
- "VERCEL"
343
- ]
344
- },
345
- pr: "VERCEL_GIT_PULL_REQUEST_ID"
346
- },
347
- {
348
- name: "Visual Studio App Center",
349
- constant: "APPCENTER",
350
- env: "APPCENTER_BUILD_ID"
351
- },
352
- {
353
- name: "Woodpecker",
354
- constant: "WOODPECKER",
355
- env: {
356
- CI: "woodpecker"
357
- },
358
- pr: {
359
- CI_BUILD_EVENT: "pull_request"
360
- }
361
- },
362
- {
363
- name: "Xcode Cloud",
364
- constant: "XCODE_CLOUD",
365
- env: "CI_XCODE_PROJECT",
366
- pr: "CI_PULL_REQUEST_NUMBER"
367
- },
368
- {
369
- name: "Xcode Server",
370
- constant: "XCODE_SERVER",
371
- env: "XCS"
372
- }
373
- ];
374
- return vendors;
375
- }
376
-
377
- var hasRequiredCiInfo;
378
-
379
- function requireCiInfo () {
380
- if (hasRequiredCiInfo) return ciInfo;
381
- hasRequiredCiInfo = 1;
382
- (function (exports$1) {
383
- const vendors = requireVendors();
384
- const env = process.env;
385
- Object.defineProperty(exports$1, "_vendors", {
386
- value: vendors.map(function(v) {
387
- return v.constant;
388
- })
389
- });
390
- exports$1.name = null;
391
- exports$1.isPR = null;
392
- exports$1.id = null;
393
- if (env.CI !== "false") {
394
- vendors.forEach(function(vendor) {
395
- const envs = Array.isArray(vendor.env) ? vendor.env : [vendor.env];
396
- const isCI = envs.every(function(obj) {
397
- return checkEnv(obj);
398
- });
399
- exports$1[vendor.constant] = isCI;
400
- if (!isCI) {
401
- return;
402
- }
403
- exports$1.name = vendor.name;
404
- exports$1.isPR = checkPR(vendor);
405
- exports$1.id = vendor.constant;
406
- });
407
- }
408
- exports$1.isCI = !!(env.CI !== "false" && // Bypass all checks if CI env is explicitly set to 'false'
409
- (env.BUILD_ID || // Jenkins, Cloudbees
410
- env.BUILD_NUMBER || // Jenkins, TeamCity
411
- env.CI || // Travis CI, CircleCI, Cirrus CI, Gitlab CI, Appveyor, CodeShip, dsari, Cloudflare Pages/Workers
412
- env.CI_APP_ID || // Appflow
413
- env.CI_BUILD_ID || // Appflow
414
- env.CI_BUILD_NUMBER || // Appflow
415
- env.CI_NAME || // Codeship and others
416
- env.CONTINUOUS_INTEGRATION || // Travis CI, Cirrus CI
417
- env.RUN_ID || // TaskCluster, dsari
418
- exports$1.name || false));
419
- function checkEnv(obj) {
420
- if (typeof obj === "string") return !!env[obj];
421
- if ("env" in obj) {
422
- return env[obj.env] && env[obj.env].includes(obj.includes);
423
- }
424
- if ("any" in obj) {
425
- return obj.any.some(function(k) {
426
- return !!env[k];
427
- });
428
- }
429
- return Object.keys(obj).every(function(k) {
430
- return env[k] === obj[k];
431
- });
432
- }
433
- function checkPR(vendor) {
434
- switch (typeof vendor.pr) {
435
- case "string":
436
- return !!env[vendor.pr];
437
- case "object":
438
- if ("env" in vendor.pr) {
439
- if ("any" in vendor.pr) {
440
- return vendor.pr.any.some(function(key) {
441
- return env[vendor.pr.env] === key;
442
- });
443
- } else {
444
- return vendor.pr.env in env && env[vendor.pr.env] !== vendor.pr.ne;
445
- }
446
- } else if ("any" in vendor.pr) {
447
- return vendor.pr.any.some(function(key) {
448
- return !!env[key];
449
- });
450
- } else {
451
- return checkEnv(vendor.pr);
452
- }
453
- default:
454
- return null;
455
- }
456
- }
457
- } (ciInfo));
458
- return ciInfo;
459
- }
460
-
461
- var ciInfoExports = requireCiInfo();
462
-
463
- const updateNotifierPlugin = (options = {}) => {
464
- return {
465
- beforeCommand: async (toolbox) => {
466
- const { logger, runtime } = toolbox;
467
- const packageName = runtime.getPackageName();
468
- const packageVersion = runtime.getPackageVersion();
469
- if (!packageName || !packageVersion) {
470
- logger.debug("Update notifier: package name or version not provided, skipping...");
471
- return;
472
- }
473
- const env = getEnv();
474
- const updateNotifierOptions = {
475
- alwaysRun: false,
476
- debug: env.CEREBRO_OUTPUT_LEVEL === "256",
477
- distTag: "latest",
478
- pkg: {
479
- name: packageName,
480
- version: packageVersion
481
- },
482
- updateCheckInterval: 1e3 * 60 * 60 * 24,
483
- ...options
484
- };
485
- const shouldCheck = updateNotifierOptions.alwaysRun || !(env.NO_UPDATE_NOTIFIER || env.NODE_ENV === "test" || toolbox.argv.includes("--no-update-notifier") || ciInfoExports.isCI);
486
- if (!shouldCheck) {
487
- logger.debug("Update notifier: skipping check (disabled by environment or flags)");
488
- return;
489
- }
490
- (logger?.raw ?? logger.log)("Checking for updates...");
491
- try {
492
- const hasNewVersion = await import('../../packem_chunks/has-new-version.js').then((m) => m.default);
493
- const updateAvailable = await hasNewVersion(updateNotifierOptions);
494
- if (updateAvailable) {
495
- const [{ boxen }, { dim, green, reset, yellow }] = await Promise.all([import('@visulima/boxen'), import('@visulima/colorize')]);
496
- const template = `Update available ${dim(packageVersion.toString())}${reset(" → ")}${green(updateAvailable)}`;
497
- logger.error(
498
- boxen(template, {
499
- borderColor: (border) => yellow(border),
500
- borderStyle: "round",
501
- margin: 1,
502
- padding: 1,
503
- textAlignment: "center"
504
- })
505
- );
506
- }
507
- } catch (error) {
508
- logger.debug("Update notifier: failed to check for updates", error);
509
- }
510
- },
511
- description: "Checks for package updates and notifies users",
512
- name: "update-notifier",
513
- version: "1.0.0"
514
- };
515
- };
516
-
517
- export { updateNotifierPlugin };
1
+ import{c as A}from"../../packem_shared/runtime-process-Dmz0vCJy.js";var R={},c,C;function p(){return C||(C=1,c=[{name:"Agola CI",constant:"AGOLA",env:"AGOLA_GIT_REF",pr:"AGOLA_PULL_REQUEST_ID"},{name:"Alpic",constant:"ALPIC",env:"ALPIC_HOST"},{name:"Appcircle",constant:"APPCIRCLE",env:"AC_APPCIRCLE",pr:{env:"AC_GIT_PR",ne:"false"}},{name:"AppVeyor",constant:"APPVEYOR",env:"APPVEYOR",pr:"APPVEYOR_PULL_REQUEST_NUMBER"},{name:"AWS CodeBuild",constant:"CODEBUILD",env:"CODEBUILD_BUILD_ARN",pr:{env:"CODEBUILD_WEBHOOK_EVENT",any:["PULL_REQUEST_CREATED","PULL_REQUEST_UPDATED","PULL_REQUEST_REOPENED"]}},{name:"Azure Pipelines",constant:"AZURE_PIPELINES",env:"TF_BUILD",pr:{BUILD_REASON:"PullRequest"}},{name:"Bamboo",constant:"BAMBOO",env:"bamboo_planKey"},{name:"Bitbucket Pipelines",constant:"BITBUCKET",env:"BITBUCKET_COMMIT",pr:"BITBUCKET_PR_ID"},{name:"Bitrise",constant:"BITRISE",env:"BITRISE_IO",pr:"BITRISE_PULL_REQUEST"},{name:"Buddy",constant:"BUDDY",env:"BUDDY_WORKSPACE_ID",pr:"BUDDY_EXECUTION_PULL_REQUEST_ID"},{name:"Buildkite",constant:"BUILDKITE",env:"BUILDKITE",pr:{env:"BUILDKITE_PULL_REQUEST",ne:"false"}},{name:"CircleCI",constant:"CIRCLE",env:"CIRCLECI",pr:"CIRCLE_PULL_REQUEST"},{name:"Cirrus CI",constant:"CIRRUS",env:"CIRRUS_CI",pr:"CIRRUS_PR"},{name:"Cloudflare Pages",constant:"CLOUDFLARE_PAGES",env:"CF_PAGES"},{name:"Cloudflare Workers",constant:"CLOUDFLARE_WORKERS",env:"WORKERS_CI"},{name:"Codefresh",constant:"CODEFRESH",env:"CF_BUILD_ID",pr:{any:["CF_PULL_REQUEST_NUMBER","CF_PULL_REQUEST_ID"]}},{name:"Codemagic",constant:"CODEMAGIC",env:"CM_BUILD_ID",pr:"CM_PULL_REQUEST"},{name:"Codeship",constant:"CODESHIP",env:{CI_NAME:"codeship"}},{name:"Drone",constant:"DRONE",env:"DRONE",pr:{DRONE_BUILD_EVENT:"pull_request"}},{name:"dsari",constant:"DSARI",env:"DSARI"},{name:"Earthly",constant:"EARTHLY",env:"EARTHLY_CI"},{name:"Expo Application Services",constant:"EAS",env:"EAS_BUILD"},{name:"Gerrit",constant:"GERRIT",env:"GERRIT_PROJECT"},{name:"Gitea Actions",constant:"GITEA_ACTIONS",env:"GITEA_ACTIONS"},{name:"GitHub Actions",constant:"GITHUB_ACTIONS",env:"GITHUB_ACTIONS",pr:{GITHUB_EVENT_NAME:"pull_request"}},{name:"GitLab CI",constant:"GITLAB",env:"GITLAB_CI",pr:"CI_MERGE_REQUEST_ID"},{name:"GoCD",constant:"GOCD",env:"GO_PIPELINE_LABEL"},{name:"Google Cloud Build",constant:"GOOGLE_CLOUD_BUILD",env:"BUILDER_OUTPUT"},{name:"Harness CI",constant:"HARNESS",env:"HARNESS_BUILD_ID"},{name:"Heroku",constant:"HEROKU",env:{env:"NODE",includes:"/app/.heroku/node/bin/node"}},{name:"Hudson",constant:"HUDSON",env:"HUDSON_URL"},{name:"Jenkins",constant:"JENKINS",env:["JENKINS_URL","BUILD_ID"],pr:{any:["ghprbPullId","CHANGE_ID"]}},{name:"LayerCI",constant:"LAYERCI",env:"LAYERCI",pr:"LAYERCI_PULL_REQUEST"},{name:"Magnum CI",constant:"MAGNUM",env:"MAGNUM"},{name:"Netlify CI",constant:"NETLIFY",env:"NETLIFY",pr:{env:"PULL_REQUEST",ne:"false"}},{name:"Nevercode",constant:"NEVERCODE",env:"NEVERCODE",pr:{env:"NEVERCODE_PULL_REQUEST",ne:"false"}},{name:"Prow",constant:"PROW",env:"PROW_JOB_ID"},{name:"ReleaseHub",constant:"RELEASEHUB",env:"RELEASE_BUILD_ID"},{name:"Render",constant:"RENDER",env:"RENDER",pr:{IS_PULL_REQUEST:"true"}},{name:"Sail CI",constant:"SAIL",env:"SAILCI",pr:"SAIL_PULL_REQUEST_NUMBER"},{name:"Screwdriver",constant:"SCREWDRIVER",env:"SCREWDRIVER",pr:{env:"SD_PULL_REQUEST",ne:"false"}},{name:"Semaphore",constant:"SEMAPHORE",env:"SEMAPHORE",pr:"PULL_REQUEST_NUMBER"},{name:"Sourcehut",constant:"SOURCEHUT",env:{CI_NAME:"sourcehut"}},{name:"Strider CD",constant:"STRIDER",env:"STRIDER"},{name:"TaskCluster",constant:"TASKCLUSTER",env:["TASK_ID","RUN_ID"]},{name:"TeamCity",constant:"TEAMCITY",env:"TEAMCITY_VERSION"},{name:"Travis CI",constant:"TRAVIS",env:"TRAVIS",pr:{env:"TRAVIS_PULL_REQUEST",ne:"false"}},{name:"Vela",constant:"VELA",env:"VELA",pr:{VELA_PULL_REQUEST:"1"}},{name:"Vercel",constant:"VERCEL",env:{any:["NOW_BUILDER","VERCEL"]},pr:"VERCEL_GIT_PULL_REQUEST_ID"},{name:"Visual Studio App Center",constant:"APPCENTER",env:"APPCENTER_BUILD_ID"},{name:"Woodpecker",constant:"WOODPECKER",env:{CI:"woodpecker"},pr:{CI_BUILD_EVENT:"pull_request"}},{name:"Xcode Cloud",constant:"XCODE_CLOUD",env:"CI_XCODE_PROJECT",pr:"CI_PULL_REQUEST_NUMBER"},{name:"Xcode Server",constant:"XCODE_SERVER",env:"XCS"}]),c}var U;function m(){return U||(U=1,(function(a){const r=p(),e=process.env;Object.defineProperty(a,"_vendors",{value:r.map(function(n){return n.constant})}),a.name=null,a.isPR=null,a.id=null,e.CI!=="false"&&r.forEach(function(n){const t=(Array.isArray(n.env)?n.env:[n.env]).every(function(o){return E(o)});a[n.constant]=t,t&&(a.name=n.name,a.isPR=I(n),a.id=n.constant)}),a.isCI=!!(e.CI!=="false"&&(e.BUILD_ID||e.BUILD_NUMBER||e.CI||e.CI_APP_ID||e.CI_BUILD_ID||e.CI_BUILD_NUMBER||e.CI_NAME||e.CONTINUOUS_INTEGRATION||e.RUN_ID||a.name));function E(n){return typeof n=="string"?!!e[n]:"env"in n?e[n.env]&&e[n.env].includes(n.includes):"any"in n?n.any.some(function(t){return!!e[t]}):Object.keys(n).every(function(t){return e[t]===n[t]})}function I(n){switch(typeof n.pr){case"string":return!!e[n.pr];case"object":return"env"in n.pr?"any"in n.pr?n.pr.any.some(function(t){return e[n.pr.env]===t}):n.pr.env in e&&e[n.pr.env]!==n.pr.ne:"any"in n.pr?n.pr.any.some(function(t){return!!e[t]}):E(n.pr);default:return null}}})(R)),R}var l=m();const P=5e3,O=(a={})=>({beforeCommand:async r=>{const{fs:e,logger:E,runtime:I}=r,n=I.getPackageName(),t=I.getPackageVersion();if(!n||!t){E.debug("Update notifier: package name or version not provided, skipping...");return}const o=A(),i={alwaysRun:!1,debug:o.CEREBRO_OUTPUT_LEVEL==="256",distTag:"latest",fs:e,pkg:{name:n,version:t},timeout:P,updateCheckInterval:1e3*60*60*24,...a};if(!(i.alwaysRun||!(o.NO_UPDATE_NOTIFIER||o.NODE_ENV==="test"||r.argv.includes("--no-update-notifier")||l.isCI))){E.debug("Update notifier: skipping check (disabled by environment or flags)");return}try{const _=await(await import("../../packem_chunks/has-new-version.js").then(s=>s.default))(i);if(_){const[{boxen:s},{dim:L,green:v,reset:T,yellow:u}]=await Promise.all([import("@visulima/boxen"),import("@visulima/colorize")]),D=`Update available ${L(t)}${T(" → ")}${v(_)}`;E.log(s(D,{borderColor:S=>u(S),borderStyle:"round",margin:1,padding:1,textAlignment:"center"}))}}catch(_){E.debug("Update notifier: failed to check for updates",_)}},description:"Checks for package updates and notifies users",name:"update-notifier",version:"1.0.0"});export{O as updateNotifierPlugin};
@@ -0,0 +1,41 @@
1
+ /**
2
+ * V8 compile cache helper for faster CLI startup.
3
+ *
4
+ * Enables the V8 compile cache so that subsequent runs of the CLI skip
5
+ * re-parsing and re-compiling JavaScript/TypeScript source files. This
6
+ * can reduce startup time by 30-70% for large CLI tools.
7
+ *
8
+ * ## When to use
9
+ *
10
+ * Call `enableCompileCache()` early in your CLI entry point, after heap
11
+ * tuning but before importing heavy modules:
12
+ *
13
+ * ```typescript
14
+ * // bin.ts
15
+ * import { applyHeapTuning } from "@visulima/cerebro/heap-tuning";
16
+ * import { enableCompileCache } from "@visulima/cerebro/compile-cache";
17
+ *
18
+ * applyHeapTuning();
19
+ * enableCompileCache();
20
+ *
21
+ * import { createCerebro } from "@visulima/cerebro";
22
+ * // ... rest of your CLI setup
23
+ * ```
24
+ *
25
+ * ## How it works
26
+ *
27
+ * 1. Tries `module.enableCompileCache()` (Node.js 22.8+ native API) which
28
+ * stores compiled bytecode alongside source files for instant reuse.
29
+ * 2. If that's unavailable, falls back to the `v8-compile-cache` npm package
30
+ * which achieves a similar effect on older Node.js versions.
31
+ * 3. If neither is available, silently does nothing — startup is just slower.
32
+ * @module
33
+ */
34
+ /**
35
+ * Enable V8 compile cache for faster subsequent CLI startups.
36
+ *
37
+ * Safe to call unconditionally — silently no-ops if the runtime doesn't
38
+ * support compile caching or the fallback package isn't installed.
39
+ */
40
+ declare const enableCompileCache: () => void;
41
+ export { enableCompileCache as default };
@@ -0,0 +1 @@
1
+ const t=()=>{try{const e=require("node:module");if(typeof e.enableCompileCache=="function"){e.enableCompileCache();return}}catch{}try{require("v8-compile-cache")}catch{}};export{t as default};