@logbrew/sdk 0.1.38 → 0.1.39

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 (90) hide show
  1. package/automatic-delivery.cjs +271 -0
  2. package/batch-sender.cjs +164 -0
  3. package/bounded-number.cjs +34 -0
  4. package/browser-breadcrumbs.cjs +346 -136
  5. package/capture-support.cjs +100 -0
  6. package/client-options.cjs +292 -0
  7. package/client-report.cjs +232 -0
  8. package/client.cjs +447 -0
  9. package/console-arguments.cjs +151 -0
  10. package/console-capture.cjs +194 -0
  11. package/core.cjs +30 -2810
  12. package/delivery-health.cjs +133 -0
  13. package/error-causes.cjs +130 -0
  14. package/error-details.cjs +124 -0
  15. package/error-issue.cjs +187 -0
  16. package/event-clone.cjs +55 -0
  17. package/event-metadata.cjs +40 -0
  18. package/event-pipeline.cjs +325 -0
  19. package/event-queue.cjs +306 -0
  20. package/event-store.cjs +237 -0
  21. package/event-validation.cjs +159 -0
  22. package/examples/agent-timeline.cjs +57 -46
  23. package/examples/agent-timeline.mjs +41 -35
  24. package/examples/index.mjs +122 -94
  25. package/examples/readme-example.cjs +36 -27
  26. package/examples/readme-example.mjs +21 -17
  27. package/examples/real-user-smoke.cjs +41 -32
  28. package/examples/real-user-smoke.mjs +26 -22
  29. package/exception-chain.cjs +205 -0
  30. package/index.d.ts +144 -1076
  31. package/index.js +1 -1
  32. package/issue-exception.cjs +13 -8
  33. package/metric-validation.cjs +95 -0
  34. package/network-milestone.cjs +155 -0
  35. package/null-value.cjs +4 -0
  36. package/opentelemetry-bridge.cjs +330 -0
  37. package/opentelemetry-context.cjs +245 -0
  38. package/opentelemetry-exceptions.cjs +69 -0
  39. package/opentelemetry-keys.cjs +183 -0
  40. package/opentelemetry-span.cjs +286 -0
  41. package/opentelemetry-summary.cjs +213 -0
  42. package/opentelemetry-time.cjs +131 -0
  43. package/opentelemetry.cjs +99 -1068
  44. package/package.json +55 -1
  45. package/pino-destination.cjs +108 -0
  46. package/pino-record.cjs +237 -0
  47. package/product-action.cjs +163 -0
  48. package/provided-breadcrumbs.cjs +117 -0
  49. package/random-hex.cjs +29 -0
  50. package/react-native.js +1 -1
  51. package/recording-transport.cjs +68 -0
  52. package/release-artifacts-build.cjs +263 -84
  53. package/release-artifacts-common.js +347 -66
  54. package/release-artifacts-debug-id.js +178 -0
  55. package/release-artifacts-inspect.js +213 -0
  56. package/release-artifacts-issue-event.js +99 -0
  57. package/release-artifacts-manifest-artifact.js +107 -0
  58. package/release-artifacts-manifest.js +77 -0
  59. package/release-artifacts-mappings.js +265 -0
  60. package/release-artifacts-prepare.js +297 -0
  61. package/release-artifacts-source-context.js +210 -0
  62. package/release-artifacts-symbolication.js +272 -421
  63. package/release-artifacts-upload-files.js +122 -0
  64. package/release-artifacts-upload-request.js +246 -0
  65. package/release-artifacts-upload.js +155 -300
  66. package/release-artifacts-urls.js +49 -0
  67. package/release-artifacts.js +189 -662
  68. package/retry-delay.cjs +32 -0
  69. package/span-validation.cjs +191 -0
  70. package/stored-events.cjs +243 -0
  71. package/types/client.d.ts +67 -0
  72. package/types/delivery.d.ts +125 -0
  73. package/types/issues.d.ts +249 -0
  74. package/types/logging.d.ts +175 -0
  75. package/types/opentelemetry.d.ts +205 -0
  76. package/types/product.d.ts +128 -0
  77. package/types/recording-transport.d.ts +15 -0
  78. package/types/sdk-error.d.ts +9 -0
  79. package/types/telemetry.d.ts +171 -0
  80. package/types/trace-context.d.ts +110 -0
  81. package/types/transport-error.d.ts +10 -0
  82. package/utf8.cjs +37 -0
  83. package/validation.cjs +49 -1
  84. package/vite-release-artifacts-config.cjs +120 -0
  85. package/vite-release-artifacts.cjs +199 -99
  86. package/vite-release-artifacts.d.cts +65 -40
  87. package/vite-release-artifacts.d.ts +65 -40
  88. package/vite-release-artifacts.js +2 -2
  89. package/winston-info.cjs +205 -0
  90. package/winston.cjs +189 -289
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
 
