motia 0.8.2-beta.140-930160 → 0.8.2-beta.140-504654

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.
@@ -9,7 +9,6 @@ export declare class Archiver {
9
9
  private uncompressedSize;
10
10
  constructor(filePath: string);
11
11
  appendDirectory(sourcePath: string, targetPath: string): void;
12
- private calculateDirectorySize;
13
- append(stream: fs.ReadStream | string | Buffer, filePath: string): void;
12
+ append(stream: fs.ReadStream | string, filePath: string): void;
14
13
  finalize(): Promise<ArchiveResult>;
15
14
  }
@@ -16,50 +16,39 @@ class Archiver {
16
16
  }
17
17
  appendDirectory(sourcePath, targetPath) {
18
18
  try {
19
- const stat = fs_1.default.statSync(sourcePath);
20
- if (!stat.isDirectory()) {
21
- return;
22
- }
23
- this.uncompressedSize += this.calculateDirectorySize(sourcePath);
24
- this.archive.directory(sourcePath, targetPath === '/' ? false : targetPath);
25
- }
26
- catch (_error) { }
27
- }
28
- calculateDirectorySize(dirPath) {
29
- let totalSize = 0;
30
- try {
31
- const items = fs_1.default.readdirSync(dirPath);
19
+ const items = fs_1.default.readdirSync(sourcePath);
32
20
  for (const item of items) {
33
- const fullPath = path_1.default.join(dirPath, item);
21
+ const fullPath = path_1.default.join(sourcePath, item);
34
22
  try {
35
23
  const stat = fs_1.default.statSync(fullPath);
36
24
  if (stat.isDirectory()) {
37
- totalSize += this.calculateDirectorySize(fullPath);
25
+ this.appendDirectory(fullPath, path_1.default.join(targetPath, item));
38
26
  }
39
27
  else {
40
- totalSize += stat.size;
28
+ this.append(fs_1.default.createReadStream(fullPath), targetPath ? path_1.default.join(targetPath, item) : item);
41
29
  }
42
30
  }
43
- catch (_error) { }
31
+ catch (_error) {
32
+ // Ignore individual file errors
33
+ }
44
34
  }
45
35
  }
46
- catch (_error) { }
47
- return totalSize;
36
+ catch (_error) {
37
+ // Ignore directory read errors
38
+ }
48
39
  }
49
40
  append(stream, filePath) {
41
+ // Track uncompressed size
50
42
  if (typeof stream === 'string') {
43
+ // String content
51
44
  this.uncompressedSize += Buffer.byteLength(stream, 'utf8');
52
- this.archive.append(stream, { name: filePath });
53
- }
54
- else if (Buffer.isBuffer(stream)) {
55
- this.uncompressedSize += stream.length;
56
- this.archive.append(stream, { name: filePath });
57
45
  }
58
46
  else {
47
+ // ReadStream - get file stats
59
48
  const stats = fs_1.default.statSync(stream.path);
60
49
  this.uncompressedSize += stats.size;
61
- this.archive.append(stream, { name: filePath });
62
50
  }
51
+ this.archive.append(stream, { name: filePath });
63
52
  }
