@capsule-run/sdk 0.7.1 → 0.8.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.
Files changed (62) hide show
  1. package/README.md +5 -1
  2. package/dist/app.d.ts +7 -0
  3. package/dist/app.d.ts.map +1 -1
  4. package/dist/app.js +7 -0
  5. package/dist/app.js.map +1 -1
  6. package/dist/index.d.ts +1 -2
  7. package/dist/index.d.ts.map +1 -1
  8. package/dist/index.js +1 -2
  9. package/dist/index.js.map +1 -1
  10. package/dist/polyfills/fs.d.ts +148 -10
  11. package/dist/polyfills/fs.d.ts.map +1 -1
  12. package/dist/polyfills/fs.js +497 -17
  13. package/dist/polyfills/fs.js.map +1 -1
  14. package/dist/polyfills/process.d.ts +7 -2
  15. package/dist/polyfills/process.d.ts.map +1 -1
  16. package/dist/polyfills/process.js +78 -6
  17. package/dist/polyfills/process.js.map +1 -1
  18. package/dist/run.d.ts +4 -0
  19. package/dist/run.d.ts.map +1 -1
  20. package/dist/run.js +3 -2
  21. package/dist/run.js.map +1 -1
  22. package/dist/task.d.ts +11 -2
  23. package/dist/task.d.ts.map +1 -1
  24. package/dist/task.js +6 -3
  25. package/dist/task.js.map +1 -1
  26. package/package.json +4 -10
  27. package/src/app.ts +8 -0
  28. package/src/index.ts +1 -2
  29. package/src/polyfills/fs.ts +572 -20
  30. package/src/polyfills/process.ts +80 -6
  31. package/src/run.ts +7 -2
  32. package/src/task.ts +32 -14
  33. package/dist/polyfills/buffer.d.ts +0 -8
  34. package/dist/polyfills/buffer.d.ts.map +0 -1
  35. package/dist/polyfills/buffer.js +0 -9
  36. package/dist/polyfills/buffer.js.map +0 -1
  37. package/dist/polyfills/events.d.ts +0 -8
  38. package/dist/polyfills/events.d.ts.map +0 -1
  39. package/dist/polyfills/events.js +0 -9
  40. package/dist/polyfills/events.js.map +0 -1
  41. package/dist/polyfills/path.d.ts +0 -8
  42. package/dist/polyfills/path.d.ts.map +0 -1
  43. package/dist/polyfills/path.js +0 -8
  44. package/dist/polyfills/path.js.map +0 -1
  45. package/dist/polyfills/stream-web.d.ts +0 -74
  46. package/dist/polyfills/stream-web.d.ts.map +0 -1
  47. package/dist/polyfills/stream-web.js +0 -23
  48. package/dist/polyfills/stream-web.js.map +0 -1
  49. package/dist/polyfills/stream.d.ts +0 -16
  50. package/dist/polyfills/stream.d.ts.map +0 -1
  51. package/dist/polyfills/stream.js +0 -16
  52. package/dist/polyfills/stream.js.map +0 -1
  53. package/dist/polyfills/url.d.ts +0 -47
  54. package/dist/polyfills/url.d.ts.map +0 -1
  55. package/dist/polyfills/url.js +0 -68
  56. package/dist/polyfills/url.js.map +0 -1
  57. package/src/polyfills/buffer.ts +0 -11
  58. package/src/polyfills/events.ts +0 -11
  59. package/src/polyfills/path.ts +0 -21
  60. package/src/polyfills/stream-web.ts +0 -24
  61. package/src/polyfills/stream.ts +0 -28
  62. package/src/polyfills/url.ts +0 -73
@@ -1,24 +0,0 @@
1
- /**
2
- * stream/web polyfill for WASI environment
3
- * Exports the native Web Streams API which is built into StarlingMonkey
4
- */
5
-
6
- export const ReadableStream = globalThis.ReadableStream;
7
- export const WritableStream = globalThis.WritableStream;
8
- export const TransformStream = globalThis.TransformStream;
9
- export const ReadableStreamDefaultReader = globalThis.ReadableStreamDefaultReader;
10
- export const ReadableStreamBYOBReader = (globalThis as any).ReadableStreamBYOBReader;
11
- export const WritableStreamDefaultWriter = globalThis.WritableStreamDefaultWriter;
12
- export const ByteLengthQueuingStrategy = globalThis.ByteLengthQueuingStrategy;
13
- export const CountQueuingStrategy = globalThis.CountQueuingStrategy;
14
-
15
- export default {
16
- ReadableStream,
17
- WritableStream,
18
- TransformStream,
19
- ReadableStreamDefaultReader,
20
- ReadableStreamBYOBReader,
21
- WritableStreamDefaultWriter,
22
- ByteLengthQueuingStrategy,
23
- CountQueuingStrategy,
24
- };
@@ -1,28 +0,0 @@
1
- /**
2
- * Stream polyfill for WASI environment
3
- * Provides Node.js-compatible streams using the readable-stream package
4
- */
5
-
6
- export {
7
- Readable,
8
- Writable,
9
- Duplex,
10
- Transform,
11
- PassThrough,
12
- Stream,
13
- pipeline,
14
- finished,
15
- } from 'readable-stream';
16
-
17
- import { Readable, Writable, Duplex, Transform, PassThrough, Stream } from 'readable-stream';
18
-
19
- const stream = {
20
- Readable,
21
- Writable,
22
- Duplex,
23
- Transform,
24
- PassThrough,
25
- Stream,
26
- };
27
-
28
- export default stream;
@@ -1,73 +0,0 @@
1
- /**
2
- * URL polyfill for WASI environment
3
- * Aliases Node.js 'url' module to native Web URL APIs
4
- */
5
-
6
- export const URL = globalThis.URL;
7
-
8
- export const URLSearchParams = globalThis.URLSearchParams;
9
-
10
- /**
11
- * Legacy Node.js url.parse()
12
- */
13
- export function parse(urlString: string, parseQueryString?: boolean): any {
14
- try {
15
- const url = new URL(urlString);
16
- return {
17
- href: url.href,
18
- protocol: url.protocol,
19
- host: url.host,
20
- hostname: url.hostname,
21
- port: url.port,
22
- pathname: url.pathname,
23
- search: url.search,
24
- hash: url.hash,
25
- query: parseQueryString ? Object.fromEntries(url.searchParams) : url.search.slice(1),
26
- };
27
- } catch (e) {
28
- return null;
29
- }
30
- }
31
-
32
- /**
33
- * Legacy Node.js url.format()
34
- */
35
- export function format(urlObject: any): string {
36
- if (typeof urlObject === 'string') {
37
- return urlObject;
38
- }
39
-
40
- try {
41
- const protocol = urlObject.protocol || 'http:';
42
- const hostname = urlObject.hostname || urlObject.host || 'localhost';
43
- const port = urlObject.port ? `:${urlObject.port}` : '';
44
- const pathname = urlObject.pathname || '/';
45
- const search = urlObject.search || '';
46
- const hash = urlObject.hash || '';
47
-
48
- return `${protocol}//${hostname}${port}${pathname}${search}${hash}`;
49
- } catch (e) {
50
- return '';
51
- }
52
- }
53
-
54
- /**
55
- * Legacy Node.js url.resolve()
56
- */
57
- export function resolve(from: string, to: string): string {
58
- try {
59
- return new URL(to, from).href;
60
- } catch (e) {
61
- return to;
62
- }
63
- }
64
-
65
- const url = {
66
- URL,
67
- URLSearchParams,
68
- parse,
69
- format,
70
- resolve,
71
- };
72
-
73
- export default url;