@gigadrive/network-config 3.1.2 → 3.3.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.
@@ -0,0 +1,3 @@
1
+ 'use strict';
2
+
3
+ module.exports = require('./nextjs-adapter.js').default;
@@ -0,0 +1,37 @@
1
+ interface NextConfig {
2
+ output?: string;
3
+ [key: string]: unknown;
4
+ }
5
+ interface ModifyConfigContext {
6
+ phase: string;
7
+ nextVersion: string;
8
+ }
9
+ interface BuildCompleteContext {
10
+ projectDir: string;
11
+ repoRoot: string;
12
+ distDir: string;
13
+ config: NextConfig;
14
+ nextVersion: string;
15
+ buildId: string;
16
+ }
17
+ interface GigadriveNextBuildManifest {
18
+ version: 1;
19
+ output: 'standalone' | 'export';
20
+ distDir: string;
21
+ repoRootToProject: string;
22
+ nextVersion: string;
23
+ buildId: string;
24
+ }
25
+ /**
26
+ * Next.js build adapter used automatically by Gigadrive Network build workers.
27
+ *
28
+ * It requests standalone output without changing user-owned Next.js config and
29
+ * records the resolved build paths for post-build Network framework detection.
30
+ */
31
+ declare const gigadriveNextAdapter: {
32
+ name: string;
33
+ modifyConfig(config: NextConfig, { phase }: ModifyConfigContext): NextConfig;
34
+ onBuildComplete({ projectDir, repoRoot, distDir, config, nextVersion, buildId, }: BuildCompleteContext): Promise<void>;
35
+ };
36
+
37
+ export { type GigadriveNextBuildManifest, gigadriveNextAdapter as default };
@@ -0,0 +1,39 @@
1
+ interface NextConfig {
2
+ output?: string;
3
+ [key: string]: unknown;
4
+ }
5
+ interface ModifyConfigContext {
6
+ phase: string;
7
+ nextVersion: string;
8
+ }
9
+ interface BuildCompleteContext {
10
+ projectDir: string;
11
+ repoRoot: string;
12
+ distDir: string;
13
+ config: NextConfig;
14
+ nextVersion: string;
15
+ buildId: string;
16
+ }
17
+ interface GigadriveNextBuildManifest {
18
+ version: 1;
19
+ output: 'standalone' | 'export';
20
+ distDir: string;
21
+ repoRootToProject: string;
22
+ nextVersion: string;
23
+ buildId: string;
24
+ }
25
+ /**
26
+ * Next.js build adapter used automatically by Gigadrive Network build workers.
27
+ *
28
+ * It requests standalone output without changing user-owned Next.js config and
29
+ * records the resolved build paths for post-build Network framework detection.
30
+ */
31
+ declare const gigadriveNextAdapter: {
32
+ name: string;
33
+ modifyConfig(config: NextConfig, { phase }: ModifyConfigContext): NextConfig;
34
+ onBuildComplete({ projectDir, repoRoot, distDir, config, nextVersion, buildId, }: BuildCompleteContext): Promise<void>;
35
+ };
36
+
37
+ // @ts-ignore
38
+ export = gigadriveNextAdapter;
39
+ export type { GigadriveNextBuildManifest };
@@ -0,0 +1,80 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
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
+
30
+ // src/nextjs-adapter.ts
31
+ var nextjs_adapter_exports = {};
32
+ __export(nextjs_adapter_exports, {
33
+ default: () => nextjs_adapter_default
34
+ });
35
+ module.exports = __toCommonJS(nextjs_adapter_exports);
36
+ var import_promises = require("fs/promises");
37
+ var import_node_path = __toESM(require("path"));
38
+ var PRODUCTION_BUILD_PHASE = "phase-production-build";
39
+ var toPortableRelativePath = (from, to) => {
40
+ const relativePath = import_node_path.default.relative(from, to).replaceAll(import_node_path.default.sep, "/");
41
+ return relativePath === "" ? "." : relativePath;
42
+ };
43
+ var gigadriveNextAdapter = {
44
+ name: "Gigadrive Network",
45
+ modifyConfig(config, { phase }) {
46
+ if (phase !== PRODUCTION_BUILD_PHASE) {
47
+ return config;
48
+ }
49
+ const deploymentId = config.deploymentId ?? process.env.GIGADRIVE_DEPLOYMENT_ID;
50
+ return {
51
+ ...config,
52
+ ...deploymentId ? { deploymentId } : {},
53
+ output: config.output === "export" ? "export" : "standalone"
54
+ };
55
+ },
56
+ async onBuildComplete({
57
+ projectDir,
58
+ repoRoot,
59
+ distDir,
60
+ config,
61
+ nextVersion,
62
+ buildId
63
+ }) {
64
+ const output = config.output === "export" ? "export" : "standalone";
65
+ const metadataDirectory = import_node_path.default.join(projectDir, ".gigadrive");
66
+ const manifest = {
67
+ version: 1,
68
+ output,
69
+ distDir: toPortableRelativePath(projectDir, distDir),
70
+ repoRootToProject: toPortableRelativePath(repoRoot, projectDir),
71
+ nextVersion,
72
+ buildId
73
+ };
74
+ await (0, import_promises.mkdir)(metadataDirectory, { recursive: true });
75
+ await (0, import_promises.writeFile)(import_node_path.default.join(metadataDirectory, "nextjs.json"), `${JSON.stringify(manifest, null, 2)}
76
+ `, "utf8");
77
+ }
78
+ };
79
+ var nextjs_adapter_default = gigadriveNextAdapter;
80
+ //# sourceMappingURL=nextjs-adapter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/nextjs-adapter.ts"],"sourcesContent":["import { mkdir, writeFile } from 'node:fs/promises';\nimport path from 'node:path';\n\ninterface NextConfig {\n output?: string;\n [key: string]: unknown;\n}\n\ninterface ModifyConfigContext {\n phase: string;\n nextVersion: string;\n}\n\ninterface BuildCompleteContext {\n projectDir: string;\n repoRoot: string;\n distDir: string;\n config: NextConfig;\n nextVersion: string;\n buildId: string;\n}\n\nexport interface GigadriveNextBuildManifest {\n version: 1;\n output: 'standalone' | 'export';\n distDir: string;\n repoRootToProject: string;\n nextVersion: string;\n buildId: string;\n}\n\nconst PRODUCTION_BUILD_PHASE = 'phase-production-build';\n\nconst toPortableRelativePath = (from: string, to: string): string => {\n const relativePath = path.relative(from, to).replaceAll(path.sep, '/');\n return relativePath === '' ? '.' : relativePath;\n};\n\n/**\n * Next.js build adapter used automatically by Gigadrive Network build workers.\n *\n * It requests standalone output without changing user-owned Next.js config and\n * records the resolved build paths for post-build Network framework detection.\n */\nconst gigadriveNextAdapter = {\n name: 'Gigadrive Network',\n\n modifyConfig(config: NextConfig, { phase }: ModifyConfigContext): NextConfig {\n if (phase !== PRODUCTION_BUILD_PHASE) {\n return config;\n }\n\n const deploymentId = config.deploymentId ?? process.env.GIGADRIVE_DEPLOYMENT_ID;\n\n return {\n ...config,\n ...(deploymentId ? { deploymentId } : {}),\n output: config.output === 'export' ? 'export' : 'standalone',\n };\n },\n\n async onBuildComplete({\n projectDir,\n repoRoot,\n distDir,\n config,\n nextVersion,\n buildId,\n }: BuildCompleteContext): Promise<void> {\n const output = config.output === 'export' ? 'export' : 'standalone';\n const metadataDirectory = path.join(projectDir, '.gigadrive');\n const manifest: GigadriveNextBuildManifest = {\n version: 1,\n output,\n distDir: toPortableRelativePath(projectDir, distDir),\n repoRootToProject: toPortableRelativePath(repoRoot, projectDir),\n nextVersion,\n buildId,\n };\n\n await mkdir(metadataDirectory, { recursive: true });\n await writeFile(path.join(metadataDirectory, 'nextjs.json'), `${JSON.stringify(manifest, null, 2)}\\n`, 'utf8');\n },\n};\n\nexport default gigadriveNextAdapter;\n"],"mappings":";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adapter.ts
2
+ import { mkdir, writeFile } from "fs/promises";
3
+ import path from "path";
4
+ var PRODUCTION_BUILD_PHASE = "phase-production-build";
5
+ var toPortableRelativePath = (from, to) => {
6
+ const relativePath = path.relative(from, to).replaceAll(path.sep, "/");
7
+ return relativePath === "" ? "." : relativePath;
8
+ };
9
+ var gigadriveNextAdapter = {
10
+ name: "Gigadrive Network",
11
+ modifyConfig(config, { phase }) {
12
+ if (phase !== PRODUCTION_BUILD_PHASE) {
13
+ return config;
14
+ }
15
+ const deploymentId = config.deploymentId ?? process.env.GIGADRIVE_DEPLOYMENT_ID;
16
+ return {
17
+ ...config,
18
+ ...deploymentId ? { deploymentId } : {},
19
+ output: config.output === "export" ? "export" : "standalone"
20
+ };
21
+ },
22
+ async onBuildComplete({
23
+ projectDir,
24
+ repoRoot,
25
+ distDir,
26
+ config,
27
+ nextVersion,
28
+ buildId
29
+ }) {
30
+ const output = config.output === "export" ? "export" : "standalone";
31
+ const metadataDirectory = path.join(projectDir, ".gigadrive");
32
+ const manifest = {
33
+ version: 1,
34
+ output,
35
+ distDir: toPortableRelativePath(projectDir, distDir),
36
+ repoRootToProject: toPortableRelativePath(repoRoot, projectDir),
37
+ nextVersion,
38
+ buildId
39
+ };
40
+ await mkdir(metadataDirectory, { recursive: true });
41
+ await writeFile(path.join(metadataDirectory, "nextjs.json"), `${JSON.stringify(manifest, null, 2)}
42
+ `, "utf8");
43
+ }
44
+ };
45
+ var nextjs_adapter_default = gigadriveNextAdapter;
46
+ export {
47
+ nextjs_adapter_default as default
48
+ };
49
+ //# sourceMappingURL=nextjs-adapter.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/nextjs-adapter.ts"],"sourcesContent":["import { mkdir, writeFile } from 'node:fs/promises';\nimport path from 'node:path';\n\ninterface NextConfig {\n output?: string;\n [key: string]: unknown;\n}\n\ninterface ModifyConfigContext {\n phase: string;\n nextVersion: string;\n}\n\ninterface BuildCompleteContext {\n projectDir: string;\n repoRoot: string;\n distDir: string;\n config: NextConfig;\n nextVersion: string;\n buildId: string;\n}\n\nexport interface GigadriveNextBuildManifest {\n version: 1;\n output: 'standalone' | 'export';\n distDir: string;\n repoRootToProject: string;\n nextVersion: string;\n buildId: string;\n}\n\nconst PRODUCTION_BUILD_PHASE = 'phase-production-build';\n\nconst toPortableRelativePath = (from: string, to: string): string => {\n const relativePath = path.relative(from, to).replaceAll(path.sep, '/');\n return relativePath === '' ? '.' : relativePath;\n};\n\n/**\n * Next.js build adapter used automatically by Gigadrive Network build workers.\n *\n * It requests standalone output without changing user-owned Next.js config and\n * records the resolved build paths for post-build Network framework detection.\n */\nconst gigadriveNextAdapter = {\n name: 'Gigadrive Network',\n\n modifyConfig(config: NextConfig, { phase }: ModifyConfigContext): NextConfig {\n if (phase !== PRODUCTION_BUILD_PHASE) {\n return config;\n }\n\n const deploymentId = config.deploymentId ?? process.env.GIGADRIVE_DEPLOYMENT_ID;\n\n return {\n ...config,\n ...(deploymentId ? { deploymentId } : {}),\n output: config.output === 'export' ? 'export' : 'standalone',\n };\n },\n\n async onBuildComplete({\n projectDir,\n repoRoot,\n distDir,\n config,\n nextVersion,\n buildId,\n }: BuildCompleteContext): Promise<void> {\n const output = config.output === 'export' ? 'export' : 'standalone';\n const metadataDirectory = path.join(projectDir, '.gigadrive');\n const manifest: GigadriveNextBuildManifest = {\n version: 1,\n output,\n distDir: toPortableRelativePath(projectDir, distDir),\n repoRootToProject: toPortableRelativePath(repoRoot, projectDir),\n nextVersion,\n buildId,\n };\n\n await mkdir(metadataDirectory, { recursive: true });\n await writeFile(path.join(metadataDirectory, 'nextjs.json'), `${JSON.stringify(manifest, null, 2)}\\n`, 'utf8');\n },\n};\n\nexport default gigadriveNextAdapter;\n"],"mappings":";AAAA,SAAS,OAAO,iBAAiB;AACjC,OAAO,UAAU;AA8BjB,IAAM,yBAAyB;AAE/B,IAAM,yBAAyB,CAAC,MAAc,OAAuB;AACnE,QAAM,eAAe,KAAK,SAAS,MAAM,EAAE,EAAE,WAAW,KAAK,KAAK,GAAG;AACrE,SAAO,iBAAiB,KAAK,MAAM;AACrC;AAQA,IAAM,uBAAuB;AAAA,EAC3B,MAAM;AAAA,EAEN,aAAa,QAAoB,EAAE,MAAM,GAAoC;AAC3E,QAAI,UAAU,wBAAwB;AACpC,aAAO;AAAA,IACT;AAEA,UAAM,eAAe,OAAO,gBAAgB,QAAQ,IAAI;AAExD,WAAO;AAAA,MACL,GAAG;AAAA,MACH,GAAI,eAAe,EAAE,aAAa,IAAI,CAAC;AAAA,MACvC,QAAQ,OAAO,WAAW,WAAW,WAAW;AAAA,IAClD;AAAA,EACF;AAAA,EAEA,MAAM,gBAAgB;AAAA,IACpB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,GAAwC;AACtC,UAAM,SAAS,OAAO,WAAW,WAAW,WAAW;AACvD,UAAM,oBAAoB,KAAK,KAAK,YAAY,YAAY;AAC5D,UAAM,WAAuC;AAAA,MAC3C,SAAS;AAAA,MACT;AAAA,MACA,SAAS,uBAAuB,YAAY,OAAO;AAAA,MACnD,mBAAmB,uBAAuB,UAAU,UAAU;AAAA,MAC9D;AAAA,MACA;AAAA,IACF;AAEA,UAAM,MAAM,mBAAmB,EAAE,WAAW,KAAK,CAAC;AAClD,UAAM,UAAU,KAAK,KAAK,mBAAmB,aAAa,GAAG,GAAG,KAAK,UAAU,UAAU,MAAM,CAAC,CAAC;AAAA,GAAM,MAAM;AAAA,EAC/G;AACF;AAEA,IAAO,yBAAQ;","names":[]}
@@ -54,8 +54,8 @@
54
54
  },
