@workflow/next 5.0.0-beta.4 → 5.0.0-beta.41

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 (40) hide show
  1. package/dist/builder-eager.d.ts +1 -1
  2. package/dist/builder-eager.d.ts.map +1 -1
  3. package/dist/builder-eager.js +377 -220
  4. package/dist/builder.d.ts +1 -4
  5. package/dist/builder.d.ts.map +1 -1
  6. package/dist/builder.js +2 -28
  7. package/dist/index.d.ts +8 -1
  8. package/dist/index.d.ts.map +1 -1
  9. package/dist/index.js +333 -55
  10. package/dist/loader.d.ts +5 -0
  11. package/dist/loader.d.ts.map +1 -1
  12. package/dist/loader.js +15 -341
  13. package/dist/runtime.d.ts +1 -1
  14. package/dist/runtime.d.ts.map +1 -1
  15. package/dist/runtime.js +2 -2
  16. package/dist/swc-plugin-cache.d.ts +7 -0
  17. package/dist/swc-plugin-cache.d.ts.map +1 -0
  18. package/dist/swc-plugin-cache.js +23 -0
  19. package/dist/watch-ignore.d.ts +51 -0
  20. package/dist/watch-ignore.d.ts.map +1 -0
  21. package/dist/watch-ignore.js +264 -0
  22. package/dist/watch-rebuild.d.ts +63 -0
  23. package/dist/watch-rebuild.d.ts.map +1 -0
  24. package/dist/watch-rebuild.js +399 -0
  25. package/docs/api-reference/with-workflow.mdx +56 -2
  26. package/docs/next.mdx +12 -6
  27. package/package.json +10 -7
  28. package/dist/builder-deferred.d.ts +0 -2
  29. package/dist/builder-deferred.d.ts.map +0 -1
  30. package/dist/builder-deferred.js +0 -1401
  31. package/dist/builder-deferred.js.map +0 -1
  32. package/dist/builder-eager.js.map +0 -1
  33. package/dist/builder.js.map +0 -1
  34. package/dist/index.js.map +0 -1
  35. package/dist/loader.js.map +0 -1
  36. package/dist/runtime.js.map +0 -1
  37. package/dist/socket-server.d.ts +0 -48
  38. package/dist/socket-server.d.ts.map +0 -1
  39. package/dist/socket-server.js +0 -154
  40. package/dist/socket-server.js.map +0 -1
