@workflow/sveltekit 4.0.0-beta.14 → 4.0.0-beta.16
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/dist/plugin.d.ts +1 -1
- package/dist/plugin.d.ts.map +1 -1
- package/dist/plugin.js +52 -118
- package/dist/plugin.js.map +1 -1
- package/package.json +4 -3
package/dist/plugin.d.ts
CHANGED
package/dist/plugin.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAoB,MAAM,EAAE,MAAM,MAAM,CAAC;AAIrD,wBAAgB,cAAc,IAAI,MAAM,EAAE,CAuEzC"}
|
package/dist/plugin.js
CHANGED
|
@@ -1,132 +1,66 @@
|
|
|
1
|
-
import { relative } from 'node:path';
|
|
2
|
-
import { transform } from '@swc/core';
|
|
3
|
-
import { resolveModulePath } from 'exsolve';
|
|
4
1
|
import { SvelteKitBuilder } from './builder.js';
|
|
2
|
+
import { workflowTransformPlugin } from '@workflow/rollup';
|
|
5
3
|
export function workflowPlugin() {
|
|
6
4
|
let builder;
|
|
7
|
-
return
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
// Calculate relative filename for SWC plugin
|
|
22
|
-
// The SWC plugin uses filename to generate workflowId, so it must be relative
|
|
23
|
-
const workingDir = process.cwd();
|
|
24
|
-
const normalizedWorkingDir = workingDir
|
|
25
|
-
.replace(/\\/g, '/')
|
|
26
|
-
.replace(/\/$/, '');
|
|
27
|
-
const normalizedFilepath = id.replace(/\\/g, '/');
|
|
28
|
-
// Windows fix: Use case-insensitive comparison to work around drive letter casing issues
|
|
29
|
-
const lowerWd = normalizedWorkingDir.toLowerCase();
|
|
30
|
-
const lowerPath = normalizedFilepath.toLowerCase();
|
|
31
|
-
let relativeFilename;
|
|
32
|
-
if (lowerPath.startsWith(lowerWd + '/')) {
|
|
33
|
-
// File is under working directory - manually calculate relative path
|
|
34
|
-
relativeFilename = normalizedFilepath.substring(normalizedWorkingDir.length + 1);
|
|
35
|
-
}
|
|
36
|
-
else if (lowerPath === lowerWd) {
|
|
37
|
-
// File IS the working directory (shouldn't happen)
|
|
38
|
-
relativeFilename = '.';
|
|
39
|
-
}
|
|
40
|
-
else {
|
|
41
|
-
// Use relative() for files outside working directory
|
|
42
|
-
relativeFilename = relative(workingDir, id).replace(/\\/g, '/');
|
|
43
|
-
if (relativeFilename.startsWith('../')) {
|
|
44
|
-
relativeFilename = relativeFilename
|
|
45
|
-
.split('/')
|
|
46
|
-
.filter((part) => part !== '..')
|
|
47
|
-
.join('/');
|
|
5
|
+
return [
|
|
6
|
+
workflowTransformPlugin(),
|
|
7
|
+
{
|
|
8
|
+
name: 'workflow:sveltekit',
|
|
9
|
+
configResolved() {
|
|
10
|
+
builder = new SvelteKitBuilder();
|
|
11
|
+
},
|
|
12
|
+
// TODO: Move this to @workflow/vite or something since this is vite specific
|
|
13
|
+
async hotUpdate(options) {
|
|
14
|
+
const { file, server, read } = options;
|
|
15
|
+
// Check if this is a TS/JS file that might contain workflow directives
|
|
16
|
+
const jsTsRegex = /\.(ts|tsx|js|jsx|mjs|cjs)$/;
|
|
17
|
+
if (!jsTsRegex.test(file)) {
|
|
18
|
+
return;
|
|
48
19
|
}
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
};
|
|
76
|
-
},
|
|
77
|
-
configResolved() {
|
|
78
|
-
builder = new SvelteKitBuilder();
|
|
79
|
-
},
|
|
80
|
-
// TODO: Move this to @workflow/vite or something since this is vite specific
|
|
81
|
-
async hotUpdate(options) {
|
|
82
|
-
const { file, server, read } = options;
|
|
83
|
-
// Check if this is a TS/JS file that might contain workflow directives
|
|
84
|
-
const jsTsRegex = /\.(ts|tsx|js|jsx|mjs|cjs)$/;
|
|
85
|
-
if (!jsTsRegex.test(file)) {
|
|
86
|
-
return;
|
|
87
|
-
}
|
|
88
|
-
// Read the file to check for workflow/step directives
|
|
89
|
-
let content;
|
|
90
|
-
try {
|
|
91
|
-
content = await read();
|
|
92
|
-
}
|
|
93
|
-
catch {
|
|
94
|
-
// File might have been deleted - trigger rebuild to update generated routes
|
|
95
|
-
console.log('Workflow file deleted, regenerating routes...');
|
|
20
|
+
// Read the file to check for workflow/step directives
|
|
21
|
+
let content;
|
|
22
|
+
try {
|
|
23
|
+
content = await read();
|
|
24
|
+
}
|
|
25
|
+
catch {
|
|
26
|
+
// File might have been deleted - trigger rebuild to update generated routes
|
|
27
|
+
console.log('Workflow file deleted, regenerating routes...');
|
|
28
|
+
try {
|
|
29
|
+
await builder.build();
|
|
30
|
+
}
|
|
31
|
+
catch (buildError) {
|
|
32
|
+
// Build might fail if files are being deleted during test cleanup
|
|
33
|
+
// Log but don't crash - the next successful change will trigger a rebuild
|
|
34
|
+
console.error('Build failed during file deletion:', buildError);
|
|
35
|
+
}
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
const useWorkflowPattern = /^\s*(['"])use workflow\1;?\s*$/m;
|
|
39
|
+
const useStepPattern = /^\s*(['"])use step\1;?\s*$/m;
|
|
40
|
+
if (!useWorkflowPattern.test(content) &&
|
|
41
|
+
!useStepPattern.test(content)) {
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
// Rebuild everything - simpler and more reliable than tracking individual files
|
|
45
|
+
console.log('Workflow file changed, regenerating routes...');
|
|
96
46
|
try {
|
|
97
47
|
await builder.build();
|
|
98
48
|
}
|
|
99
49
|
catch (buildError) {
|
|
100
|
-
// Build might fail if files are being deleted during test cleanup
|
|
50
|
+
// Build might fail if files are being modified/deleted during test cleanup
|
|
101
51
|
// Log but don't crash - the next successful change will trigger a rebuild
|
|
102
|
-
console.error('Build failed during
|
|
52
|
+
console.error('Build failed during HMR:', buildError);
|
|
53
|
+
return;
|
|
103
54
|
}
|
|
55
|
+
// Trigger full reload of workflow routes
|
|
56
|
+
server.ws.send({
|
|
57
|
+
type: 'full-reload',
|
|
58
|
+
path: '*',
|
|
59
|
+
});
|
|
60
|
+
// Let Vite handle the normal HMR for the changed file
|
|
104
61
|
return;
|
|
105
|
-
}
|
|
106
|
-
const useWorkflowPattern = /^\s*(['"])use workflow\1;?\s*$/m;
|
|
107
|
-
const useStepPattern = /^\s*(['"])use step\1;?\s*$/m;
|
|
108
|
-
if (!useWorkflowPattern.test(content) && !useStepPattern.test(content)) {
|
|
109
|
-
return;
|
|
110
|
-
}
|
|
111
|
-
// Rebuild everything - simpler and more reliable than tracking individual files
|
|
112
|
-
console.log('Workflow file changed, regenerating routes...');
|
|
113
|
-
try {
|
|
114
|
-
await builder.build();
|
|
115
|
-
}
|
|
116
|
-
catch (buildError) {
|
|
117
|
-
// Build might fail if files are being modified/deleted during test cleanup
|
|
118
|
-
// Log but don't crash - the next successful change will trigger a rebuild
|
|
119
|
-
console.error('Build failed during HMR:', buildError);
|
|
120
|
-
return;
|
|
121
|
-
}
|
|
122
|
-
// Trigger full reload of workflow routes
|
|
123
|
-
server.ws.send({
|
|
124
|
-
type: 'full-reload',
|
|
125
|
-
path: '*',
|
|
126
|
-
});
|
|
127
|
-
// Let Vite handle the normal HMR for the changed file
|
|
128
|
-
return;
|
|
62
|
+
},
|
|
129
63
|
},
|
|
130
|
-
|
|
64
|
+
];
|
|
131
65
|
}
|
|
132
66
|
//# sourceMappingURL=plugin.js.map
|
package/dist/plugin.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.js","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"plugin.js","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AAE3D,MAAM,UAAU,cAAc;IAC5B,IAAI,OAAyB,CAAC;IAE9B,OAAO;QACL,uBAAuB,EAAE;QACzB;YACE,IAAI,EAAE,oBAAoB;YAE1B,cAAc;gBACZ,OAAO,GAAG,IAAI,gBAAgB,EAAE,CAAC;YACnC,CAAC;YAED,6EAA6E;YAC7E,KAAK,CAAC,SAAS,CAAC,OAAyB;gBACvC,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,OAAO,CAAC;gBAEvC,uEAAuE;gBACvE,MAAM,SAAS,GAAG,4BAA4B,CAAC;gBAC/C,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;oBAC1B,OAAO;gBACT,CAAC;gBAED,sDAAsD;gBACtD,IAAI,OAAe,CAAC;gBACpB,IAAI,CAAC;oBACH,OAAO,GAAG,MAAM,IAAI,EAAE,CAAC;gBACzB,CAAC;gBAAC,MAAM,CAAC;oBACP,4EAA4E;oBAC5E,OAAO,CAAC,GAAG,CAAC,+CAA+C,CAAC,CAAC;oBAC7D,IAAI,CAAC;wBACH,MAAM,OAAO,CAAC,KAAK,EAAE,CAAC;oBACxB,CAAC;oBAAC,OAAO,UAAU,EAAE,CAAC;wBACpB,kEAAkE;wBAClE,0EAA0E;wBAC1E,OAAO,CAAC,KAAK,CAAC,oCAAoC,EAAE,UAAU,CAAC,CAAC;oBAClE,CAAC;oBACD,OAAO;gBACT,CAAC;gBAED,MAAM,kBAAkB,GAAG,iCAAiC,CAAC;gBAC7D,MAAM,cAAc,GAAG,6BAA6B,CAAC;gBAErD,IACE,CAAC,kBAAkB,CAAC,IAAI,CAAC,OAAO,CAAC;oBACjC,CAAC,cAAc,CAAC,IAAI,CAAC,OAAO,CAAC,EAC7B,CAAC;oBACD,OAAO;gBACT,CAAC;gBAED,gFAAgF;gBAChF,OAAO,CAAC,GAAG,CAAC,+CAA+C,CAAC,CAAC;gBAC7D,IAAI,CAAC;oBACH,MAAM,OAAO,CAAC,KAAK,EAAE,CAAC;gBACxB,CAAC;gBAAC,OAAO,UAAU,EAAE,CAAC;oBACpB,2EAA2E;oBAC3E,0EAA0E;oBAC1E,OAAO,CAAC,KAAK,CAAC,0BAA0B,EAAE,UAAU,CAAC,CAAC;oBACtD,OAAO;gBACT,CAAC;gBAED,yCAAyC;gBACzC,MAAM,CAAC,EAAE,CAAC,IAAI,CAAC;oBACb,IAAI,EAAE,aAAa;oBACnB,IAAI,EAAE,GAAG;iBACV,CAAC,CAAC;gBAEH,sDAAsD;gBACtD,OAAO;YACT,CAAC;SACF;KACF,CAAC;AACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@workflow/sveltekit",
|
|
3
|
-
"version": "4.0.0-beta.
|
|
3
|
+
"version": "4.0.0-beta.16",
|
|
4
4
|
"description": "SvelteKit integration for Workflow DevKit",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -24,8 +24,9 @@
|
|
|
24
24
|
"fs-extra": "^11.3.2",
|
|
25
25
|
"exsolve": "^1.0.7",
|
|
26
26
|
"pathe": "^2.0.3",
|
|
27
|
-
"@workflow/builders": "4.0.1-beta.
|
|
28
|
-
"@workflow/swc-plugin": "4.0.1-beta.
|
|
27
|
+
"@workflow/builders": "4.0.1-beta.18",
|
|
28
|
+
"@workflow/swc-plugin": "4.0.1-beta.8",
|
|
29
|
+
"@workflow/rollup": "4.0.0-beta.2"
|
|
29
30
|
},
|
|
30
31
|
"devDependencies": {
|
|
31
32
|
"@types/fs-extra": "11.0.4",
|