freestyle-sandboxes 0.0.24 → 0.0.26

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,90 @@
1
+ 'use strict';
2
+
3
+ var glob = require('glob');
4
+ var fs = require('fs/promises');
5
+ var fsSync = require('fs');
6
+ var path = require('path');
7
+
8
+ function _interopNamespaceDefault(e) {
9
+ var n = Object.create(null);
10
+ if (e) {
11
+ Object.keys(e).forEach(function (k) {
12
+ if (k !== 'default') {
13
+ var d = Object.getOwnPropertyDescriptor(e, k);
14
+ Object.defineProperty(n, k, d.get ? d : {
15
+ enumerable: true,
16
+ get: function () { return e[k]; }
17
+ });
18
+ }
19
+ });
20
+ }
21
+ n.default = e;
22
+ return Object.freeze(n);
23
+ }
24
+
25
+ var fs__namespace = /*#__PURE__*/_interopNamespaceDefault(fs);
26
+ var fsSync__namespace = /*#__PURE__*/_interopNamespaceDefault(fsSync);
27
+ var path__namespace = /*#__PURE__*/_interopNamespaceDefault(path);
28
+
29
+ const prepareDirForDeployment = async (directory) => {
30
+ const files = {};
31
+ const patterns = await glob.glob("**/*", {
32
+ cwd: directory,
33
+ nodir: true,
34
+ ignore: ["**/node_modules/**"],
35
+ absolute: false
36
+ });
37
+ for (const relativePath of patterns) {
38
+ try {
39
+ const filePath = path__namespace.join(directory, relativePath);
40
+ const content = await fs__namespace.readFile(filePath, "base64");
41
+ files[relativePath] = {
42
+ content,
43
+ encoding: "base64"
44
+ };
45
+ } catch (error) {
46
+ console.error(`Error reading file ${relativePath}:`, error);
47
+ }
48
+ }
49
+ return files;
50
+ };
51
+ const prepareDirForDeploymentSync = (directory) => {
52
+ const files = {};
53
+ const patterns = glob.globSync("**/*", {
54
+ cwd: directory,
55
+ nodir: true,
56
+ ignore: ["**/node_modules/**"],
57
+ absolute: false
58
+ });
59
+ for (const relativePath of patterns) {
60
+ try {
61
+ const filePath = path__namespace.join(directory, relativePath);
62
+ const content = fsSync__namespace.readFileSync(filePath, "base64");
63
+ files[relativePath] = {
64
+ content,
65
+ encoding: "base64"
66
+ };
67
+ } catch (error) {
68
+ console.error(`Error reading file ${relativePath}:`, error);
69
+ }
70
+ }
71
+ return files;
72
+ };
73
+ const prepareNextJsForDeployment = async (directory) => {
74
+ const publicDir = path__namespace.join(directory, "public");
75
+ const nextPublicDestination = path__namespace.join(directory, ".next/standalone/public");
76
+ const staticDir = path__namespace.join(directory, ".next/static");
77
+ const nextStaticDestination = path__namespace.join(
78
+ directory,
79
+ ".next/standalone/.next/static"
80
+ );
81
+ await fs__namespace.mkdir(nextPublicDestination, { recursive: true });
82
+ await fs__namespace.copyFile(publicDir, nextPublicDestination);
83
+ await fs__namespace.mkdir(nextStaticDestination, { recursive: true });
84
+ await fs__namespace.copyFile(staticDir, nextStaticDestination);
85
+ return await prepareDirForDeployment(directory);
86
+ };
87
+
88
+ exports.prepareDirForDeployment = prepareDirForDeployment;
89
+ exports.prepareDirForDeploymentSync = prepareDirForDeploymentSync;
90
+ exports.prepareNextJsForDeployment = prepareNextJsForDeployment;
@@ -0,0 +1,12 @@
1
+ import { z as FreestyleDeployWebPayload, I as FreestyleFile } from '../types.gen-DLYohMJT.js';
2
+
3
+ declare const prepareDirForDeployment: (directory: string) => Promise<FreestyleDeployWebPayload["files"]>;
4
+ declare const prepareDirForDeploymentSync: (directory: string) => {
5
+ [key: string]: FreestyleFile;
6
+ };
7
+ /**
8
+ * This is in beta, and may not work as expected. **SUBJECT TO CHANGE.**
9
+ */
10
+ declare const prepareNextJsForDeployment: (directory: string) => Promise<FreestyleDeployWebPayload["files"]>;
11
+
12
+ export { prepareDirForDeployment, prepareDirForDeploymentSync, prepareNextJsForDeployment };
@@ -0,0 +1,12 @@
1
+ import { z as FreestyleDeployWebPayload, I as FreestyleFile } from '../types.gen-DLYohMJT.js';
2
+
3
+ declare const prepareDirForDeployment: (directory: string) => Promise<FreestyleDeployWebPayload["files"]>;
4
+ declare const prepareDirForDeploymentSync: (directory: string) => {
5
+ [key: string]: FreestyleFile;
6
+ };
7
+ /**
8
+ * This is in beta, and may not work as expected. **SUBJECT TO CHANGE.**
9
+ */
10
+ declare const prepareNextJsForDeployment: (directory: string) => Promise<FreestyleDeployWebPayload["files"]>;
11
+
12
+ export { prepareDirForDeployment, prepareDirForDeploymentSync, prepareNextJsForDeployment };
@@ -0,0 +1,65 @@
1
+ import { glob, globSync } from 'glob';
2
+ import * as fs from 'fs/promises';
3
+ import * as fsSync from 'fs';
4
+ import * as path from 'path';
5
+
6
+ const prepareDirForDeployment = async (directory) => {
7
+ const files = {};
8
+ const patterns = await glob("**/*", {
9
+ cwd: directory,
10
+ nodir: true,
11
+ ignore: ["**/node_modules/**"],
12
+ absolute: false
13
+ });
14
+ for (const relativePath of patterns) {
15
+ try {
16
+ const filePath = path.join(directory, relativePath);
17
+ const content = await fs.readFile(filePath, "base64");
18
+ files[relativePath] = {
19
+ content,
20
+ encoding: "base64"
21
+ };
22
+ } catch (error) {
23
+ console.error(`Error reading file ${relativePath}:`, error);
24
+ }
25
+ }
26
+ return files;
27
+ };
28
+ const prepareDirForDeploymentSync = (directory) => {
29
+ const files = {};
30
+ const patterns = globSync("**/*", {
31
+ cwd: directory,
32
+ nodir: true,
33
+ ignore: ["**/node_modules/**"],
34
+ absolute: false
35
+ });
36
+ for (const relativePath of patterns) {
37
+ try {
38
+ const filePath = path.join(directory, relativePath);
39
+ const content = fsSync.readFileSync(filePath, "base64");
40
+ files[relativePath] = {
41
+ content,
42
+ encoding: "base64"
43
+ };
44
+ } catch (error) {
45
+ console.error(`Error reading file ${relativePath}:`, error);
46
+ }
47
+ }
48
+ return files;
49
+ };
50
+ const prepareNextJsForDeployment = async (directory) => {
51
+ const publicDir = path.join(directory, "public");
52
+ const nextPublicDestination = path.join(directory, ".next/standalone/public");
53
+ const staticDir = path.join(directory, ".next/static");
54
+ const nextStaticDestination = path.join(
55
+ directory,
56
+ ".next/standalone/.next/static"
57
+ );
58
+ await fs.mkdir(nextPublicDestination, { recursive: true });
59
+ await fs.copyFile(publicDir, nextPublicDestination);
60
+ await fs.mkdir(nextStaticDestination, { recursive: true });
61
+ await fs.copyFile(staticDir, nextStaticDestination);
62
+ return await prepareDirForDeployment(directory);
63
+ };
64
+
65
+ export { prepareDirForDeployment, prepareDirForDeploymentSync, prepareNextJsForDeployment };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "freestyle-sandboxes",
3
- "version": "0.0.24",
3
+ "version": "0.0.26",
4
4
  "type": "module",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.mjs",
@@ -45,6 +45,16 @@
45
45
  "types": "./dist/langgraph/index.d.mts",
46
46
  "default": "./dist/langgraph/index.mjs"
47
47
  }
48
+ },
49
+ "./utils": {
50
+ "require": {
51
+ "types": "./dist/utils/index.d.cts",
52
+ "default": "./dist/utils/index.cjs"
53
+ },
54
+ "import": {
55
+ "types": "./dist/utils/index.d.mts",
56
+ "default": "./dist/utils/index.mjs"
57
+ }
48
58
  }
49
59
  },
50
60
  "scripts": {
@@ -59,7 +59,7 @@ export const prepareDirForDeploymentSync = (directory: string) => {
59
59
  };
60
60
 
61
61
  /**
62
- * This is in beta, and may not work as expected. SUBJECT TO CHANGE.
62
+ * This is in beta, and may not work as expected. **SUBJECT TO CHANGE.**
63
63
  */
64
64
  export const prepareNextJsForDeployment = async (
65
65
  directory: string