@akanjs/config 0.0.40 → 0.0.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.
package/src/nextConfig.js DELETED
@@ -1,277 +0,0 @@
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
- });