@akanjs/config 0.0.39 → 0.0.40

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.
@@ -0,0 +1,141 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+ var akanConfig_exports = {};
30
+ __export(akanConfig_exports, {
31
+ getAppConfig: () => getAppConfig,
32
+ getLibConfig: () => getLibConfig,
33
+ getNextConfig: () => getNextConfig,
34
+ makeAppConfig: () => makeAppConfig,
35
+ makeLibConfig: () => makeLibConfig
36
+ });
37
+ module.exports = __toCommonJS(akanConfig_exports);
38
+ var import_fs = __toESM(require("fs"));
39
+ var import_path = __toESM(require("path"));
40
+ var import_baseConfigEnv = require("./baseConfigEnv");
41
+ var import_nextConfig = require("./nextConfig");
42
+ const makeAppConfig = /* @__PURE__ */ __name((config, props = {}) => {
43
+ const baseConfigEnv = (0, import_baseConfigEnv.getBaseConfigEnv)(props.appName);
44
+ const { appName = baseConfigEnv.appName, repoName = baseConfigEnv.repoName, serveDomain = baseConfigEnv.serveDomain, env = baseConfigEnv.env, command = "build" } = props;
45
+ return {
46
+ rootLib: config.rootLib,
47
+ libs: config.libs ?? [],
48
+ backend: {
49
+ dockerfile: config.backend?.dockerfile ?? `FROM node:22-slim
50
+ RUN ln -sf /usr/share/zoneinfo/Asia/Seoul /etc/localtime
51
+ RUN apt-get update && apt-get upgrade -y
52
+ RUN apt-get install -y ca-certificates fonts-liberation libappindicator3-1 libasound2 libatk-bridge2.0-0 libatk1.0-0 libc6 libcairo2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgbm1 libgcc1 libglib2.0-0 libgtk-3-0 libnspr4 libnss3 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 lsb-release wget xdg-utils udev
53
+ ARG TARGETARCH
54
+ RUN if [ "$TARGETARCH" = "amd64" ]; then wget https://fastdl.mongodb.org/tools/db/mongodb-database-tools-debian92-x86_64-100.3.1.deb && apt-get install -y ./mongodb-database-tools-*.deb && rm -f mongodb-database-tools-*.deb; fi
55
+ RUN apt-get install -y git redis build-essential python3
56
+ RUN rm -rf /var/lib/apt/lists/*
57
+ RUN mkdir -p /workspace
58
+ WORKDIR /workspace
59
+ COPY ./package.json ./package.json
60
+ RUN npx pnpm i --prod
61
+ COPY . .
62
+ ENV PORT 8080
63
+ ENV NODE_OPTIONS=--max_old_space_size=8192
64
+ ENV NEXT_PUBLIC_REPO_NAME=${repoName}
65
+ ENV NEXT_PUBLIC_SERVE_DOMAIN=${serveDomain}
66
+ ENV NEXT_PUBLIC_APP_NAME=${appName}
67
+ ENV NEXT_PUBLIC_ENV=${env}
68
+ ENV NEXT_PUBLIC_OPERATION_MODE=cloud
69
+ CMD ["node", "main.js"]`,
70
+ explicitDependencies: config.backend?.explicitDependencies ?? []
71
+ },
72
+ frontend: {
73
+ dockerfile: config.frontend?.dockerfile ?? `FROM node:22-alpine
74
+ RUN ln -sf /usr/share/zoneinfo/Asia/Seoul /etc/localtime
75
+ RUN apk --no-cache add git
76
+ RUN mkdir -p /workspace
77
+ WORKDIR /workspace
78
+ COPY ./package.json ./package.json
79
+ RUN npx pnpm i --prod
80
+ COPY . .
81
+ ENV PORT 4200
82
+ ENV NODE_OPTIONS=--max_old_space_size=8192
83
+ ENV NEXT_PUBLIC_REPO_NAME=${repoName}
84
+ ENV NEXT_PUBLIC_SERVE_DOMAIN=${serveDomain}
85
+ ENV NEXT_PUBLIC_APP_NAME=${appName}
86
+ ENV NEXT_PUBLIC_ENV=${env}
87
+ ENV NEXT_PUBLIC_OPERATION_MODE=cloud
88
+ CMD ["npm", "start"]`,
89
+ nextConfig: (0, import_nextConfig.withBase)(appName, config.frontend?.nextConfig ? typeof config.frontend.nextConfig === "function" ? config.frontend.nextConfig() : config.frontend.nextConfig : {}, config.libs ?? [], config.frontend?.routes),
90
+ explicitDependencies: config.frontend?.explicitDependencies ?? []
91
+ }
92
+ };
93
+ }, "makeAppConfig");
94
+ const getAppConfig = /* @__PURE__ */ __name(async (appRoot, props) => {
95
+ const akanConfigPath = import_path.default.join(appRoot, "akan.config.ts");
96
+ if (!import_fs.default.existsSync(akanConfigPath)) throw new Error(`application akan.config.ts is not found ${appRoot}`);
97
+ const configImp = (await import(`${appRoot}/akan.config.ts`)).default;
98
+ const config = typeof configImp === "function" ? configImp(props) : configImp;
99
+ return makeAppConfig(config, props);
100
+ }, "getAppConfig");
101
+ const makeLibConfig = /* @__PURE__ */ __name((config, props = {}) => {
102
+ return {
103
+ rootLib: config.rootLib,
104
+ libs: config.libs ?? [],
105
+ backend: {
106
+ explicitDependencies: config.backend?.explicitDependencies ?? []
107
+ },
108
+ frontend: {
109
+ explicitDependencies: config.frontend?.explicitDependencies ?? []
110
+ }
111
+ };
112
+ }, "makeLibConfig");
113
+ const getLibConfig = /* @__PURE__ */ __name(async (libRoot, props) => {
114
+ const akanConfigPath = import_path.default.join(libRoot, "akan.config.ts");
115
+ if (!import_fs.default.existsSync(akanConfigPath)) throw new Error(`library akan.config.ts is not found ${libRoot}`);
116
+ const configImp = (await import(`${libRoot}/akan.config.ts`)).default;
117
+ const config = typeof configImp === "function" ? configImp(props) : configImp;
118
+ return makeLibConfig(config, props);
119
+ }, "getLibConfig");
120
+ const getNextConfig = /* @__PURE__ */ __name((configImp, appData) => {
121
+ const appInfo = appData;
122
+ const baseConfigEnv = (0, import_baseConfigEnv.getBaseConfigEnv)(appInfo.name);
123
+ const props = {
124
+ appName: baseConfigEnv.appName,
125
+ repoName: baseConfigEnv.repoName,
126
+ serveDomain: baseConfigEnv.serveDomain,
127
+ env: baseConfigEnv.env,
128
+ command: "build"
129
+ };
130
+ const config = typeof configImp === "function" ? configImp(props) : configImp;
131
+ const akanConfig = makeAppConfig(config, props);
132
+ return akanConfig.frontend.nextConfig;
133
+ }, "getNextConfig");
134
+ // Annotate the CommonJS export names for ESM import in node:
135
+ 0 && (module.exports = {
136
+ getAppConfig,
137
+ getLibConfig,
138
+ getNextConfig,
139
+ makeAppConfig,
140
+ makeLibConfig
141
+ });
@@ -0,0 +1,9 @@
1
+ interface BaseConfigEnv {
2
+ appName: string;
3
+ repoName: string;
4
+ serveDomain: string;
5
+ env: "testing" | "debug" | "develop" | "main";
6
+ }
7
+ declare const getBaseConfigEnv: (appName?: string | undefined) => BaseConfigEnv;
8
+
9
+ export { getBaseConfigEnv };
@@ -0,0 +1,42 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
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
+ var baseConfigEnv_exports = {};
20
+ __export(baseConfigEnv_exports, {
21
+ getBaseConfigEnv: () => getBaseConfigEnv
22
+ });
23
+ module.exports = __toCommonJS(baseConfigEnv_exports);
24
+ const getBaseConfigEnv = /* @__PURE__ */ __name((appName = process.env.NEXT_PUBLIC_APP_NAME) => {
25
+ if (!appName) throw new Error("NEXT_PUBLIC_APP_NAME is not set");
26
+ const repoName = process.env.NEXT_PUBLIC_REPO_NAME;
27
+ if (!repoName) throw new Error("NEXT_PUBLIC_REPO_NAME is not set");
28
+ const serveDomain = process.env.NEXT_PUBLIC_SERVE_DOMAIN;
29
+ if (!serveDomain) throw new Error("NEXT_PUBLIC_SERVE_DOMAIN is not set");
30
+ const env = process.env.NEXT_PUBLIC_ENV ?? "debug";
31
+ if (!env) throw new Error("NEXT_PUBLIC_ENV is not set");
32
+ return {
33
+ appName,
34
+ repoName,
35
+ serveDomain,
36
+ env
37
+ };
38
+ }, "getBaseConfigEnv");
39
+ // Annotate the CommonJS export names for ESM import in node:
40
+ 0 && (module.exports = {
41
+ getBaseConfigEnv
42
+ });
@@ -0,0 +1,5 @@
1
+ import { CapacitorConfig } from '@capacitor/cli';
2
+
3
+ declare const withBase: (applyConfig: (config: CapacitorConfig) => CapacitorConfig) => CapacitorConfig;
4
+
5
+ export { withBase };
@@ -0,0 +1,74 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+ var capacitor_base_config_exports = {};
30
+ __export(capacitor_base_config_exports, {
31
+ withBase: () => withBase
32
+ });
33
+ module.exports = __toCommonJS(capacitor_base_config_exports);
34
+ var import_os = __toESM(require("os"));
35
+ const getLocalIP = /* @__PURE__ */ __name(() => {
36
+ const interfaces = import_os.default.networkInterfaces();
37
+ for (const interfaceName in interfaces) {
38
+ const iface = interfaces[interfaceName];
39
+ if (!iface) continue;
40
+ for (const alias of iface) {
41
+ if (alias.family === "IPv4" && !alias.internal) return alias.address;
42
+ }
43
+ }
44
+ return "127.0.0.1";
45
+ }, "getLocalIP");
46
+ const withBase = /* @__PURE__ */ __name((applyConfig) => {
47
+ const projectName = process.env.NEXT_PUBLIC_APP_NAME;
48
+ if (!projectName) throw new Error("projectName is not defined, please run with nx command");
49
+ const ip = getLocalIP();
50
+ const baseConfig = {
51
+ appId: `com.${projectName}`,
52
+ appName: projectName,
53
+ webDir: `../../dist/apps/${projectName}/csr/`,
54
+ // bundledWebRuntime: false, !not used
55
+ server: process.env.APP_OPERATION_MODE !== "release" ? {
56
+ androidScheme: "http",
57
+ url: `http://${ip}:4201`,
58
+ cleartext: true,
59
+ allowNavigation: [
60
+ `http://${ip}:8080/*`
61
+ ]
62
+ } : void 0,
63
+ plugins: {
64
+ CapacitorCookies: {
65
+ enabled: true
66
+ }
67
+ }
68
+ };
69
+ return applyConfig(baseConfig);
70
+ }, "withBase");
71
+ // Annotate the CommonJS export names for ESM import in node:
72
+ 0 && (module.exports = {
73
+ withBase
74
+ });
@@ -0,0 +1,20 @@
1
+ import { NextConfig } from 'next';
2
+
3
+ type NextConfigFn = (phase: string, context?: any) => Promise<NextConfig> | NextConfig;
4
+ type NextPlugin = (config: NextConfig) => NextConfig;
5
+ type NextPluginThatReturnsConfigFn = (config: NextConfig) => NextConfigFn;
6
+ declare const composePlugins: (...plugins: (NextPlugin | NextPluginThatReturnsConfigFn)[]) => ((baseConfig: NextConfig) => NextConfigFn);
7
+ /**
8
+ * @type { (config: import('@nx/next/plugins/with-nx').WithNxOptions) = import('@nx/next/plugins/with-nx').WithNxOptions }
9
+ **/
10
+ declare const withBase: (appName: string, config: NextConfig, libs: string[], routes?: {
11
+ basePath?: string;
12
+ domains: {
13
+ main?: string[];
14
+ develop?: string[];
15
+ debug?: string[];
16
+ };
17
+ }[]) => NextConfigFn;
18
+ declare const defaultNextConfigFile = "import \"tsconfig-paths/register\";\n\nimport { getNextConfig } from \"@akanjs/config\";\n\nimport appInfo from \"./akan.app.json\";\nimport config from \"./akan.config\";\n\nexport default getNextConfig(config, appInfo);\n";
19
+
20
+ export { type NextConfigFn, type NextPlugin, type NextPluginThatReturnsConfigFn, composePlugins, defaultNextConfigFile, withBase };
@@ -0,0 +1,277 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+ var nextConfig_exports = {};
30
+ __export(nextConfig_exports, {
31
+ composePlugins: () => composePlugins,
32
+ defaultNextConfigFile: () => defaultNextConfigFile,
33
+ withBase: () => withBase
34
+ });
35
+ module.exports = __toCommonJS(nextConfig_exports);
36
+ var import_bundle_analyzer = __toESM(require("@next/bundle-analyzer"));
37
+ var import_next_pwa = __toESM(require("next-pwa"));
38
+ var import_cache = __toESM(require("next-pwa/cache"));
39
+ var import_path = __toESM(require("path"));
40
+ const composePlugins = /* @__PURE__ */ __name((...plugins) => {
41
+ return function(baseConfig) {
42
+ return /* @__PURE__ */ __name(async function combined(phase, context) {
43
+ let config = baseConfig;
44
+ for (const plugin of plugins) {
45
+ const fn = plugin;
46
+ const configOrFn = fn(config);
47
+ if (typeof configOrFn === "function") config = await configOrFn(phase, context);
48
+ else config = configOrFn;
49
+ }
50
+ return config;
51
+ }, "combined");
52
+ };
53
+ }, "composePlugins");
54
+ const commandType = process.env.AKAN_COMMAND_TYPE?.includes("serve") ? "serve" : process.env.AKAN_COMMAND_TYPE?.includes("build") ? "build" : "deploy";
55
+ const withPWA = (0, import_next_pwa.default)({
56
+ dest: "public",
57
+ register: true,
58
+ skipWaiting: true,
59
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
60
+ runtimeCaching: import_cache.default,
61
+ disable: commandType === "serve"
62
+ });
63
+ const devDomain = process.env.NEXT_PUBLIC_SERVE_DOMAIN ?? "akanjs.com";
64
+ const withBase = /* @__PURE__ */ __name((appName, config, libs, routes = []) => {
65
+ return composePlugins((0, import_bundle_analyzer.default)({
66
+ enabled: process.env.ANALYZE === "true"
67
+ }), ...commandType !== "serve" || process.env.USE_PWA === "true" ? [
68
+ withPWA
69
+ ] : [])({
70
+ ...config,
71
+ eslint: {
72
+ ...config.eslint,
73
+ ignoreDuringBuilds: true
74
+ },
75
+ env: {
76
+ ...config.env,
77
+ basePaths: routes.map(({ basePath }) => basePath).join(",")
78
+ },
79
+ transpilePackages: [
80
+ "swiper",
81
+ "ssr-window",
82
+ "dom7",
83
+ ...libs.map((lib) => `@${lib}`),
84
+ "@akanjs/base",
85
+ "@akanjs/common",
86
+ "@akanjs/next",
87
+ "@akanjs/ui",
88
+ "@akanjs/client",
89
+ "@akanjs/server",
90
+ "@akanjs/service",
91
+ "@akanjs/signal",
92
+ "@akanjs/store",
93
+ "@akanjs/dictionary",
94
+ "@akanjs/constant",
95
+ "@akanjs/config",
96
+ "@akanjs/document"
97
+ ],
98
+ reactStrictMode: commandType === "serve" ? false : true,
99
+ experimental: {
100
+ ...config.experimental ?? {},
101
+ optimizePackageImports: [
102
+ ...[
103
+ appName,
104
+ ...libs
105
+ ].map((lib) => [
106
+ `@${lib}/ui`,
107
+ `@${lib}/next`,
108
+ `@${lib}/common`,
109
+ `@${lib}/client`
110
+ ]).flat(),
111
+ "@contract",
112
+ "@akanjs/next",
113
+ "@akanjs/common"
114
+ ]
115
+ },
116
+ // modularizeImports: {
117
+ // "react-icons/?(((\\w*)?/?)*)": {
118
+ // transform: "@react-icons/all-files/{{ matches.[1] }}/{{member}}",
119
+ // skipDefaultConversion: true,
120
+ // },
121
+ // lodash: { transform: "lodash/{{member}}", preventFullImport: true },
122
+ // ...Object.fromEntries(
123
+ // [appName, ...libs].reduce(
124
+ // (acc, lib) => [
125
+ // ...acc,
126
+ // [`@${lib}/ui`, { transform: `@${lib}/ui/{{member}}`, skipDefaultConversion: true }],
127
+ // [`@${lib}/next`, { transform: `@${lib}/next/{{member}}`, skipDefaultConversion: true }],
128
+ // [`@${lib}/common`, { transform: `@${lib}/common/{{member}}`, skipDefaultConversion: true }],
129
+ // [`@${lib}/client`, { transform: `@${lib}/lib/{{ camelCase member }}`, skipDefaultConversion: true }],
130
+ // ],
131
+ // [
132
+ // ["@contract", { transform: `@contract/src/{{member}}`, skipDefaultConversion: true }],
133
+ // [`@akanjs/next`, { transform: `@akanjs/next/src/{{member}}`, skipDefaultConversion: true }],
134
+ // [`@akanjs/common`, { transform: `@akanjs/common/src/{{member}}`, skipDefaultConversion: true }],
135
+ // ]
136
+ // )
137
+ // ),
138
+ // ...(config.modularizeImports ?? {}),
139
+ // },
140
+ images: {
141
+ formats: [
142
+ "image/avif",
143
+ "image/webp"
144
+ ],
145
+ ...config.images ?? {},
146
+ remotePatterns: [
147
+ ...config.images?.remotePatterns ?? [],
148
+ ...routes.map(({ domains }) => [
149
+ ...domains.main?.map((domain) => ({
150
+ protocol: "https",
151
+ hostname: `**.${domain}`
152
+ })) ?? [],
153
+ ...domains.develop?.map((domain) => ({
154
+ protocol: "https",
155
+ hostname: `**.${domain}`
156
+ })) ?? [],
157
+ ...domains.debug?.map((domain) => ({
158
+ protocol: "https",
159
+ hostname: `**.${domain}`
160
+ })) ?? []
161
+ ]).flat(),
162
+ {
163
+ protocol: "https",
164
+ hostname: `**.${devDomain}`
165
+ }
166
+ ]
167
+ },
168
+ webpack: /* @__PURE__ */ __name((config2) => {
169
+ config2.resolve.alias.canvas = false;
170
+ config2.resolve.alias.encoding = false;
171
+ if (process.env.USE_AKANJS_PKGS === "true") config2.resolve.alias["@akanjs/config"] = import_path.default.resolve(__dirname, "../../../../pkgs/@akanjs/config");
172
+ return config2;
173
+ }, "webpack"),
174
+ redirects() {
175
+ return routes.map(({ basePath, domains }) => [
176
+ {
177
+ basePath,
178
+ domain: `${basePath}-debug.${devDomain}`
179
+ },
180
+ {
181
+ basePath,
182
+ domain: `${basePath}-develop.${devDomain}`
183
+ },
184
+ {
185
+ basePath,
186
+ domain: `${basePath}-main.${devDomain}`
187
+ },
188
+ ...domains.main?.map((domain) => ({
189
+ basePath,
190
+ domain
191
+ })) ?? [],
192
+ ...domains.develop?.map((domain) => ({
193
+ basePath,
194
+ domain
195
+ })) ?? [],
196
+ ...domains.debug?.map((domain) => ({
197
+ basePath,
198
+ domain
199
+ })) ?? []
200
+ ]).flat().map(({ basePath, domain }) => ({
201
+ source: `/:locale/${basePath}/:path*`,
202
+ has: [
203
+ {
204
+ type: "host",
205
+ value: domain
206
+ }
207
+ ],
208
+ permanent: true,
209
+ destination: "/:locale/:path*"
210
+ }));
211
+ },
212
+ rewrites() {
213
+ return routes.map(({ basePath, domains }) => [
214
+ {
215
+ basePath,
216
+ domain: `${basePath}-debug.${devDomain}`
217
+ },
218
+ {
219
+ basePath,
220
+ domain: `${basePath}-develop.${devDomain}`
221
+ },
222
+ {
223
+ basePath,
224
+ domain: `${basePath}-main.${devDomain}`
225
+ },
226
+ ...domains.main?.map((domain) => ({
227
+ basePath,
228
+ domain
229
+ })) ?? [],
230
+ ...domains.develop?.map((domain) => ({
231
+ basePath,
232
+ domain
233
+ })) ?? [],
234
+ ...domains.debug?.map((domain) => ({
235
+ basePath,
236
+ domain
237
+ })) ?? []
238
+ ]).flat().map(({ basePath, domain }) => [
239
+ {
240
+ source: "/:locale",
241
+ has: [
242
+ {
243
+ type: "host",
244
+ value: domain
245
+ }
246
+ ],
247
+ destination: `/:locale/${basePath}`
248
+ },
249
+ {
250
+ source: `/:locale/:path((?!${basePath}$)(?!admin(?:/|$)).*)`,
251
+ has: [
252
+ {
253
+ type: "host",
254
+ value: domain
255
+ }
256
+ ],
257
+ destination: `/:locale/${basePath}/:path*`
258
+ }
259
+ ]).flat();
260
+ }
261
+ });
262
+ }, "withBase");
263
+ const defaultNextConfigFile = `import "tsconfig-paths/register";
264
+
265
+ import { getNextConfig } from "@akanjs/config";
266
+
267
+ import appInfo from "./akan.app.json";
268
+ import config from "./akan.config";
269
+
270
+ export default getNextConfig(config, appInfo);
271
+ `;
272
+ // Annotate the CommonJS export names for ESM import in node:
273
+ 0 && (module.exports = {
274
+ composePlugins,
275
+ defaultNextConfigFile,
276
+ withBase
277
+ });
@@ -0,0 +1,23 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
+ const path = require("path");
4
+ const withBase = /* @__PURE__ */ __name((config = {}) => ({
5
+ ...config,
6
+ plugins: {
7
+ ...process.env.USE_AKANJS_PKGS === "true" ? {
8
+ "postcss-import": {
9
+ resolve(id) {
10
+ if (id.startsWith("@akanjs/config/src")) return path.resolve(__dirname, id.replace("@akanjs/config/src/", ""));
11
+ else return id;
12
+ }
13
+ }
14
+ } : {},
15
+ "@tailwindcss/postcss": process.env.AKAN_WORKSPACE_ROOT ? {
16
+ base: path.join(process.env.AKAN_WORKSPACE_ROOT, "./")
17
+ } : {},
18
+ ...config.plugins ?? {}
19
+ }
20
+ }), "withBase");
21
+ module.exports = {
22
+ withBase
23
+ };