almostnode 0.2.4 → 0.2.6
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/LICENSE +1 -1
- package/dist/__sw__.js +32 -1
- package/dist/assets/{runtime-worker-D9x_Ddwz.js → runtime-worker-B8_LZkBX.js} +85 -32
- package/dist/assets/runtime-worker-B8_LZkBX.js.map +1 -0
- package/dist/frameworks/next-dev-server.d.ts +63 -0
- package/dist/frameworks/next-dev-server.d.ts.map +1 -1
- package/dist/frameworks/tailwind-config-loader.d.ts +32 -0
- package/dist/frameworks/tailwind-config-loader.d.ts.map +1 -0
- package/dist/frameworks/vite-dev-server.d.ts +1 -0
- package/dist/frameworks/vite-dev-server.d.ts.map +1 -1
- package/dist/index.cjs +995 -55
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +975 -60
- package/dist/index.mjs.map +1 -1
- package/dist/macaly-demo.d.ts +42 -0
- package/dist/macaly-demo.d.ts.map +1 -0
- package/dist/runtime.d.ts +2 -0
- package/dist/runtime.d.ts.map +1 -1
- package/dist/types/package-json.d.ts +16 -0
- package/dist/types/package-json.d.ts.map +1 -0
- package/dist/utils/hash.d.ts +6 -0
- package/dist/utils/hash.d.ts.map +1 -0
- package/dist/virtual-fs.d.ts +1 -0
- package/dist/virtual-fs.d.ts.map +1 -1
- package/package.json +2 -1
- package/src/frameworks/next-dev-server.ts +940 -34
- package/src/frameworks/tailwind-config-loader.ts +206 -0
- package/src/frameworks/vite-dev-server.ts +25 -0
- package/src/macaly-demo.ts +172 -0
- package/src/runtime.ts +84 -25
- package/src/types/package-json.ts +15 -0
- package/src/utils/hash.ts +12 -0
- package/src/virtual-fs.ts +14 -10
- package/dist/assets/runtime-worker-D9x_Ddwz.js.map +0 -1
package/src/virtual-fs.ts
CHANGED
|
@@ -8,6 +8,7 @@ export interface FSNode {
|
|
|
8
8
|
type: 'file' | 'directory';
|
|
9
9
|
content?: Uint8Array;
|
|
10
10
|
children?: Map<string, FSNode>;
|
|
11
|
+
mtime: number;
|
|
11
12
|
}
|
|
12
13
|
|
|
13
14
|
// Simple EventEmitter for VFS change notifications
|
|
@@ -111,6 +112,7 @@ export class VirtualFS {
|
|
|
111
112
|
this.root = {
|
|
112
113
|
type: 'directory',
|
|
113
114
|
children: new Map(),
|
|
115
|
+
mtime: Date.now(),
|
|
114
116
|
};
|
|
115
117
|
}
|
|
116
118
|
|
|
@@ -252,6 +254,7 @@ export class VirtualFS {
|
|
|
252
254
|
parent.children!.set(basename, {
|
|
253
255
|
type: 'file',
|
|
254
256
|
content,
|
|
257
|
+
mtime: Date.now(),
|
|
255
258
|
});
|
|
256
259
|
|
|
257
260
|
if (emitEvent) {
|
|
@@ -344,7 +347,7 @@ export class VirtualFS {
|
|
|
344
347
|
|
|
345
348
|
let child = current.children.get(segment);
|
|
346
349
|
if (!child) {
|
|
347
|
-
child = { type: 'directory', children: new Map() };
|
|
350
|
+
child = { type: 'directory', children: new Map(), mtime: Date.now() };
|
|
348
351
|
current.children.set(segment, child);
|
|
349
352
|
} else if (child.type !== 'directory') {
|
|
350
353
|
throw new Error(`ENOTDIR: not a directory, '${path}'`);
|
|
@@ -372,8 +375,8 @@ export class VirtualFS {
|
|
|
372
375
|
throw createNodeError('ENOENT', 'stat', path);
|
|
373
376
|
}
|
|
374
377
|
|
|
375
|
-
const now = Date.now();
|
|
376
378
|
const size = node.type === 'file' ? (node.content?.length || 0) : 0;
|
|
379
|
+
const mtime = node.mtime;
|
|
377
380
|
|
|
378
381
|
return {
|
|
379
382
|
isFile: () => node.type === 'file',
|
|
@@ -385,14 +388,14 @@ export class VirtualFS {
|
|
|
385
388
|
isSocket: () => false,
|
|
386
389
|
size,
|
|
387
390
|
mode: node.type === 'directory' ? 0o755 : 0o644,
|
|
388
|
-
mtime: new Date(
|
|
389
|
-
atime: new Date(
|
|
390
|
-
ctime: new Date(
|
|
391
|
-
birthtime: new Date(
|
|
392
|
-
mtimeMs:
|
|
393
|
-
atimeMs:
|
|
394
|
-
ctimeMs:
|
|
395
|
-
birthtimeMs:
|
|
391
|
+
mtime: new Date(mtime),
|
|
392
|
+
atime: new Date(mtime),
|
|
393
|
+
ctime: new Date(mtime),
|
|
394
|
+
birthtime: new Date(mtime),
|
|
395
|
+
mtimeMs: mtime,
|
|
396
|
+
atimeMs: mtime,
|
|
397
|
+
ctimeMs: mtime,
|
|
398
|
+
birthtimeMs: mtime,
|
|
396
399
|
nlink: 1,
|
|
397
400
|
uid: 1000,
|
|
398
401
|
gid: 1000,
|
|
@@ -478,6 +481,7 @@ export class VirtualFS {
|
|
|
478
481
|
parent.children!.set(basename, {
|
|
479
482
|
type: 'directory',
|
|
480
483
|
children: new Map(),
|
|
484
|
+
mtime: Date.now(),
|
|
481
485
|
});
|
|
482
486
|
}
|
|
483
487
|
|