64
53
  async finalize() {
65
54
  return new Promise((resolve, reject) => {
@@ -18,8 +18,7 @@ const includeStaticFiles = (steps, builder, archive) => {
18
18
  const matches = (0, glob_1.globSync)(file, { cwd: path_1.default.dirname(step.filePath), absolute: true });
19
19
  matches.forEach((filePath) => {
20
20
  const relativeFilePath = path_1.default.relative(builder.projectDir, filePath);
21
- const content = fs_1.default.readFileSync(filePath);
22
- archive.append(content, relativeFilePath);
21
+ archive.append(fs_1.default.createReadStream(filePath), relativeFilePath);
23
22
  });
24
23
  });
25
24
  }
@@ -94,8 +94,8 @@ class NodeBuilder {
94
94
  const archiver = new archiver_1.Archiver(path_1.default.join(constants_1.distDir, zipName));
95
95
  const routerJs = path_1.default.join(constants_1.distDir, 'router.js');
96
96
  const routerMap = path_1.default.join(constants_1.distDir, 'router.js.map');
97
- archiver.append(fs_1.default.readFileSync(routerJs), 'router.js');
98
- archiver.append(fs_1.default.readFileSync(routerMap), 'router.js.map');
97
+ archiver.append(fs_1.default.createReadStream(routerJs), 'router.js');
98
+ archiver.append(fs_1.default.createReadStream(routerMap), 'router.js.map');
99
99
  (0, include_static_files_1.includeStaticFiles)(steps, this.builder, archiver);
100
100
  const { compressedSize, uncompressedSize } = await archiver.finalize();
101
101
  fs_1.default.unlinkSync(tsRouter);
@@ -123,8 +123,8 @@ class NodeBuilder {
123
123
  };
124
124
  await esbuild.build(userConfig ? { ...defaultConfig, ...userConfig } : defaultConfig);
125
125
  const archiver = new archiver_1.Archiver(path_1.default.join(constants_1.distDir, bundlePath));
126
- archiver.append(fs_1.default.readFileSync(outputJsFile), entrypointPath);
127
- archiver.append(fs_1.default.readFileSync(outputMapFile), entrypointMapPath);
126
+ archiver.append(fs_1.default.createReadStream(outputJsFile), entrypointPath);
127
+ archiver.append(fs_1.default.createReadStream(outputMapFile), entrypointMapPath);
128
128
  (0, include_static_files_1.includeStaticFiles)([step], this.builder, archiver);
129
129
  const { compressedSize, uncompressedSize } = await archiver.finalize();
130
130
  fs_1.default.unlinkSync(outputJsFile);
@@ -9,7 +9,6 @@ export declare class Archiver {
9
9
  private uncompressedSize;
10
10
  constructor(filePath: string);
11
11
  appendDirectory(sourcePath: string, targetPath: string): void;
12
- private calculateDirectorySize;
13
- append(stream: fs.ReadStream | string | Buffer, filePath: string): void;
12
+ append(stream: fs.ReadStream | string, filePath: string): void;
14
13
  finalize(): Promise<ArchiveResult>;
15
14
  }
@@ -10,50 +10,39 @@ export class Archiver {
10
10
  }
11
11
  appendDirectory(sourcePath, targetPath) {
12
12
  try {
13
- const stat = fs.statSync(sourcePath);
14
- if (!stat.isDirectory()) {
15
- return;
16
- }
17
- this.uncompressedSize += this.calculateDirectorySize(sourcePath);
18
- this.archive.directory(sourcePath, targetPath === '/' ? false : targetPath);
19
- }
20
- catch (_error) { }
21
- }
22
- calculateDirectorySize(dirPath) {
23
- let totalSize = 0;
24
- try {
25
- const items = fs.readdirSync(dirPath);
13
+ const items = fs.readdirSync(sourcePath);
26
14
  for (const item of items) {
27
- const fullPath = path.join(dirPath, item);
15
+ const fullPath = path.join(sourcePath, item);
28
16
  try {
29
17
  const stat = fs.statSync(fullPath);
30
18
  if (stat.isDirectory()) {
31
- totalSize += this.calculateDirectorySize(fullPath);
19
+ this.appendDirectory(fullPath, path.join(targetPath, item));
32
20
  }
33
21
  else {
34
- totalSize += stat.size;
22
+ this.append(fs.createReadStream(fullPath), targetPath ? path.join(targetPath, item) : item);
35
23
  }
36
24
  }
37
- catch (_error) { }
25
+ catch (_error) {
26
+ // Ignore individual file errors
27
+ }
38
28
  }
39
29
  }
40
- catch (_error) { }
41
- return totalSize;
30
+ catch (_error) {
31
+ // Ignore directory read errors
32
+ }
42
33
  }
43
34
  append(stream, filePath) {
35
+ // Track uncompressed size
44
36
  if (typeof stream === 'string') {
37
+ // String content
45
38
  this.uncompressedSize += Buffer.byteLength(stream, 'utf8');
46
- this.archive.append(stream, { name: filePath });
47
- }
48
- else if (Buffer.isBuffer(stream)) {
49
- this.uncompressedSize += stream.length;
50
- this.archive.append(stream, { name: filePath });
51
39
  }
52
40
  else {
41
+ // ReadStream - get file stats
53
42
  const stats = fs.statSync(stream.path);
54
43
  this.uncompressedSize += stats.size;
55
- this.archive.append(stream, { name: filePath });
56
44
  }
45
+ this.archive.append(stream, { name: filePath });
57
46
  }
58
47
  async finalize() {
59
48
  return new Promise((resolve, reject) => {
@@ -12,8 +12,7 @@ export const includeStaticFiles = (steps, builder, archive) => {
12
12
  const matches = globSync(file, { cwd: path.dirname(step.filePath), absolute: true });
13
13
  matches.forEach((filePath) => {
14
14
  const relativeFilePath = path.relative(builder.projectDir, filePath);
15
- const content = fs.readFileSync(filePath);
16
- archive.append(content, relativeFilePath);
15
+ archive.append(fs.createReadStream(filePath), relativeFilePath);
17
16
  });
18
17
  });
19
18
  }
@@ -55,8 +55,8 @@ export class NodeBuilder {
55
55
  const archiver = new Archiver(path.join(distDir, zipName));
56
56
  const routerJs = path.join(distDir, 'router.js');
57
57
  const routerMap = path.join(distDir, 'router.js.map');
58
- archiver.append(fs.readFileSync(routerJs), 'router.js');
59
- archiver.append(fs.readFileSync(routerMap), 'router.js.map');
58
+ archiver.append(fs.createReadStream(routerJs), 'router.js');
59
+ archiver.append(fs.createReadStream(routerMap), 'router.js.map');
60
60
  includeStaticFiles(steps, this.builder, archiver);
61
61
  const { compressedSize, uncompressedSize } = await archiver.finalize();
62
62
  fs.unlinkSync(tsRouter);
@@ -84,8 +84,8 @@ export class NodeBuilder {
84
84
  };
85
85
  await esbuild.build(userConfig ? { ...defaultConfig, ...userConfig } : defaultConfig);
86
86
  const archiver = new Archiver(path.join(distDir, bundlePath));
87
- archiver.append(fs.readFileSync(outputJsFile), entrypointPath);
88
- archiver.append(fs.readFileSync(outputMapFile), entrypointMapPath);
87
+ archiver.append(fs.createReadStream(outputJsFile), entrypointPath);
88
+ archiver.append(fs.createReadStream(outputMapFile), entrypointMapPath);
89
89
  includeStaticFiles([step], this.builder, archiver);
90
90
  const { compressedSize, uncompressedSize } = await archiver.finalize();
91
91
  fs.unlinkSync(outputJsFile);
@@ -9,7 +9,6 @@ export declare class Archiver {
9
9
  private uncompressedSize;
10
10
  constructor(filePath: string);
11
11
  appendDirectory(sourcePath: string, targetPath: string): void;
12
- private calculateDirectorySize;
13
- append(stream: fs.ReadStream | string | Buffer, filePath: string): void;
12
+ append(stream: fs.ReadStream | string, filePath: string): void;
14
13
  finalize(): Promise<ArchiveResult>;
15
14
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "motia",
3
3
  "description": "A Modern Unified Backend Framework for APIs, Events and Agents",
4
- "version": "0.8.2-beta.140-930160",
4
+ "version": "0.8.2-beta.140-504654",
5
5
  "license": "MIT",
6
6
  "repository": {
7
7
  "type": "git",
@@ -46,9 +46,9 @@
46
46
  "python-ast": "^0.1.0",
47
47
  "table": "^6.9.0",
48
48
  "ts-node": "^10.9.2",
49
- "@motiadev/stream-client-node": "0.8.2-beta.140-930160",
50
- "@motiadev/workbench": "0.8.2-beta.140-930160",
51
- "@motiadev/core": "0.8.2-beta.140-930160"
49
+ "@motiadev/stream-client-node": "0.8.2-beta.140-504654",
50
+ "@motiadev/workbench": "0.8.2-beta.140-504654",
51
+ "@motiadev/core": "0.8.2-beta.140-504654"
52
52
  },
53
53
  "devDependencies": {
54
54
  "@amplitude/analytics-types": "^2.9.2",