@statewalker/webrun-files-node 0.7.0 → 0.9.0

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.
@@ -1,4 +1,5 @@
1
- //#region rolldown:runtime
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ //#region \0rolldown/runtime.js
2
3
  var __create = Object.create;
3
4
  var __defProp = Object.defineProperty;
4
5
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -6,28 +7,22 @@ var __getOwnPropNames = Object.getOwnPropertyNames;
6
7
  var __getProtoOf = Object.getPrototypeOf;
7
8
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
9
  var __copyProps = (to, from, except, desc) => {
9
- if (from && typeof from === "object" || typeof from === "function") {
10
- for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
11
- key = keys[i];
12
- if (!__hasOwnProp.call(to, key) && key !== except) {
13
- __defProp(to, key, {
14
- get: ((k) => from[k]).bind(null, key),
15
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
16
- });
17
- }
18
- }
10
+ if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
11
+ key = keys[i];
12
+ if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
13
+ get: ((k) => from[k]).bind(null, key),
14
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
15
+ });
19
16
  }
20
17
  return to;
21
18
  };
22
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule || !__hasOwnProp.call(mod, "default") ? __defProp(target, "default", {
23
20
  value: mod,
24
21
  enumerable: true
25
22
  }) : target, mod));
26
-
27
23
  //#endregion
28
24
  let node_fs_promises = require("node:fs/promises");
29
- node_fs_promises = __toESM(node_fs_promises);
30
-
25
+ node_fs_promises = __toESM(node_fs_promises, 1);
31
26
  //#region ../webrun-files/dist/esm/index.js