55
55
  "max_duration": {
56
56
  "type": "number",
57
- "description": "The max duration in seconds for the function after which it will be terminated. Defaults to 30.",
58
- "maximum": 900,
57
+ "description": "The maximum lifetime in seconds of one HTTP request, response stream, or WebSocket connection. Defaults to 30. The reusable execution environment is not terminated with the invocation.",
58
+ "maximum": 28800,
59
59
  "minimum": 1
60
60
  },
61
61
  "runtime": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gigadrive/network-config",
3
- "version": "3.1.2",
3
+ "version": "3.3.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/Gigadrive/sdk.git",
@@ -13,6 +13,11 @@
13
13
  "types": "./dist/index.d.ts",
14
14
  "require": "./dist/index.js",
15
15
  "import": "./dist/index.mjs"
16
+ },
17
+ "./nextjs-adapter": {
18
+ "types": "./dist/nextjs-adapter.d.ts",
19
+ "require": "./dist/nextjs-adapter.cjs",
20
+ "import": "./dist/nextjs-adapter.mjs"
16
21
  }
17
22
  },
18
23
  "main": "dist/index.js",
@@ -46,7 +51,7 @@
46
51
  "access": "public"
47
52
  },
48
53
  "scripts": {
49
- "build": "tsup && mkdir -p dist/v4 && cp -r ./src/v4/schema.json ./dist/v4/schema.json",
54
+ "build": "tsup && mkdir -p dist/v4 && cp -r ./src/v4/schema.json ./dist/v4/schema.json && cp ./src/nextjs-adapter.cjs ./dist/nextjs-adapter.cjs",
50
55
  "clean": "rm -rf dist",
51
56
  "typecheck": "tsc --noEmit"
52
57
  }
@@ -54,8 +54,8 @@
54
54
  },
55
55
  "max_duration": {
56
56
  "type": "number",
57
- "description": "The max duration in seconds for the function after which it will be terminated. Defaults to 30.",
58
- "maximum": 900,
57
+ "description": "The maximum lifetime in seconds of one HTTP request, response stream, or WebSocket connection. Defaults to 30. The reusable execution environment is not terminated with the invocation.",
58
+ "maximum": 28800,
59
59
  "minimum": 1
60
60
  },
61
61
  "runtime": {