@stim-cli/metro 1.0.0-rc.0 → 1.0.0-rc.2

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.
package/dist/index.d.mts CHANGED
@@ -9,6 +9,9 @@ interface MetroEvent {
9
9
  error?: unknown;
10
10
  stack?: string;
11
11
  buildID?: string;
12
+ bundleDetails?: {
13
+ platform?: string | null;
14
+ };
12
15
  }
13
16
  interface NdjsonReporter {
14
17
  dir: string;
package/dist/index.mjs CHANGED
@@ -81,6 +81,8 @@ function ndjsonReporter({ dir } = {}) {
81
81
  const logDir = dir || workspaceLogDir(process.cwd());
82
82
  let ensured = false;
83
83
  let drops = 0;
84
+ const builds = /* @__PURE__ */ new Map();
85
+ let failedBuild = null;
84
86
  function write(file, record) {
85
87
  try {
86
88
  if (!ensured) {
@@ -103,6 +105,26 @@ function ndjsonReporter({ dir } = {}) {
103
105
  msg: ""
104
106
  };
105
107
  if (type) record.event = type;
108
+ if (type !== "bundling_error") failedBuild = null;
109
+ if (type === "bundle_build_started" && event.buildID) {
110
+ const platform = event.bundleDetails?.platform || null;
111
+ builds.set(event.buildID, platform);
112
+ record.buildID = event.buildID;
113
+ if (platform) record.platform = platform;
114
+ } else if ((type === "bundle_build_done" || type === "bundle_build_failed") && event.buildID) {
115
+ const platform = builds.get(event.buildID) || null;
116
+ record.buildID = event.buildID;
117
+ if (platform) record.platform = platform;
118
+ builds.delete(event.buildID);
119
+ if (type === "bundle_build_failed") failedBuild = {
120
+ buildID: event.buildID,
121
+ platform
122
+ };
123
+ } else if (type === "bundling_error" && failedBuild) {
124
+ record.buildID = failedBuild.buildID;
125
+ if (failedBuild.platform) record.platform = failedBuild.platform;
126
+ failedBuild = null;
127
+ }
106
128
  if (type === "client_log") {
107
129
  record.src = "client";
108
130
  record.level = ndjsonLevel(event.level, "info");
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@stim-cli/metro",
3
- "version": "1.0.0-rc.0",
3
+ "version": "1.0.0-rc.2",
4
4
  "description": "Metro integration for stim-cli: one transform cache shared by every worktree, plus an NDJSON reporter for structured logs.",
5
5
  "license": "MIT",
6
6
  "repository": {
7
7
  "type": "git",
8
- "url": "git+https://github.com/appandflow/stim-cli.git",
8
+ "url": "git+https://github.com/appandflow/stim.git",
9
9
  "directory": "packages/metro"
10
10
  },
11
11
  "files": [
@@ -23,17 +23,17 @@
23
23
  "default": "./dist/index.mjs"
24
24
  }
25
25
  },
26
+ "scripts": {
27
+ "test": "node --test test/*.test.js",
28
+ "build": "tsdown"
29
+ },
26
30
  "dependencies": {
27
- "@stim-cli/core": "^1.0.0-rc.0"
31
+ "@stim-cli/core": "^1.0.0-rc.2"
28
32
  },
29
33
  "peerDependencies": {
30
34
  "metro-cache": "*"
31
35
  },
32
36
  "engines": {
33
37
  "node": "^20.19.4 || >=22.12.0"
34
- },
35
- "scripts": {
36
- "test": "node --test test/*.test.js",
37
- "build": "tsdown"
38
38
  }
39
- }
39
+ }