3
- const fs = require("node:fs");
3
+ const { mkdir, writeFile } = require("node:fs/promises");
4
4
  const path = require("node:path");
5
5
 
6
6
  const {
@@ -8,25 +8,74 @@ const {
8
8
  formatReleaseArtifactUploadSummary,
9
9
  normalizeReleaseArtifactProjectId,
10
10
  normalizeReleaseArtifactUploadOptions,
11
- runReleaseArtifactCli,
11
+ runReleaseArtifactCli
12
12
  } = require("./release-artifacts-build.cjs");
13
+ const { viteConfigChanges } = require("./vite-release-artifacts-config.cjs");
14
+
15
+ /**
16
+ * @import { ReleaseArtifactUploadOptions } from "./release-artifacts-build.cjs"
17
+ * @import { ViteConfigChanges, ViteUserConfig } from "./vite-release-artifacts-config.cjs"
18
+ * @typedef {{ readonly info: (message: string) => void }} ViteLogger
19
+ * @typedef {{
20
+ * readonly build?: { readonly outDir?: string | null } | null,
21
+ * readonly logger?: ViteLogger | null,
22
+ * readonly root?: string | null
23
+ * }} ViteResolvedConfig
24
+ * @typedef {{
25
+ * readonly commitSha: string | undefined,
26
+ * readonly enableSourceMaps: boolean,
27
+ * readonly environment: string,
28
+ * readonly explicitBuildDir: string | undefined,
29
+ * readonly explicitManifestPath: string | undefined,
30
+ * readonly minifiedPathPrefix: string,
31
+ * readonly projectId: string | undefined,
32
+ * readonly release: string,
33
+ * readonly repositoryUrl: string | undefined,
34
+ * readonly service: string,
35
+ * readonly stripSourcesContent: boolean,
36
+ * readonly upload: ReleaseArtifactUploadOptions | undefined,
37
+ * readonly userSourcePrefixes: readonly string[]
38
+ * }} PluginSettings
39
+ * @typedef {{ readonly logger: ViteLogger | undefined, readonly outDir: string, readonly root: string }} ViteBuildContext
40
+ */
13
41
 
14
42
  const PACKAGE_DIR = path.dirname(require.resolve("./package.json"));
15
43
  const CLI_PATH = path.join(PACKAGE_DIR, "release-artifacts.js");
16
44
  const DEFAULT_MANIFEST_NAME = "logbrew-release-artifacts.json";
45
+ const DEFAULT_OUT_DIR = "dist";
46
+ const NO_PREFIXES = 0;
47
+
48
+ /**
49
+ * @param {unknown} value
50
+ * @param {string} key
51
+ * @returns {unknown}
52
+ */
53
+ function field(value, key) {
54
+ return (typeof value === "object" && value !== null) || typeof value === "function" ? Reflect.get(value, key) : undefined;
55
+ }
17
56
 
57
+ /**
58
+ * @param {unknown} options
59
+ * @param {string} name
60
+ * @returns {string}
61
+ */
18
62
  function requiredString(options, name) {
19
- const value = options?.[name];
63
+ const value = field(options, name);
20
64
  if (typeof value !== "string" || value.trim() === "") {
21
65
  throw new Error(`LogBrew Vite release-artifact plugin requires ${name}`);
22
66
  }
23
67
  return value.trim();
24
68
  }
25
69
 
70
+ /**
71
+ * @param {unknown} options
72
+ * @param {string} name
73
+ * @returns {string | undefined}
74
+ */
26
75
  function optionalString(options, name) {
27
- const value = options?.[name];
76
+ const value = field(options, name);
28
77
  if (value === undefined || value === null) {
29
- return null;
78
+ return undefined;
30
79
  }
31
80
  if (typeof value !== "string" || value.trim() === "") {
32
81
  throw new Error(`LogBrew Vite release-artifact plugin option ${name} must be a non-empty string`);
@@ -34,130 +83,181 @@ function optionalString(options, name) {
34
83
  return value.trim();
35
84
  }
36
85
 
86
+ /**
87
+ * @param {unknown} value
88
+ * @param {string} name
89
+ * @returns {string[]}
90
+ */
37
91
  function normalizeStringArray(value, name) {
38
92
  if (value === undefined || value === null) {
39
93
  return [];
40
94
  }
41
- if (!Array.isArray(value) || value.some((item) => typeof item !== "string" || item.trim() === "")) {
95
+ /** @type {readonly unknown[]} */
96
+ const items = Array.isArray(value) ? value : [value];
97
+ const valid = Array.isArray(value) && items.every((item) => typeof item === "string" && item.trim() !== "");
98
+ if (!valid) {
42
99
  throw new Error(`LogBrew Vite release-artifact plugin option ${name} must be an array of non-empty strings`);
43
100
  }
44
- return value.map((item) => item.trim());
101
+ return items.map((item) => String(item).trim());
45
102
  }
46
103
 
104
+ /**
105
+ * @param {string} root
106
+ * @param {string} value
107
+ * @returns {string}
108
+ */
47
109
  function resolvePathFromRoot(root, value) {
48
110
  return path.isAbsolute(value) ? path.resolve(value) : path.resolve(root, value);
49
111
  }
50
112
 
51
- function resolveBuildDir(root, outDir, explicitBuildDir) {
52
- if (explicitBuildDir) {
53
- return resolvePathFromRoot(root, explicitBuildDir);
54
- }
55
- return resolvePathFromRoot(root, outDir || "dist");
56
- }
57
-
58
- function viteMajorVersion(root) {
59
- try {
60
- const manifestPath = require.resolve("vite/package.json", { paths: [path.resolve(root || process.cwd())] });
61
- const version = JSON.parse(fs.readFileSync(manifestPath, "utf8")).version;
62
- return Number.parseInt(version, 10) || 0;
63
- } catch {
64
- return 0;
65
- }
66
- }
67
-
68
- function createLogBrewViteReleaseArtifactsPlugin(options) {
113
+ /**
114
+ * @param {unknown} options
115
+ * @returns {Pick<PluginSettings, "environment" | "minifiedPathPrefix" | "projectId" | "release" | "service">}
116
+ */
117
+ function releaseIdentity(options) {
69
118
  const release = requiredString(options, "release");
70
119
  const environment = requiredString(options, "environment");
71
120
  const service = requiredString(options, "service");
72
- const projectId = normalizeReleaseArtifactProjectId(options?.projectId, "Vite");
121
+ const projectId = normalizeReleaseArtifactProjectId(field(options, "projectId"), "Vite");
73
122
  const minifiedPathPrefix = requiredString(options, "minifiedPathPrefix");
123
+ return { environment, minifiedPathPrefix, projectId, release, service };
124
+ }
125
+
126
+ /**
127
+ * @param {unknown} options
128
+ * @returns {PluginSettings}
129
+ */
130
+ function pluginSettings(options) {
131
+ const identity = releaseIdentity(options);
74
132
  const repositoryUrl = optionalString(options, "repositoryUrl");
75
133
  const commitSha = optionalString(options, "commitSha");
76
134
  const explicitBuildDir = optionalString(options, "buildDir");
77
135
  const explicitManifestPath = optionalString(options, "manifestPath");
78
- const stripSourcesContent = options?.stripSourcesContent !== false;
79
- const enableSourceMaps = options?.enableSourceMaps !== false;
80
- const userSourcePrefixes = normalizeStringArray(options?.stripSourcePrefix, "stripSourcePrefix");
81
- const upload = normalizeReleaseArtifactUploadOptions(options?.upload, { integration: "Vite", projectId });
82
- let viteRoot = process.cwd();
83
- let viteOutDir = "dist";
84
- let viteLogger = null;
136
+ const stripSourcesContent = field(options, "stripSourcesContent") !== false;
137
+ const enableSourceMaps = field(options, "enableSourceMaps") !== false;
138
+ const userSourcePrefixes = normalizeStringArray(field(options, "stripSourcePrefix"), "stripSourcePrefix");
139
+ return {
140
+ ...identity,
141
+ commitSha,
142
+ enableSourceMaps,
143
+ explicitBuildDir,
144
+ explicitManifestPath,
145
+ repositoryUrl,
146
+ stripSourcesContent,
147
+ upload: normalizeReleaseArtifactUploadOptions(field(options, "upload"), { integration: "Vite", projectId: identity.projectId }),
148
+ userSourcePrefixes
149
+ };
150
+ }
85
151
 
152
+ /**
153
+ * @param {PluginSettings} settings
154
+ * @param {string} buildDir
155
+ * @param {string} root
156
+ * @returns {string[]}
157
+ */
158
+ function prepareArgs({ stripSourcesContent, userSourcePrefixes }, buildDir, root) {
159
+ const sourcePrefixes = userSourcePrefixes.length > NO_PREFIXES ? userSourcePrefixes : [root];
160
+ return [
161
+ "--build-dir",
162
+ buildDir,
163
+ "--write",
164
+ ...(stripSourcesContent ? ["--strip-sources-content"] : []),
165
+ ...sourcePrefixes.flatMap((prefix) => ["--strip-source-prefix", prefix])
166
+ ];
167
+ }
168
+
169
+ /**
170
+ * @param {PluginSettings} settings
171
+ * @param {string} buildDir
172
+ * @returns {string[]}
173
+ */
174
+ function manifestArgs({ commitSha, environment, minifiedPathPrefix, projectId, release, repositoryUrl, service }, buildDir) {
175
+ return [
176
+ "--build-dir",
177
+ buildDir,
178
+ "--release",
179
+ release,
180
+ "--environment",
181
+ environment,
182
+ "--service",
183
+ service,
184
+ "--minified-path-prefix",
185
+ minifiedPathPrefix,
186
+ ...(repositoryUrl === undefined ? [] : ["--repository-url", repositoryUrl]),
187
+ ...(commitSha === undefined ? [] : ["--commit-sha", commitSha]),
188
+ ...(projectId === undefined ? [] : ["--project-id", projectId])
189
+ ];
190
+ }
191
+
192
+ /**
193
+ * @param {PluginSettings} settings
194
+ * @param {ViteBuildContext} context
195
+ * @returns {Promise<void>}
196
+ */
197
+ async function writeReleaseArtifacts(settings, { logger, outDir, root }) {
198
+ const buildDir = resolvePathFromRoot(root, settings.explicitBuildDir ?? outDir);
199
+ const manifestPath = settings.explicitManifestPath === undefined
200
+ ? path.join(buildDir, DEFAULT_MANIFEST_NAME)
201
+ : resolvePathFromRoot(root, settings.explicitManifestPath);
202
+ runReleaseArtifactCli(CLI_PATH, "prepare-js", prepareArgs(settings, buildDir, root));
203
+ const { stdout } = runReleaseArtifactCli(CLI_PATH, "manifest-js", manifestArgs(settings, buildDir));
204
+ await mkdir(path.dirname(manifestPath), { recursive: true });
205
+ await writeFile(manifestPath, stdout, "utf8");
206
+ if (settings.upload !== undefined) {
207
+ const { report } = runReleaseArtifactCli(
208
+ CLI_PATH,
209
+ "upload-js",
210
+ createReleaseArtifactUploadArgs(buildDir, manifestPath, settings.upload)
211
+ );
212
+ logger?.info(formatReleaseArtifactUploadSummary(report));
213
+ }
214
+ }
215
+
216
+ /**
217
+ * @param {ViteResolvedConfig | null | undefined} config
218
+ * @returns {ViteBuildContext}
219
+ */
220
+ function resolvedContext(config) {
221
+ const root = config?.root;
222
+ const outDir = config?.build?.outDir;
223
+ const logger = config?.logger;
224
+ return {
225
+ logger: typeof logger?.info === "function" ? logger : undefined,
226
+ outDir: outDir === undefined || outDir === null || outDir === "" ? DEFAULT_OUT_DIR : outDir,
227
+ root: root === undefined || root === null || root === "" ? process.cwd() : path.resolve(root)
228
+ };
229
+ }
230
+
231
+ /**
232
+ * @param {unknown} options
233
+ * @returns {{
234
+ * readonly apply: "build",
235
+ * readonly config: (config?: ViteUserConfig) => ViteConfigChanges | null,
236
+ * readonly configResolved: (config: ViteResolvedConfig | null | undefined) => void,
237
+ * readonly enforce: "post",
238
+ * readonly name: "logbrew-vite-release-artifacts",
239
+ * readonly writeBundle: () => Promise<void>
240
+ * }}
241
+ */
242
+ function createLogBrewViteReleaseArtifactsPlugin(options) {
243
+ const settings = pluginSettings(options);
244
+ /** @type {ViteBuildContext} */
245
+ let context = { logger: undefined, outDir: DEFAULT_OUT_DIR, root: process.cwd() };
86
246
  return {
87
247
  name: "logbrew-vite-release-artifacts",
248
+
88
249
  apply: "build",
250
+
89
251
  enforce: "post",
252
+
90
253
  config(config = {}) {
91
- const sourceMap = enableSourceMaps && config.build?.sourcemap === undefined;
92
- const keepNames = config.build?.minify === undefined;
93
- const output = config.build?.rolldownOptions?.output;
94
- const viteMajor = viteMajorVersion(config.root);
95
- const modernNames = keepNames && viteMajor >= 8
96
- && !Array.isArray(output) && output?.keepNames === undefined;
97
- const legacyNames = keepNames && viteMajor < 8
98
- && config.esbuild !== false && config.esbuild?.keepNames === undefined;
99
- return sourceMap || modernNames || legacyNames ? {
100
- ...(sourceMap || modernNames ? { build: {
101
- ...(sourceMap ? { sourcemap: "hidden" } : {}),
102
- ...(modernNames ? { rolldownOptions: { output: { keepNames: true } } } : {})
103
- } } : {}),
104
- ...(legacyNames ? { esbuild: { keepNames: true } } : {})
105
- } : null;
254
+ return viteConfigChanges(config, settings.enableSourceMaps);
106
255
  },
107
256
  configResolved(config) {
108
- viteRoot = config?.root ? path.resolve(config.root) : process.cwd();
109
- viteOutDir = config?.build?.outDir || "dist";
110
- viteLogger = config?.logger && typeof config.logger.info === "function" ? config.logger : null;
257
+ context = resolvedContext(config);
111
258
  },
112
259
  async writeBundle() {
113
- const buildDir = resolveBuildDir(viteRoot, viteOutDir, explicitBuildDir);
114
- const manifestPath = explicitManifestPath
115
- ? resolvePathFromRoot(viteRoot, explicitManifestPath)
116
- : path.join(buildDir, DEFAULT_MANIFEST_NAME);
117
- const sourcePrefixes = userSourcePrefixes.length > 0 ? userSourcePrefixes : [viteRoot];
118
- const prepareArgs = ["--build-dir", buildDir, "--write"];
119
- if (stripSourcesContent) {
120
- prepareArgs.push("--strip-sources-content");
121
- }
122
- for (const prefix of sourcePrefixes) {
123
- prepareArgs.push("--strip-source-prefix", prefix);
124
- }
125
-
126
- runReleaseArtifactCli(CLI_PATH, "prepare-js", prepareArgs);
127
-
128
- const manifestArgs = [
129
- "--build-dir",
130
- buildDir,
131
- "--release",
132
- release,
133
- "--environment",
134
- environment,
135
- "--service",
136
- service,
137
- "--minified-path-prefix",
138
- minifiedPathPrefix
139
- ];
140
- if (repositoryUrl) {
141
- manifestArgs.push("--repository-url", repositoryUrl);
142
- }
143
- if (commitSha) {
144
- manifestArgs.push("--commit-sha", commitSha);
145
- }
146
- if (projectId) {
147
- manifestArgs.push("--project-id", projectId);
148
- }
149
-
150
- const { stdout } = runReleaseArtifactCli(CLI_PATH, "manifest-js", manifestArgs);
151
- fs.mkdirSync(path.dirname(manifestPath), { recursive: true });
152
- fs.writeFileSync(manifestPath, stdout, "utf8");
153
- if (upload) {
154
- const { report } = runReleaseArtifactCli(
155
- CLI_PATH,
156
- "upload-js",
157
- createReleaseArtifactUploadArgs(buildDir, manifestPath, upload)
158
- );
159
- viteLogger?.info(formatReleaseArtifactUploadSummary(report));
160
- }
260
+ await writeReleaseArtifacts(settings, context);
161
261
  }
162
262
  };
163
263
  }
@@ -1,44 +1,69 @@
1
- export interface LogBrewViteReleaseArtifactUploadOptions {
2
- endpoint: string;
3
- allowHostedUpload?: boolean;
4
- tokenEnv?: string;
5
- dryRun?: boolean;
6
- maxRetries?: number;
7
- retryDelay?: number;
8
- timeout?: number;
9
- }
10
-
11
- export interface LogBrewViteReleaseArtifactsPluginOptions {
12
- release: string;
13
- environment: string;
14
- service: string;
15
- projectId?: string;
16
- minifiedPathPrefix: string;
17
- buildDir?: string;
18
- manifestPath?: string;
19
- repositoryUrl?: string;
20
- commitSha?: string;
21
- stripSourcesContent?: boolean;
22
- stripSourcePrefix?: string[];
23
- enableSourceMaps?: boolean;
24
- upload?: LogBrewViteReleaseArtifactUploadOptions;
25
- }
26
-
27
- export interface LogBrewViteReleaseArtifactsPlugin {
28
- name: "logbrew-vite-release-artifacts";
29
- apply: "build";
30
- enforce: "post";
31
- config(config?: { root?: string; build?: { sourcemap?: unknown; minify?: unknown; rolldownOptions?: { output?: { keepNames?: boolean } | Array<{ keepNames?: boolean }> } }; esbuild?: false | { keepNames?: boolean } }): null | { build?: { sourcemap?: "hidden"; rolldownOptions?: { output: { keepNames: true } } }; esbuild?: { keepNames: true } };
32
- configResolved(config: {
33
- root?: string;
34
- build?: { outDir?: string };
35
- logger?: { info(message: string): void };
36
- }): void;
37
- writeBundle(): Promise<void>;
38
- }
39
-
40
- export declare function createLogBrewViteReleaseArtifactsPlugin(
1
+ type LogBrewViteReleaseArtifactUploadOptions = {
2
+ readonly endpoint: string;
3
+ readonly allowHostedUpload?: boolean;
4
+ readonly tokenEnv?: string;
5
+ readonly dryRun?: boolean;
6
+ readonly maxRetries?: number;
7
+ readonly retryDelay?: number;
8
+ readonly timeout?: number;
9
+ };
10
+
11
+ type LogBrewViteReleaseArtifactsPluginOptions = {
12
+ readonly release: string;
13
+ readonly environment: string;
14
+ readonly service: string;
15
+ readonly projectId?: string;
16
+ readonly minifiedPathPrefix: string;
17
+ readonly buildDir?: string;
18
+ readonly manifestPath?: string;
19
+ readonly repositoryUrl?: string;
20
+ readonly commitSha?: string;
21
+ readonly stripSourcesContent?: boolean;
22
+ readonly stripSourcePrefix?: readonly string[];
23
+ readonly enableSourceMaps?: boolean;
24
+ readonly upload?: LogBrewViteReleaseArtifactUploadOptions;
25
+ };
26
+
27
+ type ViteKeepNamesOutput = { readonly keepNames?: boolean };
28
+
29
+ type ViteUserConfigInput = {
30
+ readonly root?: string;
31
+ readonly build?: {
32
+ readonly sourcemap?: unknown;
33
+ readonly minify?: unknown;
34
+ readonly rolldownOptions?: { readonly output?: ViteKeepNamesOutput | readonly ViteKeepNamesOutput[] };
35
+ };
36
+ readonly esbuild?: false | { readonly keepNames?: boolean };
37
+ };
38
+
39
+ type ViteConfigChanges = {
40
+ build?: { sourcemap?: "hidden"; rolldownOptions?: { output: { keepNames: true } } };
41
+ esbuild?: { keepNames: true };
42
+ };
43
+
44
+ type ViteResolvedConfigInput = {
45
+ readonly root?: string;
46
+ readonly build?: { readonly outDir?: string };
47
+ readonly logger?: { readonly info: (message: string) => void };
48
+ };
49
+
50
+ type LogBrewViteReleaseArtifactsPlugin = {
51
+ readonly name: "logbrew-vite-release-artifacts";
52
+ readonly apply: "build";
53
+ readonly enforce: "post";
54
+ readonly config: (config?: ViteUserConfigInput) => null | ViteConfigChanges;
55
+ readonly configResolved: (config: ViteResolvedConfigInput) => void;
56
+ readonly writeBundle: () => Promise<void>;
57
+ };
58
+
59
+ declare function createLogBrewViteReleaseArtifactsPlugin(
41
60
  options: LogBrewViteReleaseArtifactsPluginOptions
42
61
  ): LogBrewViteReleaseArtifactsPlugin;
43
62
 
63
+ export type {
64
+ LogBrewViteReleaseArtifactsPlugin,
65
+ LogBrewViteReleaseArtifactsPluginOptions,
66
+ LogBrewViteReleaseArtifactUploadOptions
67
+ };
68
+ export { createLogBrewViteReleaseArtifactsPlugin };
44
69
  export default createLogBrewViteReleaseArtifactsPlugin;
@@ -1,44 +1,69 @@
1
- export interface LogBrewViteReleaseArtifactUploadOptions {
2
- endpoint: string;
3
- allowHostedUpload?: boolean;
4
- tokenEnv?: string;
5
- dryRun?: boolean;
6
- maxRetries?: number;
7
- retryDelay?: number;
8
- timeout?: number;
9
- }
10
-
11
- export interface LogBrewViteReleaseArtifactsPluginOptions {
12
- release: string;
13
- environment: string;
14
- service: string;
15
- projectId?: string;
16
- minifiedPathPrefix: string;
17
- buildDir?: string;
18
- manifestPath?: string;
19
- repositoryUrl?: string;
20
- commitSha?: string;
21
- stripSourcesContent?: boolean;
22
- stripSourcePrefix?: string[];
23
- enableSourceMaps?: boolean;
24
- upload?: LogBrewViteReleaseArtifactUploadOptions;
25
- }
26
-
27
- export interface LogBrewViteReleaseArtifactsPlugin {
28
- name: "logbrew-vite-release-artifacts";
29
- apply: "build";
30
- enforce: "post";
31
- config(config?: { root?: string; build?: { sourcemap?: unknown; minify?: unknown; rolldownOptions?: { output?: { keepNames?: boolean } | Array<{ keepNames?: boolean }> } }; esbuild?: false | { keepNames?: boolean } }): null | { build?: { sourcemap?: "hidden"; rolldownOptions?: { output: { keepNames: true } } }; esbuild?: { keepNames: true } };
32
- configResolved(config: {
33
- root?: string;
34
- build?: { outDir?: string };
35
- logger?: { info(message: string): void };
36
- }): void;
37
- writeBundle(): Promise<void>;
38
- }
39
-
40
- export declare function createLogBrewViteReleaseArtifactsPlugin(
1
+ type LogBrewViteReleaseArtifactUploadOptions = {
2
+ readonly endpoint: string;
3
+ readonly allowHostedUpload?: boolean;
4
+ readonly tokenEnv?: string;
5
+ readonly dryRun?: boolean;
6
+ readonly maxRetries?: number;
7
+ readonly retryDelay?: number;
8
+ readonly timeout?: number;
9
+ };
10
+
11
+ type LogBrewViteReleaseArtifactsPluginOptions = {
12
+ readonly release: string;
13
+ readonly environment: string;
14
+ readonly service: string;
15
+ readonly projectId?: string;
16
+ readonly minifiedPathPrefix: string;
17
+ readonly buildDir?: string;
18
+ readonly manifestPath?: string;
19
+ readonly repositoryUrl?: string;
20
+ readonly commitSha?: string;
21
+ readonly stripSourcesContent?: boolean;
22
+ readonly stripSourcePrefix?: readonly string[];
23
+ readonly enableSourceMaps?: boolean;
24
+ readonly upload?: LogBrewViteReleaseArtifactUploadOptions;
25
+ };
26
+
27
+ type ViteKeepNamesOutput = { readonly keepNames?: boolean };
28
+
29
+ type ViteUserConfigInput = {
30
+ readonly root?: string;
31
+ readonly build?: {
32
+ readonly sourcemap?: unknown;
33
+ readonly minify?: unknown;
34
+ readonly rolldownOptions?: { readonly output?: ViteKeepNamesOutput | readonly ViteKeepNamesOutput[] };
35
+ };
36
+ readonly esbuild?: false | { readonly keepNames?: boolean };
37
+ };
38
+
39
+ type ViteConfigChanges = {
40
+ build?: { sourcemap?: "hidden"; rolldownOptions?: { output: { keepNames: true } } };
41
+ esbuild?: { keepNames: true };
42
+ };
43
+
44
+ type ViteResolvedConfigInput = {
45
+ readonly root?: string;
46
+ readonly build?: { readonly outDir?: string };
47
+ readonly logger?: { readonly info: (message: string) => void };
48
+ };
49
+
50
+ type LogBrewViteReleaseArtifactsPlugin = {
51
+ readonly name: "logbrew-vite-release-artifacts";
52
+ readonly apply: "build";
53
+ readonly enforce: "post";
54
+ readonly config: (config?: ViteUserConfigInput) => null | ViteConfigChanges;
55
+ readonly configResolved: (config: ViteResolvedConfigInput) => void;
56
+ readonly writeBundle: () => Promise<void>;
57
+ };
58
+
59
+ declare function createLogBrewViteReleaseArtifactsPlugin(
41
60
  options: LogBrewViteReleaseArtifactsPluginOptions
42
61
  ): LogBrewViteReleaseArtifactsPlugin;
43
62
 
63
+ export type {
64
+ LogBrewViteReleaseArtifactsPlugin,
65
+ LogBrewViteReleaseArtifactsPluginOptions,
66
+ LogBrewViteReleaseArtifactUploadOptions
67
+ };
68
+ export { createLogBrewViteReleaseArtifactsPlugin };
44
69
  export default createLogBrewViteReleaseArtifactsPlugin;
@@ -1,6 +1,6 @@
1
1
  import viteReleaseArtifacts from "./vite-release-artifacts.cjs";
2
2
 
3
- export const createLogBrewViteReleaseArtifactsPlugin =
4
- viteReleaseArtifacts.createLogBrewViteReleaseArtifactsPlugin;
3
+ const { createLogBrewViteReleaseArtifactsPlugin } = viteReleaseArtifacts;
5
4
 
5
+ export { createLogBrewViteReleaseArtifactsPlugin };
6
6
  export default createLogBrewViteReleaseArtifactsPlugin;