@uniformdev/next-app-router 20.7.1-alpha.118
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.txt +2 -0
- package/dist/UniformComposition-Bekn8k24.d.mts +74 -0
- package/dist/UniformComposition-CdXfLiaB.d.ts +74 -0
- package/dist/UniformText-ChMwHBw4.d.mts +10 -0
- package/dist/UniformText-ChMwHBw4.d.ts +10 -0
- package/dist/cache.d.mts +9 -0
- package/dist/cache.d.ts +9 -0
- package/dist/cache.js +1915 -0
- package/dist/cache.mjs +1903 -0
- package/dist/client-BCGVjYM-.d.mts +779 -0
- package/dist/client-BCGVjYM-.d.ts +779 -0
- package/dist/compat.d.mts +36 -0
- package/dist/compat.d.ts +36 -0
- package/dist/compat.js +120 -0
- package/dist/compat.mjs +89 -0
- package/dist/component.d.mts +61 -0
- package/dist/component.d.ts +61 -0
- package/dist/component.js +1397 -0
- package/dist/component.mjs +1384 -0
- package/dist/config.d.mts +13 -0
- package/dist/config.d.ts +13 -0
- package/dist/config.js +80 -0
- package/dist/config.mjs +55 -0
- package/dist/handler.d.mts +29 -0
- package/dist/handler.d.ts +29 -0
- package/dist/handler.js +2664 -0
- package/dist/handler.mjs +2648 -0
- package/dist/index.d.mts +264 -0
- package/dist/index.d.ts +264 -0
- package/dist/index.esm.js +3935 -0
- package/dist/index.js +3953 -0
- package/dist/index.mjs +3935 -0
- package/dist/middleware.d.mts +70 -0
- package/dist/middleware.d.ts +70 -0
- package/dist/middleware.js +5873 -0
- package/dist/middleware.mjs +5867 -0
- package/dist/resolveRouteFromCode-B2rqnHgJ.d.ts +26 -0
- package/dist/resolveRouteFromCode-CA63-EPp.d.mts +26 -0
- package/package.json +112 -0
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { NextConfig } from 'next';
|
|
2
|
+
export { UniformServerConfig } from '@uniformdev/next-app-router-shared';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Wraps the Next.js config to set up the Uniform server config alias.
|
|
6
|
+
* This enables the `uniform.server.config` import to resolve to the project's config file.
|
|
7
|
+
*
|
|
8
|
+
* @param nextConfig - The Next.js configuration object
|
|
9
|
+
* @returns The modified Next.js configuration with Uniform config alias set up
|
|
10
|
+
*/
|
|
11
|
+
declare const withUniformConfig: (nextConfig: NextConfig) => NextConfig;
|
|
12
|
+
|
|
13
|
+
export { withUniformConfig };
|
package/dist/config.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { NextConfig } from 'next';
|
|
2
|
+
export { UniformServerConfig } from '@uniformdev/next-app-router-shared';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Wraps the Next.js config to set up the Uniform server config alias.
|
|
6
|
+
* This enables the `uniform.server.config` import to resolve to the project's config file.
|
|
7
|
+
*
|
|
8
|
+
* @param nextConfig - The Next.js configuration object
|
|
9
|
+
* @returns The modified Next.js configuration with Uniform config alias set up
|
|
10
|
+
*/
|
|
11
|
+
declare const withUniformConfig: (nextConfig: NextConfig) => NextConfig;
|
|
12
|
+
|
|
13
|
+
export { withUniformConfig };
|
package/dist/config.js
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/config.ts
|
|
21
|
+
var config_exports = {};
|
|
22
|
+
__export(config_exports, {
|
|
23
|
+
withUniformConfig: () => withUniformConfig
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(config_exports);
|
|
26
|
+
var import_fs = require("fs");
|
|
27
|
+
var import_path = require("path");
|
|
28
|
+
var getConfigPath = () => {
|
|
29
|
+
const possibleExtensions = [".js", ".cjs", ".mjs", ".ts"];
|
|
30
|
+
let configFilePath;
|
|
31
|
+
let configFileName;
|
|
32
|
+
for (const extension of possibleExtensions) {
|
|
33
|
+
const fileName = `uniform.server.config${extension}`;
|
|
34
|
+
const filePath = (0, import_path.join)(process.cwd(), fileName);
|
|
35
|
+
if ((0, import_fs.existsSync)(filePath)) {
|
|
36
|
+
configFilePath = filePath;
|
|
37
|
+
configFileName = fileName;
|
|
38
|
+
break;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
if (!configFilePath) {
|
|
42
|
+
return void 0;
|
|
43
|
+
}
|
|
44
|
+
return {
|
|
45
|
+
filePath: configFilePath,
|
|
46
|
+
fileName: configFileName
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
var withUniformConfig = (nextConfig) => {
|
|
50
|
+
var _a;
|
|
51
|
+
const { fileName: uniformConfigFileName, filePath: uniformConfigFilePath } = getConfigPath() || {};
|
|
52
|
+
const turbopackResolveAlias = {
|
|
53
|
+
...(_a = nextConfig.turbopack) == null ? void 0 : _a.resolveAlias
|
|
54
|
+
};
|
|
55
|
+
if (uniformConfigFileName) {
|
|
56
|
+
console.log("(Turbopack) Using Uniform config from", uniformConfigFileName);
|
|
57
|
+
turbopackResolveAlias["uniform.server.config"] = `./${uniformConfigFileName}`;
|
|
58
|
+
}
|
|
59
|
+
return {
|
|
60
|
+
...nextConfig,
|
|
61
|
+
turbopack: {
|
|
62
|
+
...nextConfig.turbopack,
|
|
63
|
+
resolveAlias: turbopackResolveAlias
|
|
64
|
+
},
|
|
65
|
+
webpack: (config, context) => {
|
|
66
|
+
if (nextConfig.webpack) {
|
|
67
|
+
nextConfig.webpack(config, context);
|
|
68
|
+
}
|
|
69
|
+
if (context.isServer && uniformConfigFilePath) {
|
|
70
|
+
console.log("(Webpack) Using Uniform config from", uniformConfigFilePath);
|
|
71
|
+
config.resolve.alias["uniform.server.config"] = (0, import_path.resolve)(config.context, uniformConfigFilePath);
|
|
72
|
+
}
|
|
73
|
+
return config;
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
};
|
|
77
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
78
|
+
0 && (module.exports = {
|
|
79
|
+
withUniformConfig
|
|
80
|
+
});
|
package/dist/config.mjs
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
// src/config.ts
|
|
2
|
+
import { existsSync } from "fs";
|
|
3
|
+
import { join, resolve } from "path";
|
|
4
|
+
var getConfigPath = () => {
|
|
5
|
+
const possibleExtensions = [".js", ".cjs", ".mjs", ".ts"];
|
|
6
|
+
let configFilePath;
|
|
7
|
+
let configFileName;
|
|
8
|
+
for (const extension of possibleExtensions) {
|
|
9
|
+
const fileName = `uniform.server.config${extension}`;
|
|
10
|
+
const filePath = join(process.cwd(), fileName);
|
|
11
|
+
if (existsSync(filePath)) {
|
|
12
|
+
configFilePath = filePath;
|
|
13
|
+
configFileName = fileName;
|
|
14
|
+
break;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
if (!configFilePath) {
|
|
18
|
+
return void 0;
|
|
19
|
+
}
|
|
20
|
+
return {
|
|
21
|
+
filePath: configFilePath,
|
|
22
|
+
fileName: configFileName
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
var withUniformConfig = (nextConfig) => {
|
|
26
|
+
var _a;
|
|
27
|
+
const { fileName: uniformConfigFileName, filePath: uniformConfigFilePath } = getConfigPath() || {};
|
|
28
|
+
const turbopackResolveAlias = {
|
|
29
|
+
...(_a = nextConfig.turbopack) == null ? void 0 : _a.resolveAlias
|
|
30
|
+
};
|
|
31
|
+
if (uniformConfigFileName) {
|
|
32
|
+
console.log("(Turbopack) Using Uniform config from", uniformConfigFileName);
|
|
33
|
+
turbopackResolveAlias["uniform.server.config"] = `./${uniformConfigFileName}`;
|
|
34
|
+
}
|
|
35
|
+
return {
|
|
36
|
+
...nextConfig,
|
|
37
|
+
turbopack: {
|
|
38
|
+
...nextConfig.turbopack,
|
|
39
|
+
resolveAlias: turbopackResolveAlias
|
|
40
|
+
},
|
|
41
|
+
webpack: (config, context) => {
|
|
42
|
+
if (nextConfig.webpack) {
|
|
43
|
+
nextConfig.webpack(config, context);
|
|
44
|
+
}
|
|
45
|
+
if (context.isServer && uniformConfigFilePath) {
|
|
46
|
+
console.log("(Webpack) Using Uniform config from", uniformConfigFilePath);
|
|
47
|
+
config.resolve.alias["uniform.server.config"] = resolve(config.context, uniformConfigFilePath);
|
|
48
|
+
}
|
|
49
|
+
return config;
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
export {
|
|
54
|
+
withUniformConfig
|
|
55
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { NextRequest } from 'next/server';
|
|
2
|
+
|
|
3
|
+
type ResolveFullPath = (options: {
|
|
4
|
+
/** The ID of the composition */
|
|
5
|
+
id?: string;
|
|
6
|
+
/** The slug of the composition */
|
|
7
|
+
slug?: string;
|
|
8
|
+
/** The path of the project map node attached to the composition, if there is one */
|
|
9
|
+
path?: string;
|
|
10
|
+
/** The preview locale selected in Visual Canvas, available only if Localization is set up */
|
|
11
|
+
locale?: string;
|
|
12
|
+
}) => string | undefined;
|
|
13
|
+
type ProcessPlaygroundPath = (options: {
|
|
14
|
+
/** The playground path to process */
|
|
15
|
+
playgroundPath: string;
|
|
16
|
+
/** The preview locale selected in Visual Canvas, available only if Localization is set up */
|
|
17
|
+
locale?: string;
|
|
18
|
+
}) => string | undefined;
|
|
19
|
+
type CreatePreviewGETRouteHandlerOptions = {
|
|
20
|
+
resolveFullPath?: ResolveFullPath;
|
|
21
|
+
processPlaygroundPath?: ProcessPlaygroundPath;
|
|
22
|
+
};
|
|
23
|
+
declare const createPreviewGETRouteHandler: (options?: CreatePreviewGETRouteHandlerOptions) => (request: NextRequest) => Promise<Response | undefined>;
|
|
24
|
+
|
|
25
|
+
declare const createPreviewOPTIONSRouteHandler: () => () => Promise<Response>;
|
|
26
|
+
|
|
27
|
+
declare const createPreviewPOSTRouteHandler: () => (request: NextRequest) => Promise<Response>;
|
|
28
|
+
|
|
29
|
+
export { createPreviewGETRouteHandler, createPreviewOPTIONSRouteHandler, createPreviewPOSTRouteHandler };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { NextRequest } from 'next/server';
|
|
2
|
+
|
|
3
|
+
type ResolveFullPath = (options: {
|
|
4
|
+
/** The ID of the composition */
|
|
5
|
+
id?: string;
|
|
6
|
+
/** The slug of the composition */
|
|
7
|
+
slug?: string;
|
|
8
|
+
/** The path of the project map node attached to the composition, if there is one */
|
|
9
|
+
path?: string;
|
|
10
|
+
/** The preview locale selected in Visual Canvas, available only if Localization is set up */
|
|
11
|
+
locale?: string;
|
|
12
|
+
}) => string | undefined;
|
|
13
|
+
type ProcessPlaygroundPath = (options: {
|
|
14
|
+
/** The playground path to process */
|
|
15
|
+
playgroundPath: string;
|
|
16
|
+
/** The preview locale selected in Visual Canvas, available only if Localization is set up */
|
|
17
|
+
locale?: string;
|
|
18
|
+
}) => string | undefined;
|
|
19
|
+
type CreatePreviewGETRouteHandlerOptions = {
|
|
20
|
+
resolveFullPath?: ResolveFullPath;
|
|
21
|
+
processPlaygroundPath?: ProcessPlaygroundPath;
|
|
22
|
+
};
|
|
23
|
+
declare const createPreviewGETRouteHandler: (options?: CreatePreviewGETRouteHandlerOptions) => (request: NextRequest) => Promise<Response | undefined>;
|
|
24
|
+
|
|
25
|
+
declare const createPreviewOPTIONSRouteHandler: () => () => Promise<Response>;
|
|
26
|
+
|
|
27
|
+
declare const createPreviewPOSTRouteHandler: () => (request: NextRequest) => Promise<Response>;
|
|
28
|
+
|
|
29
|
+
export { createPreviewGETRouteHandler, createPreviewOPTIONSRouteHandler, createPreviewPOSTRouteHandler };
|