@constructive-io/site-deploy 0.1.1 → 0.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.
- package/esm/walk.js +13 -2
- package/package.json +3 -3
- package/walk.js +13 -35
package/esm/walk.js
CHANGED
|
@@ -38,12 +38,23 @@ export async function* walkDirectory(dir, ignore) {
|
|
|
38
38
|
}
|
|
39
39
|
async function loadFs() {
|
|
40
40
|
try {
|
|
41
|
-
return
|
|
41
|
+
return loadBuiltin('fs/promises');
|
|
42
42
|
}
|
|
43
43
|
catch (err) {
|
|
44
44
|
throw new DeployError('INVALID_PATH', 'Deploying from a directory path requires Node; pass the files directly instead', err);
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
47
|
async function loadPath() {
|
|
48
|
-
return
|
|
48
|
+
return loadBuiltin('path');
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* `process.getBuiltinModule` (Node >= 22.3) resolves a builtin from both CJS
|
|
52
|
+
* and ESM without `require` or a dynamic `import()`, and is simply absent in a
|
|
53
|
+
* browser, where the caller reports the path as unusable.
|
|
54
|
+
*/
|
|
55
|
+
function loadBuiltin(id) {
|
|
56
|
+
const mod = globalThis.process?.getBuiltinModule?.(id);
|
|
57
|
+
if (!mod)
|
|
58
|
+
throw new Error(`Node builtin "${id}" is not available in this runtime`);
|
|
59
|
+
return mod;
|
|
49
60
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@constructive-io/site-deploy",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"author": "Constructive <developers@constructive.io>",
|
|
5
5
|
"description": "Deploy a static build as an immutable Constructive release: hash, content-addressed upload with dedupe, one manifest commit, publish/rollback and preview refs",
|
|
6
6
|
"main": "index.js",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"test:watch": "jest --watch"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@constructive-io/upload-client": "^0.
|
|
32
|
+
"@constructive-io/upload-client": "^0.29.0",
|
|
33
33
|
"@decryption/hashes": "^0.4.0"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
@@ -43,5 +43,5 @@
|
|
|
43
43
|
"preview",
|
|
44
44
|
"content-addressed"
|
|
45
45
|
],
|
|
46
|
-
"gitHead": "
|
|
46
|
+
"gitHead": "487c4ec9ee997d7da80584a3d41d7120d4354c54"
|
|
47
47
|
}
|
package/walk.js
CHANGED
|
@@ -6,39 +6,6 @@
|
|
|
6
6
|
* that already holds the built files in memory passes them directly instead of
|
|
7
7
|
* a directory path).
|
|
8
8
|
*/
|
|
9
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
12
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
13
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
14
|
-
}
|
|
15
|
-
Object.defineProperty(o, k2, desc);
|
|
16
|
-
}) : (function(o, m, k, k2) {
|
|
17
|
-
if (k2 === undefined) k2 = k;
|
|
18
|
-
o[k2] = m[k];
|
|
19
|
-
}));
|
|
20
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
21
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
22
|
-
}) : function(o, v) {
|
|
23
|
-
o["default"] = v;
|
|
24
|
-
});
|
|
25
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
26
|
-
var ownKeys = function(o) {
|
|
27
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
28
|
-
var ar = [];
|
|
29
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
30
|
-
return ar;
|
|
31
|
-
};
|
|
32
|
-
return ownKeys(o);
|
|
33
|
-
};
|
|
34
|
-
return function (mod) {
|
|
35
|
-
if (mod && mod.__esModule) return mod;
|
|
36
|
-
var result = {};
|
|
37
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
38
|
-
__setModuleDefault(result, mod);
|
|
39
|
-
return result;
|
|
40
|
-
};
|
|
41
|
-
})();
|
|
42
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
43
10
|
exports.walkDirectory = walkDirectory;
|
|
44
11
|
const types_1 = require("./types");
|
|
@@ -74,12 +41,23 @@ async function* walkDirectory(dir, ignore) {
|
|
|
74
41
|
}
|
|
75
42
|
async function loadFs() {
|
|
76
43
|
try {
|
|
77
|
-
return
|
|
44
|
+
return loadBuiltin('fs/promises');
|
|
78
45
|
}
|
|
79
46
|
catch (err) {
|
|
80
47
|
throw new types_1.DeployError('INVALID_PATH', 'Deploying from a directory path requires Node; pass the files directly instead', err);
|
|
81
48
|
}
|
|
82
49
|
}
|
|
83
50
|
async function loadPath() {
|
|
84
|
-
return
|
|
51
|
+
return loadBuiltin('path');
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* `process.getBuiltinModule` (Node >= 22.3) resolves a builtin from both CJS
|
|
55
|
+
* and ESM without `require` or a dynamic `import()`, and is simply absent in a
|
|
56
|
+
* browser, where the caller reports the path as unusable.
|
|
57
|
+
*/
|
|
58
|
+
function loadBuiltin(id) {
|
|
59
|
+
const mod = globalThis.process?.getBuiltinModule?.(id);
|
|
60
|
+
if (!mod)
|
|
61
|
+
throw new Error(`Node builtin "${id}" is not available in this runtime`);
|
|
62
|
+
return mod;
|
|
85
63
|
}
|