32
27
  /**
33
28
  * Path manipulation utilities for virtual filesystem paths.
@@ -60,7 +55,6 @@ function dirname(path) {
60
55
  if (lastSlash <= 0) return "/";
61
56
  return normalized.substring(0, lastSlash);
62
57
  }
63
-
64
58
  //#endregion
65
59
  //#region src/node-files-api.ts
66
60
  /**
@@ -143,10 +137,14 @@ var NodeFilesApi = class {
143
137
  } catch {
144
138
  continue;
145
139
  }
146
- yield {
140
+ yield entry.isDirectory() ? {
141
+ name: entry.name,
142
+ path: entryPath,
143
+ kind: "directory"
144
+ } : {
147
145
  name: entry.name,
148
146
  path: entryPath,
149
- kind: entry.isDirectory() ? "directory" : "file",
147
+ kind: "file",
150
148
  size: stat.size,
151
149
  lastModified: stat.mtimeMs
152
150
  };
@@ -160,8 +158,9 @@ var NodeFilesApi = class {
160
158
  const realPath = this.resolvePath(path);
161
159
  try {
162
160
  const stat = await node_fs_promises.stat(realPath);
161
+ if (stat.isDirectory()) return { kind: "directory" };
163
162
  return {
164
- kind: stat.isDirectory() ? "directory" : "file",
163
+ kind: "file",
165
164
  size: stat.size,
166
165
  lastModified: stat.mtimeMs
167
166
  };
@@ -228,6 +227,5 @@ var NodeFilesApi = class {
228
227
  }
229
228
  }
230
229
  };
231
-
232
230
  //#endregion
233
- exports.NodeFilesApi = NodeFilesApi;
231
+ exports.NodeFilesApi = NodeFilesApi;
package/dist/esm/index.js CHANGED
@@ -1,5 +1,4 @@
1
1
  import * as fs from "node:fs/promises";
2
-
3
2
  //#region ../webrun-files/dist/esm/index.js
4
3
  /**
5
4
  * Path manipulation utilities for virtual filesystem paths.
@@ -32,7 +31,6 @@ function dirname(path) {
32
31
  if (lastSlash <= 0) return "/";
33
32
  return normalized.substring(0, lastSlash);
34
33
  }
35
-
36
34
  //#endregion
37
35
  //#region src/node-files-api.ts
38
36
  /**
@@ -115,10 +113,14 @@ var NodeFilesApi = class {
115
113
  } catch {
116
114
  continue;
117
115
  }
118
- yield {
116
+ yield entry.isDirectory() ? {
119
117
  name: entry.name,
120
118
  path: entryPath,
121
- kind: entry.isDirectory() ? "directory" : "file",
119
+ kind: "directory"
120
+ } : {
121
+ name: entry.name,
122
+ path: entryPath,
123
+ kind: "file",
122
124
  size: stat.size,
123
125
  lastModified: stat.mtimeMs
124
126
  };
@@ -132,8 +134,9 @@ var NodeFilesApi = class {
132
134
  const realPath = this.resolvePath(path);
133
135
  try {
134
136
  const stat = await fs.stat(realPath);
137
+ if (stat.isDirectory()) return { kind: "directory" };
135
138
  return {
136
- kind: stat.isDirectory() ? "directory" : "file",
139
+ kind: "file",
137
140
  size: stat.size,
138
141
  lastModified: stat.mtimeMs
139
142
  };
@@ -200,6 +203,5 @@ var NodeFilesApi = class {
200
203
  }
201
204
  }
202
205
  };
203
-
204
206
  //#endregion
205
- export { NodeFilesApi };
207
+ export { NodeFilesApi };
@@ -1 +1 @@
1
- {"version":3,"file":"node-files-api.d.ts","sourceRoot":"","sources":["../src/node-files-api.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,QAAQ,EACR,SAAS,EACT,QAAQ,EACR,WAAW,EACX,WAAW,EACZ,MAAM,2BAA2B,CAAC;AAGnC,MAAM,WAAW,mBAAmB;IAClC;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;;GAGG;AACH,qBAAa,YAAa,YAAW,QAAQ;IAC3C,OAAO,CAAC,OAAO,CAAS;gBAEZ,OAAO,CAAC,EAAE,mBAAmB;IAIzC,OAAO,CAAC,WAAW;IAKZ,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,WAAW,GAAG,aAAa,CAAC,UAAU,CAAC;IA2CrE,KAAK,CACT,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,QAAQ,CAAC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AC,GAAG,aAAa,CAAC,UAAU,CAAC,GACxD,OAAO,CAAC,IAAI,CAAC,CAuBf;IAEK,KAAK,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAGvC;IAEM,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,WAAW,GAAG,aAAa,CAAC,QAAQ,CAAC,CAsCxE;IAEK,KAAK,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,GAAG,SAAS,CAAC,CAkBxD;IAEK,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAS3C;IAEK,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAc3C;IAEK,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAmB3D;IAEK,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAmB3D;CACF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@statewalker/webrun-files-node",
3
- "version": "0.7.0",
3
+ "version": "0.9.0",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "Node.js FilesApi implementation",
@@ -29,15 +29,15 @@
29
29
  "src"
30
30
  ],
31
31
  "dependencies": {
32
- "@statewalker/webrun-files": "0.7.0"
32
+ "@statewalker/webrun-files": "0.9.0"
33
33
  },
34
34
  "devDependencies": {
35
- "@types/node": "^24.10.1",
36
- "rimraf": "^6.1.2",
37
- "rolldown": "^1.0.0-beta.53",
38
- "typescript": "^5.6.0",
39
- "vitest": "^4.0.12",
40
- "@statewalker/webrun-files-tests": "1.0.0"
35
+ "@types/node": "^26.2.0",
36
+ "rimraf": "^6.1.3",
37
+ "rolldown": "^1.2.4",
38
+ "typescript": "^7.0.2",
39
+ "vitest": "^4.1.10",
40
+ "@statewalker/webrun-files-tests": "2.0.0"
41
41
  },
42
42
  "sideEffects": false,
43
43
  "publishConfig": {
@@ -127,13 +127,15 @@ export class NodeFilesApi implements FilesApi {
127
127
  continue;
128
128
  }
129
129
 
130
- const info: FileInfo = {
131
- name: entry.name,
132
- path: entryPath,
133
- kind: entry.isDirectory() ? "directory" : "file",
134
- size: stat.size,
135
- lastModified: stat.mtimeMs,
136
- };
130
+ const info: FileInfo = entry.isDirectory()
131
+ ? { name: entry.name, path: entryPath, kind: "directory" }
132
+ : {
133
+ name: entry.name,
134
+ path: entryPath,
135
+ kind: "file",
136
+ size: stat.size,
137
+ lastModified: stat.mtimeMs,
138
+ };
137
139
 
138
140
  yield info;
139
141
 
@@ -152,8 +154,13 @@ export class NodeFilesApi implements FilesApi {
152
154
 
153
155
  try {
154
156
  const stat = await fs.stat(realPath);
157
+ // A directory reports neither size nor time. `stat` supplies both, but
158
+ // the size is the inode's own bookkeeping rather than anything about the
159
+ // contents, and neither is available on every storage, so neither is
160
+ // part of what a consumer may rely on.
161
+ if (stat.isDirectory()) return { kind: "directory" };
155
162
  return {
156
- kind: stat.isDirectory() ? "directory" : "file",
163
+ kind: "file",
157
164
  size: stat.size,
158
165
  lastModified: stat.mtimeMs,
159
166
  };