@@ -1,154 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.serializeMessage = serializeMessage;
4
- exports.parseMessage = parseMessage;
5
- exports.createSocketServer = createSocketServer;
6
- const node_crypto_1 = require("node:crypto");
7
- const promises_1 = require("node:fs/promises");
8
- const node_net_1 = require("node:net");
9
- const node_path_1 = require("node:path");
10
- /**
11
- * Magic preamble that must prefix all messages to authenticate them as workflow messages.
12
- * This prevents accidental processing of messages from port scanners or other local processes.
13
- */
14
- const MESSAGE_PREAMBLE = 'WF:';
15
- /**
16
- * Generate a random authentication token for this server session.
17
- * Clients must include this token in all messages.
18
- */
19
- function generateAuthToken() {
20
- return (0, node_crypto_1.randomBytes)(16).toString('hex');
21
- }
22
- function getDefaultSocketInfoFilePath() {
23
- return (0, node_path_1.join)(process.cwd(), '.next', 'cache', 'workflow-socket.json');
24
- }
25
- /**
26
- * Serialize a message with authentication preamble
27
- */
28
- function serializeMessage(message, authToken) {
29
- return `${MESSAGE_PREAMBLE}${authToken}:${JSON.stringify(message)}\n`;
30
- }
31
- /**
32
- * Parse and authenticate a message from the socket
33
- * Returns the parsed message if valid, null otherwise
34
- */
35
- function parseMessage(line, authToken) {
36
- const trimmed = line.trim();
37
- if (!trimmed) {
38
- return null;
39
- }
40
- // Check for preamble
41
- if (!trimmed.startsWith(MESSAGE_PREAMBLE)) {
42
- console.warn('Received message without valid preamble, ignoring');
43
- return null;
44
- }
45
- // Extract auth token and payload
46
- const withoutPreamble = trimmed.slice(MESSAGE_PREAMBLE.length);
47
- const colonIndex = withoutPreamble.indexOf(':');
48
- if (colonIndex === -1) {
49
- console.warn('Received message without auth token separator, ignoring');
50
- return null;
51
- }
52
- const messageToken = withoutPreamble.slice(0, colonIndex);
53
- const payload = withoutPreamble.slice(colonIndex + 1);
54
- // Verify auth token
55
- if (messageToken !== authToken) {
56
- console.warn('Received message with invalid auth token, ignoring');
57
- return null;
58
- }
59
- // Parse JSON payload
60
- try {
61
- return JSON.parse(payload);
62
- }
63
- catch (error) {
64
- console.error('Failed to parse socket message JSON:', error);
65
- return null;
66
- }
67
- }
68
- /**
69
- * Create a TCP socket server for loader<->builder communication.
70
- * Returns a SocketIO interface for broadcasting messages and the auth token.
71
- *
72
- * SECURITY: Server listens on 127.0.0.1 (localhost only) and uses
73
- * message authentication to prevent processing of unauthorized messages.
74
- */
75
- async function createSocketServer(config) {
76
- const authToken = generateAuthToken();
77
- const clients = new Set();
78
- let buildTriggered = false;
79
- const server = (0, node_net_1.createServer)((socket) => {
80
- socket.setNoDelay(true);
81
- clients.add(socket);
82
- // Send build-complete if build already finished (production mode)
83
- if (buildTriggered && !config.isDevServer) {
84
- socket.write(serializeMessage({ type: 'build-complete' }, authToken));
85
- }
86
- let buffer = '';
87
- socket.on('data', (data) => {
88
- buffer += data.toString();
89
- // Process complete messages (newline-delimited)
90
- let newlineIndex = buffer.indexOf('\n');
91
- while (newlineIndex !== -1) {
92
- const line = buffer.slice(0, newlineIndex);
93
- buffer = buffer.slice(newlineIndex + 1);
94
- newlineIndex = buffer.indexOf('\n');
95
- const message = parseMessage(line, authToken);
96
- if (!message) {
97
- continue;
98
- }
99
- if (message.type === 'file-discovered') {
100
- config.onFileDiscovered(message.filePath, message.hasWorkflow, message.hasStep, message.hasSerde);
101
- }
102
- else if (message.type === 'trigger-build') {
103
- config.onTriggerBuild();
104
- }
105
- }
106
- });
107
- socket.on('end', () => {
108
- clients.delete(socket);
109
- });
110
- socket.on('error', (err) => {
111
- console.error('Socket error:', err);
112
- clients.delete(socket);
113
- });
114
- });
115
- // Listen on random available port (localhost only)
116
- await new Promise((resolve, reject) => {
117
- server.once('error', reject);
118
- server.listen(0, '127.0.0.1', () => {
119
- const address = server.address();
120
- if (address && typeof address === 'object') {
121
- const socketInfoFilePath = config.socketInfoFilePath || getDefaultSocketInfoFilePath();
122
- void (async () => {
123
- try {
124
- await (0, promises_1.mkdir)((0, node_path_1.dirname)(socketInfoFilePath), { recursive: true });
125
- await (0, promises_1.writeFile)(socketInfoFilePath, JSON.stringify({
126
- port: address.port,
127
- authToken,
128
- }, null, 2));
129
- process.env.WORKFLOW_SOCKET_INFO_PATH = socketInfoFilePath;
130
- process.env.WORKFLOW_SOCKET_PORT = String(address.port);
131
- process.env.WORKFLOW_SOCKET_AUTH = authToken;
132
- resolve();
133
- }
134
- catch (error) {
135
- reject(error);
136
- }
137
- })();
138
- return;
139
- }
140
- reject(new Error('Failed to obtain workflow socket server address'));
141
- });
142
- });
143
- return {
144
- emit: (_event) => {
145
- buildTriggered = true;
146
- const message = serializeMessage({ type: 'build-complete' }, authToken);
147
- for (const client of clients) {
148
- client.write(message);
149
- }
150
- },
151
- getAuthToken: () => authToken,
152
- };
153
- }
154
- //# sourceMappingURL=socket-server.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"socket-server.js","sourceRoot":"","sources":["../src/socket-server.ts"],"names":[],"mappings":";;AA+DA,4CAKC;AAMD,oCAuCC;AASD,gDAsGC;AAhOD,6CAA0C;AAC1C,+CAAoD;AACpD,uCAAkE;AAClE,yCAA0C;AAE1C;;;GAGG;AACH,MAAM,gBAAgB,GAAG,KAAK,CAAC;AAE/B;;;GAGG;AACH,SAAS,iBAAiB;IACxB,OAAO,IAAA,yBAAW,EAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;AACzC,CAAC;AAuCD,SAAS,4BAA4B;IACnC,OAAO,IAAA,gBAAI,EAAC,OAAO,CAAC,GAAG,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE,sBAAsB,CAAC,CAAC;AACvE,CAAC;AAED;;GAEG;AACH,SAAgB,gBAAgB,CAC9B,OAAsB,EACtB,SAAiB;IAEjB,OAAO,GAAG,gBAAgB,GAAG,SAAS,IAAI,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC;AACxE,CAAC;AAED;;;GAGG;AACH,SAAgB,YAAY,CAC1B,IAAY,EACZ,SAAiB;IAEjB,MAAM,OAAO,GAAG,IAAI,C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CAAC;wBACF,OAAO,CAAC,GAAG,CAAC,yBAAyB,GAAG,kBAAkB,CAAC;wBAC3D,OAAO,CAAC,GAAG,CAAC,oBAAoB,GAAG,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;wBACxD,OAAO,CAAC,GAAG,CAAC,oBAAoB,GAAG,SAAS,CAAC;wBAC7C,OAAO,EAAE,CAAC;oBACZ,CAAC;oBAAC,OAAO,KAAK,EAAE,CAAC;wBACf,MAAM,CAAC,KAAK,CAAC,CAAC;oBAChB,CAAC;gBACH,CAAC,CAAC,EAAE,CAAC;gBACL,OAAO;YACT,CAAC;YACD,MAAM,CAAC,IAAI,KAAK,CAAC,iDAAiD,CAAC,CAAC,CAAC;QACvE,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,OAAO;QACL,IAAI,EAAE,CAAC,MAAwB,EAAE,EAAE;YACjC,cAAc,GAAG,IAAI,CAAC;YACtB,MAAM,OAAO,GAAG,gBAAgB,CAAC,EAAE,IAAI,EAAE,gBAAgB,EAAE,EAAE,SAAS,CAAC,CAAC;YACxE,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE,CAAC;gBAC7B,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;YACxB,CAAC;QACH,CAAC;QACD,YAAY,EAAE,GAAG,EAAE,CAAC,SAAS;KAC9B,CAAC;AACJ,CAAC","sourcesContent":["import { randomBytes } from 'node:crypto';\nimport { mkdir, writeFile } from 'node:fs/promises';\nimport { createServer, type Server, type Socket } from 'node:net';\nimport { dirname, join } from 'node:path';\n\n/**\n * Magic preamble that must prefix all messages to authenticate them as workflow messages.\n * This prevents accidental processing of messages from port scanners or other local processes.\n */\nconst MESSAGE_PREAMBLE = 'WF:';\n\n/**\n * Generate a random authentication token for this server session.\n * Clients must include this token in all messages.\n */\nfunction generateAuthToken(): string {\n return randomBytes(16).toString('hex');\n}\n\n/**\n * Message types that can be sent between loader and builder\n */\nexport type SocketMessage =\n | {\n type: 'file-discovered';\n filePath: string;\n hasWorkflow: boolean;\n hasStep: boolean;\n hasSerde: boolean;\n }\n | { type: 'trigger-build' }\n | { type: 'build-complete' };\n\n/**\n * Configuration for the socket server\n */\nexport interface SocketServerConfig {\n isDevServer: boolean;\n onFileDiscovered: (\n filePath: string,\n hasWorkflow: boolean,\n hasStep: boolean,\n hasSerde: boolean\n ) => void;\n onTriggerBuild: () => void;\n socketInfoFilePath?: string;\n}\n\n/**\n * Interface for the socket IO instance returned by createSocketServer\n */\nexport interface SocketIO {\n emit(event: 'build-complete'): void;\n getAuthToken(): string;\n}\n\nfunction getDefaultSocketInfoFilePath(): string {\n return join(process.cwd(), '.next', 'cache', 'workflow-socket.json');\n}\n\n/**\n * Serialize a message with authentication preamble\n */\nexport function serializeMessage(\n message: SocketMessage,\n authToken: string\n): string {\n return `${MESSAGE_PREAMBLE}${authToken}:${JSON.stringify(message)}\\n`;\n}\n\n/**\n * Parse and authenticate a message from the socket\n * Returns the parsed message if valid, null otherwise\n */\nexport function parseMessage(\n line: string,\n authToken: string\n): SocketMessage | null {\n const trimmed = line.trim();\n if (!trimmed) {\n return null;\n }\n\n // Check for preamble\n if (!trimmed.startsWith(MESSAGE_PREAMBLE)) {\n console.warn('Received message without valid preamble, ignoring');\n return null;\n }\n\n // Extract auth token and payload\n const withoutPreamble = trimmed.slice(MESSAGE_PREAMBLE.length);\n const colonIndex = withoutPreamble.indexOf(':');\n if (colonIndex === -1) {\n console.warn('Received message without auth token separator, ignoring');\n return null;\n }\n\n const messageToken = withoutPreamble.slice(0, colonIndex);\n const payload = withoutPreamble.slice(colonIndex + 1);\n\n // Verify auth token\n if (messageToken !== authToken) {\n console.warn('Received message with invalid auth token, ignoring');\n return null;\n }\n\n // Parse JSON payload\n try {\n return JSON.parse(payload) as SocketMessage;\n } catch (error) {\n console.error('Failed to parse socket message JSON:', error);\n return null;\n }\n}\n\n/**\n * Create a TCP socket server for loader<->builder communication.\n * Returns a SocketIO interface for broadcasting messages and the auth token.\n *\n * SECURITY: Server listens on 127.0.0.1 (localhost only) and uses\n * message authentication to prevent processing of unauthorized messages.\n */\nexport async function createSocketServer(\n config: SocketServerConfig\n): Promise<SocketIO> {\n const authToken = generateAuthToken();\n const clients = new Set<Socket>();\n let buildTriggered = false;\n\n const server: Server = createServer((socket: Socket) => {\n socket.setNoDelay(true);\n clients.add(socket);\n\n // Send build-complete if build already finished (production mode)\n if (buildTriggered && !config.isDevServer) {\n socket.write(serializeMessage({ type: 'build-complete' }, authToken));\n }\n\n let buffer = '';\n\n socket.on('data', (data: Buffer) => {\n buffer += data.toString();\n\n // Process complete messages (newline-delimited)\n let newlineIndex = buffer.indexOf('\\n');\n while (newlineIndex !== -1) {\n const line = buffer.slice(0, newlineIndex);\n buffer = buffer.slice(newlineIndex + 1);\n newlineIndex = buffer.indexOf('\\n');\n\n const message = parseMessage(line, authToken);\n if (!message) {\n continue;\n }\n\n if (message.type === 'file-discovered') {\n config.onFileDiscovered(\n message.filePath,\n message.hasWorkflow,\n message.hasStep,\n message.hasSerde\n );\n } else if (message.type === 'trigger-build') {\n config.onTriggerBuild();\n }\n }\n });\n\n socket.on('end', () => {\n clients.delete(socket);\n });\n\n socket.on('error', (err: Error) => {\n console.error('Socket error:', err);\n clients.delete(socket);\n });\n });\n\n // Listen on random available port (localhost only)\n await new Promise<void>((resolve, reject) => {\n server.once('error', reject);\n server.listen(0, '127.0.0.1', () => {\n const address = server.address();\n if (address && typeof address === 'object') {\n const socketInfoFilePath =\n config.socketInfoFilePath || getDefaultSocketInfoFilePath();\n void (async () => {\n try {\n await mkdir(dirname(socketInfoFilePath), { recursive: true });\n await writeFile(\n socketInfoFilePath,\n JSON.stringify(\n {\n port: address.port,\n authToken,\n },\n null,\n 2\n )\n );\n process.env.WORKFLOW_SOCKET_INFO_PATH = socketInfoFilePath;\n process.env.WORKFLOW_SOCKET_PORT = String(address.port);\n process.env.WORKFLOW_SOCKET_AUTH = authToken;\n resolve();\n } catch (error) {\n reject(error);\n }\n })();\n return;\n }\n reject(new Error('Failed to obtain workflow socket server address'));\n });\n });\n\n return {\n emit: (_event: 'build-complete') => {\n buildTriggered = true;\n const message = serializeMessage({ type: 'build-complete' }, authToken);\n for (const client of clients) {\n client.write(message);\n }\n },\n getAuthToken: () => authToken,\n };\n}\n"]}