@workflow/next 4.0.1-beta.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.
- package/LICENSE.md +21 -0
- package/README.md +3 -0
- package/dist/index.d.ts +128 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +90 -0
- package/dist/index.js.map +1 -0
- package/dist/loader.d.ts +4 -0
- package/dist/loader.d.ts.map +1 -0
- package/dist/loader.js +38 -0
- package/dist/loader.js.map +1 -0
- package/dist/runtime.d.ts +2 -0
- package/dist/runtime.d.ts.map +1 -0
- package/dist/runtime.js +21 -0
- package/dist/runtime.js.map +1 -0
- package/package.json +41 -0
package/LICENSE.md
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Vercel, Inc.
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import type { NextConfig } from 'next';
|
|
2
|
+
export declare function withWorkflow({ workflows, ...nextConfig }: NextConfig & {
|
|
3
|
+
workflows?: {
|
|
4
|
+
embedded?: {
|
|
5
|
+
port?: number;
|
|
6
|
+
dataDir?: string;
|
|
7
|
+
};
|
|
8
|
+
};
|
|
9
|
+
}): (phase: string) => Promise<{
|
|
10
|
+
[x: string]: any;
|
|
11
|
+
allowedDevOrigins?: string[];
|
|
12
|
+
exportPathMap?: (defaultMap: import("next/dist/server/config-shared").ExportPathMap, ctx: {
|
|
13
|
+
dev: boolean;
|
|
14
|
+
dir: string;
|
|
15
|
+
outDir: string | null;
|
|
16
|
+
distDir: string;
|
|
17
|
+
buildId: string;
|
|
18
|
+
}) => Promise<import("next/dist/server/config-shared").ExportPathMap> | import("next/dist/server/config-shared").ExportPathMap;
|
|
19
|
+
i18n?: import("next/dist/server/config-shared").I18NConfig | null;
|
|
20
|
+
eslint?: import("next/dist/server/config-shared").ESLintConfig;
|
|
21
|
+
typescript?: import("next/dist/server/config-shared").TypeScriptConfig;
|
|
22
|
+
typedRoutes?: boolean;
|
|
23
|
+
headers?: () => Promise<import("next/dist/lib/load-custom-routes").Header[]>;
|
|
24
|
+
rewrites?: () => Promise<import("next/dist/lib/load-custom-routes").Rewrite[] | {
|
|
25
|
+
beforeFiles?: import("next/dist/lib/load-custom-routes").Rewrite[];
|
|
26
|
+
afterFiles?: import("next/dist/lib/load-custom-routes").Rewrite[];
|
|
27
|
+
fallback?: import("next/dist/lib/load-custom-routes").Rewrite[];
|
|
28
|
+
}>;
|
|
29
|
+
redirects?: () => Promise<import("next/dist/lib/load-custom-routes").Redirect[]>;
|
|
30
|
+
excludeDefaultMomentLocales?: boolean;
|
|
31
|
+
webpack?: import("next/dist/server/config-shared").NextJsWebpackConfig | null;
|
|
32
|
+
trailingSlash?: boolean;
|
|
33
|
+
env?: Record<string, string | undefined>;
|
|
34
|
+
distDir?: string;
|
|
35
|
+
cleanDistDir?: boolean;
|
|
36
|
+
assetPrefix?: string;
|
|
37
|
+
cacheHandler?: string | undefined;
|
|
38
|
+
cacheMaxMemorySize?: number;
|
|
39
|
+
useFileSystemPublicRoutes?: boolean;
|
|
40
|
+
generateBuildId?: () => string | null | Promise<string | null>;
|
|
41
|
+
generateEtags?: boolean;
|
|
42
|
+
pageExtensions?: string[];
|
|
43
|
+
compress?: boolean;
|
|
44
|
+
poweredByHeader?: boolean;
|
|
45
|
+
images?: import("next/dist/shared/lib/image-config").ImageConfig;
|
|
46
|
+
devIndicators?: false | {
|
|
47
|
+
appIsrStatus?: boolean;
|
|
48
|
+
buildActivity?: boolean;
|
|
49
|
+
buildActivityPosition?: "top-left" | "top-right" | "bottom-left" | "bottom-right";
|
|
50
|
+
position?: "top-left" | "top-right" | "bottom-left" | "bottom-right";
|
|
51
|
+
};
|
|
52
|
+
onDemandEntries?: {
|
|
53
|
+
maxInactiveAge?: number;
|
|
54
|
+
pagesBufferLength?: number;
|
|
55
|
+
};
|
|
56
|
+
amp?: {
|
|
57
|
+
canonicalBase?: string;
|
|
58
|
+
};
|
|
59
|
+
deploymentId?: string;
|
|
60
|
+
basePath?: string;
|
|
61
|
+
sassOptions?: {
|
|
62
|
+
implementation?: string;
|
|
63
|
+
[key: string]: any;
|
|
64
|
+
};
|
|
65
|
+
productionBrowserSourceMaps?: boolean;
|
|
66
|
+
reactProductionProfiling?: boolean;
|
|
67
|
+
reactStrictMode?: boolean | null;
|
|
68
|
+
reactMaxHeadersLength?: number;
|
|
69
|
+
publicRuntimeConfig?: {
|
|
70
|
+
[key: string]: any;
|
|
71
|
+
};
|
|
72
|
+
serverRuntimeConfig?: {
|
|
73
|
+
[key: string]: any;
|
|
74
|
+
};
|
|
75
|
+
httpAgentOptions?: {
|
|
76
|
+
keepAlive?: boolean;
|
|
77
|
+
};
|
|
78
|
+
staticPageGenerationTimeout?: number;
|
|
79
|
+
crossOrigin?: "anonymous" | "use-credentials";
|
|
80
|
+
compiler?: {
|
|
81
|
+
reactRemoveProperties?: boolean | {
|
|
82
|
+
properties?: string[];
|
|
83
|
+
};
|
|
84
|
+
relay?: {
|
|
85
|
+
src: string;
|
|
86
|
+
artifactDirectory?: string;
|
|
87
|
+
language?: "typescript" | "javascript" | "flow";
|
|
88
|
+
eagerEsModules?: boolean;
|
|
89
|
+
};
|
|
90
|
+
removeConsole?: boolean | {
|
|
91
|
+
exclude?: string[];
|
|
92
|
+
};
|
|
93
|
+
styledComponents?: boolean | import("next/dist/server/config-shared").StyledComponentsConfig;
|
|
94
|
+
emotion?: boolean | import("next/dist/server/config-shared").EmotionConfig;
|
|
95
|
+
styledJsx?: boolean | {
|
|
96
|
+
useLightningcss?: boolean;
|
|
97
|
+
};
|
|
98
|
+
define?: Record<string, string>;
|
|
99
|
+
defineServer?: Record<string, string>;
|
|
100
|
+
runAfterProductionCompile?: (metadata: {
|
|
101
|
+
projectDir: string;
|
|
102
|
+
distDir: string;
|
|
103
|
+
}) => Promise<void>;
|
|
104
|
+
};
|
|
105
|
+
output?: "standalone" | "export";
|
|
106
|
+
transpilePackages?: string[];
|
|
107
|
+
turbopack?: import("next/dist/server/config-shared").TurbopackOptions;
|
|
108
|
+
skipMiddlewareUrlNormalize?: boolean;
|
|
109
|
+
skipTrailingSlashRedirect?: boolean;
|
|
110
|
+
modularizeImports?: Record<string, {
|
|
111
|
+
transform: string | Record<string, string>;
|
|
112
|
+
preventFullImport?: boolean;
|
|
113
|
+
skipDefaultConversion?: boolean;
|
|
114
|
+
}>;
|
|
115
|
+
logging?: import("next/dist/server/config-shared").LoggingConfig | false;
|
|
116
|
+
expireTime?: number;
|
|
117
|
+
experimental?: import("next/dist/server/config-shared").ExperimentalConfig;
|
|
118
|
+
bundlePagesRouterDependencies?: boolean;
|
|
119
|
+
serverExternalPackages?: string[];
|
|
120
|
+
outputFileTracingRoot?: string;
|
|
121
|
+
outputFileTracingExcludes?: Record<string, string[]>;
|
|
122
|
+
outputFileTracingIncludes?: Record<string, string[]>;
|
|
123
|
+
watchOptions?: {
|
|
124
|
+
pollIntervalMs?: number;
|
|
125
|
+
};
|
|
126
|
+
htmlLimitedBots?: RegExp;
|
|
127
|
+
}>;
|
|
128
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAEvC,wBAAgB,YAAY,CAAC,EAC3B,SAAS,EACT,GAAG,UAAU,EACd,EAAE,UAAU,GAAG;IACd,SAAS,CAAC,EAAE;QACV,QAAQ,CAAC,EAAE;YACT,IAAI,CAAC,EAAE,MAAM,CAAC;YACd,OAAO,CAAC,EAAE,MAAM,CAAC;SAClB,CAAC;KACH,CAAC;CACH,IAiEmC,OAAO,MAAM;;;;;;;;;;;;;;;;mBA6BgnzB,CAAC;kBAA+B,CAAC;gBAA6B,CAAC;;;;;;;;;;;;;;;;;;;;oBAAwwI,CAAC;qBAAqO,CAAC;6BAA2M,CAAC;gBAAuN,CAAC;;;sBAAie,CAAC;yBAA4H,CAAC;;;qBAA8M,CAAC;;;;;sBAAkiB,CAAC;;;;;;;;;;;;;;iBAA4sD,CAAC;;;;;6BAA+sB,CAAC;sBAAoC,CAAC;;aAAoC,CAAC;;6BAA0D,CAAC;oBAA8B,CAAC;0BAAkE,CAAC;;qBAA2C,CAAC;mBAAiC,CAAC;;wBAA+C,CAAC;eAAmD,CAAC;iBAA4C,CAAC;2BAAyC,CAAC;;cAA6L,CAAC;oBAAsO,CAAC;iCAA2R,CAAC;;;;;;;;;;;;yBAAstD,CAAC;6BAAwC,CAAC;;;;;;;;;;;sBAAw8C,CAAC;;;GAD1ttC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.withWorkflow = withWorkflow;
|
|
4
|
+
const next_build_1 = require("@workflow/cli/dist/lib/builders/next-build");
|
|
5
|
+
function withWorkflow({ workflows, ...nextConfig }) {
|
|
6
|
+
if (!process.env.VERCEL_DEPLOYMENT_ID) {
|
|
7
|
+
if (!process.env.WORKFLOW_TARGET_WORLD) {
|
|
8
|
+
process.env.WORKFLOW_TARGET_WORLD = 'embedded';
|
|
9
|
+
process.env.WORKFLOW_EMBEDDED_DATA_DIR = '.next/workflow-data';
|
|
10
|
+
}
|
|
11
|
+
const maybePort = workflows?.embedded?.port;
|
|
12
|
+
if (maybePort) {
|
|
13
|
+
process.env.PORT = maybePort.toString();
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
else {
|
|
17
|
+
if (!process.env.WORKFLOW_TARGET_WORLD) {
|
|
18
|
+
process.env.WORKFLOW_TARGET_WORLD = 'vercel';
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
const loaderPath = require.resolve('./loader');
|
|
22
|
+
// configure the loader if turbopack is being used
|
|
23
|
+
if (!nextConfig.turbopack) {
|
|
24
|
+
nextConfig.turbopack = {};
|
|
25
|
+
}
|
|
26
|
+
if (!nextConfig.turbopack.rules) {
|
|
27
|
+
nextConfig.turbopack.rules = {};
|
|
28
|
+
}
|
|
29
|
+
const existingRules = nextConfig.turbopack.rules;
|
|
30
|
+
nextConfig.turbopack.rules = {
|
|
31
|
+
...existingRules,
|
|
32
|
+
'*.tsx': {
|
|
33
|
+
loaders: [...(existingRules['*.tsx']?.loaders || []), loaderPath],
|
|
34
|
+
},
|
|
35
|
+
'*.ts': {
|
|
36
|
+
loaders: [...(existingRules['*.ts']?.loaders || []), loaderPath],
|
|
37
|
+
},
|
|
38
|
+
'*.jsx': {
|
|
39
|
+
loaders: [...(existingRules['*.jsx']?.loaders || []), loaderPath],
|
|
40
|
+
},
|
|
41
|
+
'*.js': {
|
|
42
|
+
loaders: [...(existingRules['*.js']?.loaders || []), loaderPath],
|
|
43
|
+
},
|
|
44
|
+
};
|
|
45
|
+
// configure the loader for webpack
|
|
46
|
+
const existingWebpackModify = nextConfig.webpack;
|
|
47
|
+
nextConfig.webpack = (...args) => {
|
|
48
|
+
const [webpackConfig] = args;
|
|
49
|
+
if (!webpackConfig.module) {
|
|
50
|
+
webpackConfig.module = {};
|
|
51
|
+
}
|
|
52
|
+
if (!webpackConfig.module.rules) {
|
|
53
|
+
webpackConfig.module.rules = [];
|
|
54
|
+
}
|
|
55
|
+
// loaders in webpack apply bottom->up so ensure
|
|
56
|
+
// ours comes before the default swc transform
|
|
57
|
+
webpackConfig.module.rules.push({
|
|
58
|
+
test: /.*\.(mjs|cjs|cts|ts|tsx|js|jsx)$/,
|
|
59
|
+
loader: loaderPath,
|
|
60
|
+
});
|
|
61
|
+
return existingWebpackModify
|
|
62
|
+
? existingWebpackModify(...args)
|
|
63
|
+
: webpackConfig;
|
|
64
|
+
};
|
|
65
|
+
return async function buildConfig(phase) {
|
|
66
|
+
// only run this in the main process so it only runs once
|
|
67
|
+
// as Next.js uses child processes for different builds
|
|
68
|
+
if (!process.env.WORKFLOW_NEXT_PRIVATE_BUILT &&
|
|
69
|
+
phase !== 'phase-production-server') {
|
|
70
|
+
const shouldWatch = process.env.NODE_ENV === 'development';
|
|
71
|
+
const workflowBuilder = new next_build_1.NextBuilder({
|
|
72
|
+
watch: shouldWatch,
|
|
73
|
+
// discover workflows from pages/app entries
|
|
74
|
+
dirs: ['pages', 'app', 'src/pages', 'src/app'],
|
|
75
|
+
workingDir: process.cwd(),
|
|
76
|
+
buildTarget: 'next',
|
|
77
|
+
workflowsBundlePath: '',
|
|
78
|
+
stepsBundlePath: '',
|
|
79
|
+
externalPackages: [
|
|
80
|
+
...require('next/dist/lib/server-external-packages.json'),
|
|
81
|
+
...(nextConfig.serverExternalPackages || []),
|
|
82
|
+
],
|
|
83
|
+
});
|
|
84
|
+
await workflowBuilder.build();
|
|
85
|
+
process.env.WORKFLOW_NEXT_PRIVATE_BUILT = '1';
|
|
86
|
+
}
|
|
87
|
+
return nextConfig;
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;AAGA,oCAuGC;AA1GD,2EAAyE;AAGzE,SAAgB,YAAY,CAAC,EAC3B,SAAS,EACT,GAAG,UAAU,EAQd;IACC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,oBAAoB,EAAE,CAAC;QACtC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,qBAAqB,EAAE,CAAC;YACvC,OAAO,CAAC,GAAG,CAAC,qBAAqB,GAAG,UAAU,CAAC;YAC/C,OAAO,CAAC,GAAG,CAAC,0BAA0B,GAAG,qBAAqB,CAAC;QACjE,CAAC;QACD,MAAM,SAAS,GAAG,SAAS,EAAE,QAAQ,EAAE,IAAI,CAAC;QAC5C,IAAI,SAAS,EAAE,CAAC;YACd,OAAO,CAAC,GAAG,CAAC,IAAI,GAAG,SAAS,CAAC,QAAQ,EAAE,CAAC;QAC1C,CAAC;IACH,CAAC;SAAM,CAAC;QACN,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,qBAAqB,EAAE,CAAC;YACvC,OAAO,CAAC,GAAG,CAAC,qBAAqB,GAAG,QAAQ,CAAC;QAC/C,CAAC;IACH,CAAC;IAED,MAAM,UAAU,GAAG,OAAO,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;IAE/C,kDAAkD;IAClD,IAAI,CAAC,UAAU,CAAC,SAAS,EAAE,CAAC;QAC1B,UAAU,CAAC,SAAS,GAAG,EAAE,CAAC;IAC5B,CAAC;IACD,IAAI,CAAC,UAAU,CAAC,SAA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,MAAM,EAAE,MAAM,GAAG,MAAM,EACvB,SAAS,EAAE,GAAG,GACb,MAAM,CAkCR"}
|
package/dist/loader.js
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = workflowLoader;
|
|
4
|
+
const core_1 = require("@swc/core");
|
|
5
|
+
// This loader applies the "use workflow"/"use step"
|
|
6
|
+
// client transformation
|
|
7
|
+
function workflowLoader(source, sourceMap) {
|
|
8
|
+
const filename = this.resourcePath;
|
|
9
|
+
const normalizedSource = source.toString();
|
|
10
|
+
// only apply the transform if file needs it
|
|
11
|
+
if (!normalizedSource.match(/(use step|use workflow)/)) {
|
|
12
|
+
return normalizedSource;
|
|
13
|
+
}
|
|
14
|
+
const isTypeScript = filename.endsWith('.ts') || filename.endsWith('.tsx');
|
|
15
|
+
const isTsx = filename.endsWith('.tsx');
|
|
16
|
+
// Transform with SWC
|
|
17
|
+
const result = (0, core_1.transformSync)(normalizedSource, {
|
|
18
|
+
filename,
|
|
19
|
+
jsc: {
|
|
20
|
+
parser: {
|
|
21
|
+
syntax: isTypeScript ? 'typescript' : 'ecmascript',
|
|
22
|
+
tsx: isTsx,
|
|
23
|
+
},
|
|
24
|
+
target: 'es2022',
|
|
25
|
+
experimental: {
|
|
26
|
+
plugins: [
|
|
27
|
+
[require.resolve('@workflow/swc-plugin'), { mode: 'client' }],
|
|
28
|
+
],
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
minify: false,
|
|
32
|
+
inputSourceMap: sourceMap,
|
|
33
|
+
sourceMaps: true,
|
|
34
|
+
inlineSourcesContent: true,
|
|
35
|
+
});
|
|
36
|
+
return result.code;
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=loader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loader.js","sourceRoot":"","sources":["../src/loader.ts"],"names":[],"mappings":";;AAIA,iCAwCC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0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
// re-export runtime as stub for resolving to not
|
|
18
|
+
// require @workflow/core be a dependency as well as
|
|
19
|
+
// @workflow/next
|
|
20
|
+
__exportStar(require("@workflow/cli/dist/lib/runtime"), exports);
|
|
21
|
+
//# sourceMappingURL=runtime.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime.js","sourceRoot":"","sources":["../src/runtime.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,iDAAiD;AACjD,oDAAoD;AACpD,iBAAiB;AACjB,iEAA+C"}
|
package/package.json
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@workflow/next",
|
|
3
|
+
"version": "4.0.1-beta.0",
|
|
4
|
+
"type": "commonjs",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"files": [
|
|
7
|
+
"dist"
|
|
8
|
+
],
|
|
9
|
+
"publishConfig": {
|
|
10
|
+
"access": "public"
|
|
11
|
+
},
|
|
12
|
+
"exports": {
|
|
13
|
+
".": "./dist/index.js",
|
|
14
|
+
"./loader": "./dist/loader.js",
|
|
15
|
+
"./runtime": "./dist/runtime.js"
|
|
16
|
+
},
|
|
17
|
+
"dependencies": {
|
|
18
|
+
"@swc/core": "1.11.24",
|
|
19
|
+
"@workflow/cli": "4.0.1-beta.0",
|
|
20
|
+
"@workflow/core": "4.0.1-beta.0",
|
|
21
|
+
"@workflow/swc-plugin": "4.0.1-beta.0"
|
|
22
|
+
},
|
|
23
|
+
"devDependencies": {
|
|
24
|
+
"@types/node": "24.6.2",
|
|
25
|
+
"next": "15.5.3",
|
|
26
|
+
"@workflow/tsconfig": "4.0.1-beta.0"
|
|
27
|
+
},
|
|
28
|
+
"peerDependencies": {
|
|
29
|
+
"next": ">13"
|
|
30
|
+
},
|
|
31
|
+
"peerDependenciesMeta": {
|
|
32
|
+
"next": {
|
|
33
|
+
"optional": true
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
"scripts": {
|
|
37
|
+
"build": "tsc",
|
|
38
|
+
"dev": "tsc --watch",
|
|
39
|
+
"clean": "tsc --build --clean"
|
|
40
|
+
}
|
|
41
|
+
}
|