@positronic/cloudflare 0.0.3 → 0.0.4
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/dist/src/api.js +1270 -0
- package/dist/src/brain-runner-do.js +654 -0
- package/dist/src/dev-server.js +1357 -0
- package/{src/index.ts → dist/src/index.js} +1 -6
- package/dist/src/manifest.js +278 -0
- package/dist/src/monitor-do.js +408 -0
- package/{src/node-index.ts → dist/src/node-index.js} +3 -7
- package/dist/src/r2-loader.js +207 -0
- package/dist/src/schedule-do.js +705 -0
- package/dist/src/sqlite-adapter.js +69 -0
- package/dist/types/api.d.ts +21 -0
- package/dist/types/api.d.ts.map +1 -0
- package/dist/types/brain-runner-do.d.ts +25 -0
- package/dist/types/brain-runner-do.d.ts.map +1 -0
- package/dist/types/dev-server.d.ts +45 -0
- package/dist/types/dev-server.d.ts.map +1 -0
- package/dist/types/index.d.ts +7 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/manifest.d.ts +11 -0
- package/dist/types/manifest.d.ts.map +1 -0
- package/dist/types/monitor-do.d.ts +16 -0
- package/dist/types/monitor-do.d.ts.map +1 -0
- package/dist/types/node-index.d.ts +10 -0
- package/dist/types/node-index.d.ts.map +1 -0
- package/dist/types/r2-loader.d.ts +10 -0
- package/dist/types/r2-loader.d.ts.map +1 -0
- package/dist/types/schedule-do.d.ts +47 -0
- package/dist/types/schedule-do.d.ts.map +1 -0
- package/dist/types/sqlite-adapter.d.ts +10 -0
- package/dist/types/sqlite-adapter.d.ts.map +1 -0
- package/package.json +5 -1
- package/src/api.ts +0 -579
- package/src/brain-runner-do.ts +0 -309
- package/src/dev-server.ts +0 -776
- package/src/manifest.ts +0 -69
- package/src/monitor-do.ts +0 -268
- package/src/r2-loader.ts +0 -27
- package/src/schedule-do.ts +0 -377
- package/src/sqlite-adapter.ts +0 -50
- package/test-project/package-lock.json +0 -3010
- package/test-project/package.json +0 -21
- package/test-project/src/index.ts +0 -70
- package/test-project/src/runner.ts +0 -24
- package/test-project/tests/api.test.ts +0 -1005
- package/test-project/tests/r2loader.test.ts +0 -73
- package/test-project/tests/resources-api.test.ts +0 -671
- package/test-project/tests/spec.test.ts +0 -135
- package/test-project/tests/tsconfig.json +0 -7
- package/test-project/tsconfig.json +0 -20
- package/test-project/vitest.config.ts +0 -12
- package/test-project/wrangler.jsonc +0 -53
- package/tsconfig.json +0 -11
|
@@ -0,0 +1,1357 @@
|
|
|
1
|
+
function _array_like_to_array(arr, len) {
|
|
2
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
3
|
+
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
4
|
+
return arr2;
|
|
5
|
+
}
|
|
6
|
+
function _array_with_holes(arr) {
|
|
7
|
+
if (Array.isArray(arr)) return arr;
|
|
8
|
+
}
|
|
9
|
+
function _array_without_holes(arr) {
|
|
10
|
+
if (Array.isArray(arr)) return _array_like_to_array(arr);
|
|
11
|
+
}
|
|
12
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
13
|
+
try {
|
|
14
|
+
var info = gen[key](arg);
|
|
15
|
+
var value = info.value;
|
|
16
|
+
} catch (error) {
|
|
17
|
+
reject(error);
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
if (info.done) {
|
|
21
|
+
resolve(value);
|
|
22
|
+
} else {
|
|
23
|
+
Promise.resolve(value).then(_next, _throw);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
function _async_to_generator(fn) {
|
|
27
|
+
return function() {
|
|
28
|
+
var self = this, args = arguments;
|
|
29
|
+
return new Promise(function(resolve, reject) {
|
|
30
|
+
var gen = fn.apply(self, args);
|
|
31
|
+
function _next(value) {
|
|
32
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
33
|
+
}
|
|
34
|
+
function _throw(err) {
|
|
35
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
36
|
+
}
|
|
37
|
+
_next(undefined);
|
|
38
|
+
});
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
function _class_call_check(instance, Constructor) {
|
|
42
|
+
if (!(instance instanceof Constructor)) {
|
|
43
|
+
throw new TypeError("Cannot call a class as a function");
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
function _defineProperties(target, props) {
|
|
47
|
+
for(var i = 0; i < props.length; i++){
|
|
48
|
+
var descriptor = props[i];
|
|
49
|
+
descriptor.enumerable = descriptor.enumerable || false;
|
|
50
|
+
descriptor.configurable = true;
|
|
51
|
+
if ("value" in descriptor) descriptor.writable = true;
|
|
52
|
+
Object.defineProperty(target, descriptor.key, descriptor);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
function _create_class(Constructor, protoProps, staticProps) {
|
|
56
|
+
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
57
|
+
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
58
|
+
return Constructor;
|
|
59
|
+
}
|
|
60
|
+
function _define_property(obj, key, value) {
|
|
61
|
+
if (key in obj) {
|
|
62
|
+
Object.defineProperty(obj, key, {
|
|
63
|
+
value: value,
|
|
64
|
+
enumerable: true,
|
|
65
|
+
configurable: true,
|
|
66
|
+
writable: true
|
|
67
|
+
});
|
|
68
|
+
} else {
|
|
69
|
+
obj[key] = value;
|
|
70
|
+
}
|
|
71
|
+
return obj;
|
|
72
|
+
}
|
|
73
|
+
function _iterable_to_array(iter) {
|
|
74
|
+
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
75
|
+
}
|
|
76
|
+
function _iterable_to_array_limit(arr, i) {
|
|
77
|
+
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
78
|
+
if (_i == null) return;
|
|
79
|
+
var _arr = [];
|
|
80
|
+
var _n = true;
|
|
81
|
+
var _d = false;
|
|
82
|
+
var _s, _e;
|
|
83
|
+
try {
|
|
84
|
+
for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
|
|
85
|
+
_arr.push(_s.value);
|
|
86
|
+
if (i && _arr.length === i) break;
|
|
87
|
+
}
|
|
88
|
+
} catch (err) {
|
|
89
|
+
_d = true;
|
|
90
|
+
_e = err;
|
|
91
|
+
} finally{
|
|
92
|
+
try {
|
|
93
|
+
if (!_n && _i["return"] != null) _i["return"]();
|
|
94
|
+
} finally{
|
|
95
|
+
if (_d) throw _e;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
return _arr;
|
|
99
|
+
}
|
|
100
|
+
function _non_iterable_rest() {
|
|
101
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
102
|
+
}
|
|
103
|
+
function _non_iterable_spread() {
|
|
104
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
105
|
+
}
|
|
106
|
+
function _object_spread(target) {
|
|
107
|
+
for(var i = 1; i < arguments.length; i++){
|
|
108
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
|
109
|
+
var ownKeys = Object.keys(source);
|
|
110
|
+
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
111
|
+
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
112
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
113
|
+
}));
|
|
114
|
+
}
|
|
115
|
+
ownKeys.forEach(function(key) {
|
|
116
|
+
_define_property(target, key, source[key]);
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
return target;
|
|
120
|
+
}
|
|
121
|
+
function ownKeys(object, enumerableOnly) {
|
|
122
|
+
var keys = Object.keys(object);
|
|
123
|
+
if (Object.getOwnPropertySymbols) {
|
|
124
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
125
|
+
if (enumerableOnly) {
|
|
126
|
+
symbols = symbols.filter(function(sym) {
|
|
127
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
keys.push.apply(keys, symbols);
|
|
131
|
+
}
|
|
132
|
+
return keys;
|
|
133
|
+
}
|
|
134
|
+
function _object_spread_props(target, source) {
|
|
135
|
+
source = source != null ? source : {};
|
|
136
|
+
if (Object.getOwnPropertyDescriptors) {
|
|
137
|
+
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
138
|
+
} else {
|
|
139
|
+
ownKeys(Object(source)).forEach(function(key) {
|
|
140
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
return target;
|
|
144
|
+
}
|
|
145
|
+
function _sliced_to_array(arr, i) {
|
|
146
|
+
return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
|
|
147
|
+
}
|
|
148
|
+
function _to_consumable_array(arr) {
|
|
149
|
+
return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
|
|
150
|
+
}
|
|
151
|
+
function _unsupported_iterable_to_array(o, minLen) {
|
|
152
|
+
if (!o) return;
|
|
153
|
+
if (typeof o === "string") return _array_like_to_array(o, minLen);
|
|
154
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
155
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
156
|
+
if (n === "Map" || n === "Set") return Array.from(n);
|
|
157
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
158
|
+
}
|
|
159
|
+
function _ts_generator(thisArg, body) {
|
|
160
|
+
var f, y, t, _ = {
|
|
161
|
+
label: 0,
|
|
162
|
+
sent: function() {
|
|
163
|
+
if (t[0] & 1) throw t[1];
|
|
164
|
+
return t[1];
|
|
165
|
+
},
|
|
166
|
+
trys: [],
|
|
167
|
+
ops: []
|
|
168
|
+
}, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
169
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
170
|
+
return this;
|
|
171
|
+
}), g;
|
|
172
|
+
function verb(n) {
|
|
173
|
+
return function(v) {
|
|
174
|
+
return step([
|
|
175
|
+
n,
|
|
176
|
+
v
|
|
177
|
+
]);
|
|
178
|
+
};
|
|
179
|
+
}
|
|
180
|
+
function step(op) {
|
|
181
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
182
|
+
while(g && (g = 0, op[0] && (_ = 0)), _)try {
|
|
183
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
184
|
+
if (y = 0, t) op = [
|
|
185
|
+
op[0] & 2,
|
|
186
|
+
t.value
|
|
187
|
+
];
|
|
188
|
+
switch(op[0]){
|
|
189
|
+
case 0:
|
|
190
|
+
case 1:
|
|
191
|
+
t = op;
|
|
192
|
+
break;
|
|
193
|
+
case 4:
|
|
194
|
+
_.label++;
|
|
195
|
+
return {
|
|
196
|
+
value: op[1],
|
|
197
|
+
done: false
|
|
198
|
+
};
|
|
199
|
+
case 5:
|
|
200
|
+
_.label++;
|
|
201
|
+
y = op[1];
|
|
202
|
+
op = [
|
|
203
|
+
0
|
|
204
|
+
];
|
|
205
|
+
continue;
|
|
206
|
+
case 7:
|
|
207
|
+
op = _.ops.pop();
|
|
208
|
+
_.trys.pop();
|
|
209
|
+
continue;
|
|
210
|
+
default:
|
|
211
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
212
|
+
_ = 0;
|
|
213
|
+
continue;
|
|
214
|
+
}
|
|
215
|
+
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
216
|
+
_.label = op[1];
|
|
217
|
+
break;
|
|
218
|
+
}
|
|
219
|
+
if (op[0] === 6 && _.label < t[1]) {
|
|
220
|
+
_.label = t[1];
|
|
221
|
+
t = op;
|
|
222
|
+
break;
|
|
223
|
+
}
|
|
224
|
+
if (t && _.label < t[2]) {
|
|
225
|
+
_.label = t[2];
|
|
226
|
+
_.ops.push(op);
|
|
227
|
+
break;
|
|
228
|
+
}
|
|
229
|
+
if (t[2]) _.ops.pop();
|
|
230
|
+
_.trys.pop();
|
|
231
|
+
continue;
|
|
232
|
+
}
|
|
233
|
+
op = body.call(thisArg, _);
|
|
234
|
+
} catch (e) {
|
|
235
|
+
op = [
|
|
236
|
+
6,
|
|
237
|
+
e
|
|
238
|
+
];
|
|
239
|
+
y = 0;
|
|
240
|
+
} finally{
|
|
241
|
+
f = t = 0;
|
|
242
|
+
}
|
|
243
|
+
if (op[0] & 5) throw op[1];
|
|
244
|
+
return {
|
|
245
|
+
value: op[0] ? op[1] : void 0,
|
|
246
|
+
done: true
|
|
247
|
+
};
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
import * as path from 'path';
|
|
251
|
+
import * as fsPromises from 'fs/promises';
|
|
252
|
+
import * as fs from 'fs';
|
|
253
|
+
import * as os from 'os';
|
|
254
|
+
import { spawn } from 'child_process';
|
|
255
|
+
import * as dotenv from 'dotenv';
|
|
256
|
+
import caz from 'caz';
|
|
257
|
+
/**
|
|
258
|
+
* Implementation of ServerHandle that wraps a ChildProcess
|
|
259
|
+
*/ var ProcessServerHandle = /*#__PURE__*/ function() {
|
|
260
|
+
"use strict";
|
|
261
|
+
function ProcessServerHandle(process1, port) {
|
|
262
|
+
var _this = this;
|
|
263
|
+
_class_call_check(this, ProcessServerHandle);
|
|
264
|
+
_define_property(this, "process", void 0);
|
|
265
|
+
_define_property(this, "port", void 0);
|
|
266
|
+
_define_property(this, "closeCallbacks", void 0);
|
|
267
|
+
_define_property(this, "errorCallbacks", void 0);
|
|
268
|
+
_define_property(this, "_killed", void 0);
|
|
269
|
+
this.process = process1;
|
|
270
|
+
this.port = port;
|
|
271
|
+
this.closeCallbacks = [];
|
|
272
|
+
this.errorCallbacks = [];
|
|
273
|
+
this._killed = false;
|
|
274
|
+
// Forward process events to registered callbacks
|
|
275
|
+
process1.on('close', function(code) {
|
|
276
|
+
_this.closeCallbacks.forEach(function(cb) {
|
|
277
|
+
return cb(code);
|
|
278
|
+
});
|
|
279
|
+
});
|
|
280
|
+
process1.on('error', function(error) {
|
|
281
|
+
_this.errorCallbacks.forEach(function(cb) {
|
|
282
|
+
return cb(error);
|
|
283
|
+
});
|
|
284
|
+
});
|
|
285
|
+
process1.on('exit', function() {
|
|
286
|
+
_this._killed = true;
|
|
287
|
+
});
|
|
288
|
+
}
|
|
289
|
+
_create_class(ProcessServerHandle, [
|
|
290
|
+
{
|
|
291
|
+
key: "onClose",
|
|
292
|
+
value: function onClose(callback) {
|
|
293
|
+
this.closeCallbacks.push(callback);
|
|
294
|
+
}
|
|
295
|
+
},
|
|
296
|
+
{
|
|
297
|
+
key: "onError",
|
|
298
|
+
value: function onError(callback) {
|
|
299
|
+
this.errorCallbacks.push(callback);
|
|
300
|
+
}
|
|
301
|
+
},
|
|
302
|
+
{
|
|
303
|
+
key: "kill",
|
|
304
|
+
value: function kill(signal) {
|
|
305
|
+
if (!this._killed && this.process && !this.process.killed) {
|
|
306
|
+
var result = this.process.kill(signal);
|
|
307
|
+
if (result) {
|
|
308
|
+
this._killed = true;
|
|
309
|
+
}
|
|
310
|
+
return result;
|
|
311
|
+
}
|
|
312
|
+
return false;
|
|
313
|
+
}
|
|
314
|
+
},
|
|
315
|
+
{
|
|
316
|
+
key: "killed",
|
|
317
|
+
get: function get() {
|
|
318
|
+
var _this_process;
|
|
319
|
+
var _this_process_killed;
|
|
320
|
+
return this._killed || ((_this_process_killed = (_this_process = this.process) === null || _this_process === void 0 ? void 0 : _this_process.killed) !== null && _this_process_killed !== void 0 ? _this_process_killed : true);
|
|
321
|
+
}
|
|
322
|
+
},
|
|
323
|
+
{
|
|
324
|
+
key: "waitUntilReady",
|
|
325
|
+
value: function waitUntilReady() {
|
|
326
|
+
var maxWaitMs = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 30000;
|
|
327
|
+
return _async_to_generator(function() {
|
|
328
|
+
var startTime, port, response, data, error;
|
|
329
|
+
return _ts_generator(this, function(_state) {
|
|
330
|
+
switch(_state.label){
|
|
331
|
+
case 0:
|
|
332
|
+
startTime = Date.now();
|
|
333
|
+
port = this.port || 8787;
|
|
334
|
+
_state.label = 1;
|
|
335
|
+
case 1:
|
|
336
|
+
if (!(Date.now() - startTime < maxWaitMs)) return [
|
|
337
|
+
3,
|
|
338
|
+
9
|
|
339
|
+
];
|
|
340
|
+
_state.label = 2;
|
|
341
|
+
case 2:
|
|
342
|
+
_state.trys.push([
|
|
343
|
+
2,
|
|
344
|
+
6,
|
|
345
|
+
,
|
|
346
|
+
7
|
|
347
|
+
]);
|
|
348
|
+
return [
|
|
349
|
+
4,
|
|
350
|
+
fetch("http://localhost:".concat(port, "/status"))
|
|
351
|
+
];
|
|
352
|
+
case 3:
|
|
353
|
+
response = _state.sent();
|
|
354
|
+
if (!response.ok) return [
|
|
355
|
+
3,
|
|
356
|
+
5
|
|
357
|
+
];
|
|
358
|
+
return [
|
|
359
|
+
4,
|
|
360
|
+
response.json()
|
|
361
|
+
];
|
|
362
|
+
case 4:
|
|
363
|
+
data = _state.sent();
|
|
364
|
+
if (data.ready === true) {
|
|
365
|
+
return [
|
|
366
|
+
2,
|
|
367
|
+
true
|
|
368
|
+
];
|
|
369
|
+
}
|
|
370
|
+
_state.label = 5;
|
|
371
|
+
case 5:
|
|
372
|
+
return [
|
|
373
|
+
3,
|
|
374
|
+
7
|
|
375
|
+
];
|
|
376
|
+
case 6:
|
|
377
|
+
error = _state.sent();
|
|
378
|
+
return [
|
|
379
|
+
3,
|
|
380
|
+
7
|
|
381
|
+
];
|
|
382
|
+
case 7:
|
|
383
|
+
// Wait a bit before trying again
|
|
384
|
+
return [
|
|
385
|
+
4,
|
|
386
|
+
new Promise(function(resolve) {
|
|
387
|
+
return setTimeout(resolve, 500);
|
|
388
|
+
})
|
|
389
|
+
];
|
|
390
|
+
case 8:
|
|
391
|
+
_state.sent();
|
|
392
|
+
return [
|
|
393
|
+
3,
|
|
394
|
+
1
|
|
395
|
+
];
|
|
396
|
+
case 9:
|
|
397
|
+
return [
|
|
398
|
+
2,
|
|
399
|
+
false
|
|
400
|
+
];
|
|
401
|
+
}
|
|
402
|
+
});
|
|
403
|
+
}).call(this);
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
]);
|
|
407
|
+
return ProcessServerHandle;
|
|
408
|
+
}();
|
|
409
|
+
function generateProject(projectName, projectDir, onSuccess) {
|
|
410
|
+
return _async_to_generator(function() {
|
|
411
|
+
var devPath, newProjectTemplatePath, cazOptions, originalNewProjectPkg, copiedNewProjectPkg;
|
|
412
|
+
return _ts_generator(this, function(_state) {
|
|
413
|
+
switch(_state.label){
|
|
414
|
+
case 0:
|
|
415
|
+
devPath = process.env.POSITRONIC_LOCAL_PATH;
|
|
416
|
+
newProjectTemplatePath = '@positronic/template-new-project';
|
|
417
|
+
cazOptions = {
|
|
418
|
+
name: projectName
|
|
419
|
+
};
|
|
420
|
+
_state.label = 1;
|
|
421
|
+
case 1:
|
|
422
|
+
_state.trys.push([
|
|
423
|
+
1,
|
|
424
|
+
,
|
|
425
|
+
4,
|
|
426
|
+
5
|
|
427
|
+
]);
|
|
428
|
+
if (devPath) {
|
|
429
|
+
// Copying templates, why you ask?
|
|
430
|
+
// Well because when caz runs if you pass it a path to the template module
|
|
431
|
+
// (e.g. for development environment setting POSITRONIC_LOCAL_PATH)
|
|
432
|
+
// it runs npm install --production in the template directory. This is a problem
|
|
433
|
+
// in our monorepo because this messes up the node_modules at the root of the
|
|
434
|
+
// monorepo which then causes the tests to fail. Also any time I was generating a new
|
|
435
|
+
// project it was a pain to have to run npm install over and over again just
|
|
436
|
+
// to get back to a good state.
|
|
437
|
+
originalNewProjectPkg = path.resolve(devPath, 'packages', 'template-new-project');
|
|
438
|
+
copiedNewProjectPkg = fs.mkdtempSync(path.join(os.tmpdir(), 'positronic-newproj-'));
|
|
439
|
+
fs.cpSync(originalNewProjectPkg, copiedNewProjectPkg, {
|
|
440
|
+
recursive: true
|
|
441
|
+
});
|
|
442
|
+
newProjectTemplatePath = copiedNewProjectPkg;
|
|
443
|
+
cazOptions = {
|
|
444
|
+
name: projectName,
|
|
445
|
+
backend: 'cloudflare',
|
|
446
|
+
install: true,
|
|
447
|
+
pm: 'npm'
|
|
448
|
+
};
|
|
449
|
+
}
|
|
450
|
+
return [
|
|
451
|
+
4,
|
|
452
|
+
caz.default(newProjectTemplatePath, projectDir, _object_spread_props(_object_spread({}, cazOptions), {
|
|
453
|
+
force: false
|
|
454
|
+
}))
|
|
455
|
+
];
|
|
456
|
+
case 2:
|
|
457
|
+
_state.sent();
|
|
458
|
+
return [
|
|
459
|
+
4,
|
|
460
|
+
onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess()
|
|
461
|
+
];
|
|
462
|
+
case 3:
|
|
463
|
+
_state.sent();
|
|
464
|
+
return [
|
|
465
|
+
3,
|
|
466
|
+
5
|
|
467
|
+
];
|
|
468
|
+
case 4:
|
|
469
|
+
// Clean up the temporary copied new project package
|
|
470
|
+
if (devPath) {
|
|
471
|
+
fs.rmSync(newProjectTemplatePath, {
|
|
472
|
+
recursive: true,
|
|
473
|
+
force: true,
|
|
474
|
+
maxRetries: 3
|
|
475
|
+
});
|
|
476
|
+
}
|
|
477
|
+
return [
|
|
478
|
+
7
|
|
479
|
+
];
|
|
480
|
+
case 5:
|
|
481
|
+
return [
|
|
482
|
+
2
|
|
483
|
+
];
|
|
484
|
+
}
|
|
485
|
+
});
|
|
486
|
+
})();
|
|
487
|
+
}
|
|
488
|
+
function regenerateManifestFile(projectRootPath, targetSrcDir) {
|
|
489
|
+
return _async_to_generator(function() {
|
|
490
|
+
var runnerPath, brainsDir, manifestPath, importStatements, manifestEntries, brainsDirExists, files, brainFiles, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, file, brainName, importPath, importAlias, manifestContent, runnerContent;
|
|
491
|
+
return _ts_generator(this, function(_state) {
|
|
492
|
+
switch(_state.label){
|
|
493
|
+
case 0:
|
|
494
|
+
runnerPath = path.join(projectRootPath, 'runner.ts');
|
|
495
|
+
brainsDir = path.join(projectRootPath, 'brains');
|
|
496
|
+
manifestPath = path.join(targetSrcDir, '_manifest.ts');
|
|
497
|
+
importStatements = "import type { Brain } from '@positronic/core';\n";
|
|
498
|
+
manifestEntries = '';
|
|
499
|
+
return [
|
|
500
|
+
4,
|
|
501
|
+
fsPromises.access(brainsDir).then(function() {
|
|
502
|
+
return true;
|
|
503
|
+
}).catch(function() {
|
|
504
|
+
return false;
|
|
505
|
+
})
|
|
506
|
+
];
|
|
507
|
+
case 1:
|
|
508
|
+
brainsDirExists = _state.sent();
|
|
509
|
+
if (!brainsDirExists) return [
|
|
510
|
+
3,
|
|
511
|
+
3
|
|
512
|
+
];
|
|
513
|
+
return [
|
|
514
|
+
4,
|
|
515
|
+
fsPromises.readdir(brainsDir)
|
|
516
|
+
];
|
|
517
|
+
case 2:
|
|
518
|
+
files = _state.sent();
|
|
519
|
+
brainFiles = files.filter(function(file) {
|
|
520
|
+
return file.endsWith('.ts') && !file.startsWith('_');
|
|
521
|
+
});
|
|
522
|
+
_iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
523
|
+
try {
|
|
524
|
+
for(_iterator = brainFiles[Symbol.iterator](); !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
525
|
+
file = _step.value;
|
|
526
|
+
brainName = path.basename(file, '.ts');
|
|
527
|
+
importPath = "../../brains/".concat(brainName, ".js");
|
|
528
|
+
importAlias = "brain_".concat(brainName.replace(/[^a-zA-Z0-9_]/g, '_'));
|
|
529
|
+
importStatements += "import * as ".concat(importAlias, " from '").concat(importPath, "';\n");
|
|
530
|
+
manifestEntries += " ".concat(JSON.stringify(brainName), ": ").concat(importAlias, ".default as Brain,\n");
|
|
531
|
+
}
|
|
532
|
+
} catch (err) {
|
|
533
|
+
_didIteratorError = true;
|
|
534
|
+
_iteratorError = err;
|
|
535
|
+
} finally{
|
|
536
|
+
try {
|
|
537
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
538
|
+
_iterator.return();
|
|
539
|
+
}
|
|
540
|
+
} finally{
|
|
541
|
+
if (_didIteratorError) {
|
|
542
|
+
throw _iteratorError;
|
|
543
|
+
}
|
|
544
|
+
}
|
|
545
|
+
}
|
|
546
|
+
_state.label = 3;
|
|
547
|
+
case 3:
|
|
548
|
+
manifestContent = "// This file is generated automatically. Do not edit directly.\n".concat(importStatements, "\nexport const staticManifest: Record<string, Brain> = {\n").concat(manifestEntries, "};\n");
|
|
549
|
+
return [
|
|
550
|
+
4,
|
|
551
|
+
fsPromises.readFile(runnerPath, 'utf-8')
|
|
552
|
+
];
|
|
553
|
+
case 4:
|
|
554
|
+
runnerContent = _state.sent();
|
|
555
|
+
return [
|
|
556
|
+
4,
|
|
557
|
+
fsPromises.mkdir(targetSrcDir, {
|
|
558
|
+
recursive: true
|
|
559
|
+
})
|
|
560
|
+
];
|
|
561
|
+
case 5:
|
|
562
|
+
_state.sent();
|
|
563
|
+
return [
|
|
564
|
+
4,
|
|
565
|
+
fsPromises.writeFile(manifestPath, manifestContent, 'utf-8')
|
|
566
|
+
];
|
|
567
|
+
case 6:
|
|
568
|
+
_state.sent();
|
|
569
|
+
return [
|
|
570
|
+
4,
|
|
571
|
+
fsPromises.writeFile(path.join(targetSrcDir, 'runner.ts'), runnerContent, 'utf-8')
|
|
572
|
+
];
|
|
573
|
+
case 7:
|
|
574
|
+
_state.sent();
|
|
575
|
+
return [
|
|
576
|
+
2
|
|
577
|
+
];
|
|
578
|
+
}
|
|
579
|
+
});
|
|
580
|
+
})();
|
|
581
|
+
}
|
|
582
|
+
export var CloudflareDevServer = /*#__PURE__*/ function() {
|
|
583
|
+
"use strict";
|
|
584
|
+
function CloudflareDevServer(projectRootDir) {
|
|
585
|
+
_class_call_check(this, CloudflareDevServer);
|
|
586
|
+
_define_property(this, "projectRootDir", void 0);
|
|
587
|
+
// TODO: Future architectural improvements:
|
|
588
|
+
// 1. Extract .positronic directory into its own template package to eliminate temp directory hack
|
|
589
|
+
// 2. Create a declarative configuration model for wrangler updates
|
|
590
|
+
// 3. Move more logic into the template itself using template interpolation
|
|
591
|
+
// 4. Consider a pipeline-based setup process for better composability
|
|
592
|
+
// 5. Separate concerns better between template generation, env syncing, and dynamic configuration
|
|
593
|
+
/**
|
|
594
|
+
* Sets up the .positronic server environment directory.
|
|
595
|
+
* If the directory is missing or forceSetup is true, it generates the
|
|
596
|
+
* full project in a temporary directory and copies the .positronic
|
|
597
|
+
* part into the actual project.
|
|
598
|
+
*
|
|
599
|
+
* Doing it this way because it's tricky to split the template-new-project
|
|
600
|
+
* into a template-cloudflare without lots of extra code, was better to combine
|
|
601
|
+
* backend templates into a single template-new-project. But then we still need
|
|
602
|
+
* a way to generate the .positronic directory if it's not there, so this is the
|
|
603
|
+
* simplest solution.
|
|
604
|
+
*/ _define_property(this, "logCallbacks", void 0);
|
|
605
|
+
_define_property(this, "errorCallbacks", void 0);
|
|
606
|
+
_define_property(this, "warningCallbacks", void 0);
|
|
607
|
+
this.projectRootDir = projectRootDir;
|
|
608
|
+
this.logCallbacks = [];
|
|
609
|
+
this.errorCallbacks = [];
|
|
610
|
+
this.warningCallbacks = [];
|
|
611
|
+
}
|
|
612
|
+
_create_class(CloudflareDevServer, [
|
|
613
|
+
{
|
|
614
|
+
key: "setup",
|
|
615
|
+
value: function setup(force) {
|
|
616
|
+
return _async_to_generator(function() {
|
|
617
|
+
var projectRoot, serverDir;
|
|
618
|
+
return _ts_generator(this, function(_state) {
|
|
619
|
+
switch(_state.label){
|
|
620
|
+
case 0:
|
|
621
|
+
projectRoot = this.projectRootDir;
|
|
622
|
+
serverDir = path.join(projectRoot, '.positronic');
|
|
623
|
+
// Ensure .positronic directory exists
|
|
624
|
+
return [
|
|
625
|
+
4,
|
|
626
|
+
this.ensureServerDirectory(projectRoot, serverDir, force)
|
|
627
|
+
];
|
|
628
|
+
case 1:
|
|
629
|
+
_state.sent();
|
|
630
|
+
// Sync environment variables to .dev.vars
|
|
631
|
+
return [
|
|
632
|
+
4,
|
|
633
|
+
this.syncEnvironmentVariables(projectRoot, serverDir)
|
|
634
|
+
];
|
|
635
|
+
case 2:
|
|
636
|
+
_state.sent();
|
|
637
|
+
// Regenerate manifest based on actual project state
|
|
638
|
+
return [
|
|
639
|
+
4,
|
|
640
|
+
this.regenerateProjectManifest(projectRoot, serverDir)
|
|
641
|
+
];
|
|
642
|
+
case 3:
|
|
643
|
+
_state.sent();
|
|
644
|
+
// Update wrangler config based on environment
|
|
645
|
+
return [
|
|
646
|
+
4,
|
|
647
|
+
this.updateWranglerConfiguration(projectRoot, serverDir)
|
|
648
|
+
];
|
|
649
|
+
case 4:
|
|
650
|
+
_state.sent();
|
|
651
|
+
return [
|
|
652
|
+
2
|
|
653
|
+
];
|
|
654
|
+
}
|
|
655
|
+
});
|
|
656
|
+
}).call(this);
|
|
657
|
+
}
|
|
658
|
+
},
|
|
659
|
+
{
|
|
660
|
+
key: "ensureServerDirectory",
|
|
661
|
+
value: function ensureServerDirectory(projectRoot, serverDir, force) {
|
|
662
|
+
return _async_to_generator(function() {
|
|
663
|
+
var serverDirExists, tempDir, configPath, configContent, config, projectName;
|
|
664
|
+
return _ts_generator(this, function(_state) {
|
|
665
|
+
switch(_state.label){
|
|
666
|
+
case 0:
|
|
667
|
+
return [
|
|
668
|
+
4,
|
|
669
|
+
fsPromises.access(serverDir).then(function() {
|
|
670
|
+
return true;
|
|
671
|
+
}).catch(function() {
|
|
672
|
+
return false;
|
|
673
|
+
})
|
|
674
|
+
];
|
|
675
|
+
case 1:
|
|
676
|
+
serverDirExists = _state.sent();
|
|
677
|
+
if (!(!serverDirExists || force)) return [
|
|
678
|
+
3,
|
|
679
|
+
6
|
|
680
|
+
];
|
|
681
|
+
console.log(force ? 'Forcing regeneration of .positronic environment...' : 'Missing .positronic environment, generating...');
|
|
682
|
+
_state.label = 2;
|
|
683
|
+
case 2:
|
|
684
|
+
_state.trys.push([
|
|
685
|
+
2,
|
|
686
|
+
,
|
|
687
|
+
5,
|
|
688
|
+
6
|
|
689
|
+
]);
|
|
690
|
+
// Create a temp directory to generate the project in
|
|
691
|
+
// so we can copy the .positronic directory to the user's project
|
|
692
|
+
tempDir = fs.mkdtempSync(path.join(os.tmpdir(), 'positronic-server-setup-'));
|
|
693
|
+
// Read the actual project name from the config file
|
|
694
|
+
configPath = path.join(projectRoot, 'positronic.config.json');
|
|
695
|
+
return [
|
|
696
|
+
4,
|
|
697
|
+
fsPromises.readFile(configPath, 'utf-8')
|
|
698
|
+
];
|
|
699
|
+
case 3:
|
|
700
|
+
configContent = _state.sent();
|
|
701
|
+
config = JSON.parse(configContent);
|
|
702
|
+
projectName = config.projectName;
|
|
703
|
+
if (!projectName) {
|
|
704
|
+
throw new Error('Project name not found in positronic.config.json');
|
|
705
|
+
}
|
|
706
|
+
return [
|
|
707
|
+
4,
|
|
708
|
+
generateProject(projectName, tempDir, function() {
|
|
709
|
+
return _async_to_generator(function() {
|
|
710
|
+
var sourcePositronicDir, targetPositronicDir;
|
|
711
|
+
return _ts_generator(this, function(_state) {
|
|
712
|
+
switch(_state.label){
|
|
713
|
+
case 0:
|
|
714
|
+
sourcePositronicDir = path.join(tempDir, '.positronic');
|
|
715
|
+
targetPositronicDir = serverDir;
|
|
716
|
+
if (!(serverDirExists && force)) return [
|
|
717
|
+
3,
|
|
718
|
+
2
|
|
719
|
+
];
|
|
720
|
+
return [
|
|
721
|
+
4,
|
|
722
|
+
fsPromises.rm(targetPositronicDir, {
|
|
723
|
+
recursive: true,
|
|
724
|
+
force: true
|
|
725
|
+
})
|
|
726
|
+
];
|
|
727
|
+
case 1:
|
|
728
|
+
_state.sent();
|
|
729
|
+
_state.label = 2;
|
|
730
|
+
case 2:
|
|
731
|
+
// Copy the generated .positronic directory
|
|
732
|
+
return [
|
|
733
|
+
4,
|
|
734
|
+
fsPromises.cp(sourcePositronicDir, targetPositronicDir, {
|
|
735
|
+
recursive: true
|
|
736
|
+
})
|
|
737
|
+
];
|
|
738
|
+
case 3:
|
|
739
|
+
_state.sent();
|
|
740
|
+
return [
|
|
741
|
+
2
|
|
742
|
+
];
|
|
743
|
+
}
|
|
744
|
+
});
|
|
745
|
+
})();
|
|
746
|
+
})
|
|
747
|
+
];
|
|
748
|
+
case 4:
|
|
749
|
+
_state.sent();
|
|
750
|
+
return [
|
|
751
|
+
3,
|
|
752
|
+
6
|
|
753
|
+
];
|
|
754
|
+
case 5:
|
|
755
|
+
// Clean up the temporary generation directory
|
|
756
|
+
if (tempDir) {
|
|
757
|
+
fs.rmSync(tempDir, {
|
|
758
|
+
recursive: true,
|
|
759
|
+
force: true
|
|
760
|
+
});
|
|
761
|
+
}
|
|
762
|
+
return [
|
|
763
|
+
7
|
|
764
|
+
];
|
|
765
|
+
case 6:
|
|
766
|
+
return [
|
|
767
|
+
2
|
|
768
|
+
];
|
|
769
|
+
}
|
|
770
|
+
});
|
|
771
|
+
})();
|
|
772
|
+
}
|
|
773
|
+
},
|
|
774
|
+
{
|
|
775
|
+
key: "syncEnvironmentVariables",
|
|
776
|
+
value: function syncEnvironmentVariables(projectRoot, serverDir) {
|
|
777
|
+
return _async_to_generator(function() {
|
|
778
|
+
var rootEnvFilePath, devVarsPath, devVarsContent, rootEnvFileContent, parsedRootEnv;
|
|
779
|
+
return _ts_generator(this, function(_state) {
|
|
780
|
+
rootEnvFilePath = path.join(projectRoot, '.env');
|
|
781
|
+
devVarsPath = path.join(serverDir, '.dev.vars');
|
|
782
|
+
devVarsContent = '';
|
|
783
|
+
if (fs.existsSync(rootEnvFilePath)) {
|
|
784
|
+
rootEnvFileContent = fs.readFileSync(rootEnvFilePath);
|
|
785
|
+
parsedRootEnv = dotenv.parse(rootEnvFileContent);
|
|
786
|
+
if (Object.keys(parsedRootEnv).length > 0) {
|
|
787
|
+
devVarsContent = Object.entries(parsedRootEnv).map(function(param) {
|
|
788
|
+
var _param = _sliced_to_array(param, 2), key = _param[0], value = _param[1];
|
|
789
|
+
return "".concat(key, '="').concat(value.replace(/"/g, '\\\\"'), '"');
|
|
790
|
+
}).join('\n') + '\n';
|
|
791
|
+
}
|
|
792
|
+
}
|
|
793
|
+
fs.writeFileSync(devVarsPath, devVarsContent);
|
|
794
|
+
return [
|
|
795
|
+
2
|
|
796
|
+
];
|
|
797
|
+
});
|
|
798
|
+
})();
|
|
799
|
+
}
|
|
800
|
+
},
|
|
801
|
+
{
|
|
802
|
+
key: "regenerateProjectManifest",
|
|
803
|
+
value: function regenerateProjectManifest(projectRoot, serverDir) {
|
|
804
|
+
return _async_to_generator(function() {
|
|
805
|
+
var srcDir;
|
|
806
|
+
return _ts_generator(this, function(_state) {
|
|
807
|
+
switch(_state.label){
|
|
808
|
+
case 0:
|
|
809
|
+
srcDir = path.join(serverDir, 'src');
|
|
810
|
+
return [
|
|
811
|
+
4,
|
|
812
|
+
regenerateManifestFile(projectRoot, srcDir)
|
|
813
|
+
];
|
|
814
|
+
case 1:
|
|
815
|
+
_state.sent();
|
|
816
|
+
return [
|
|
817
|
+
2
|
|
818
|
+
];
|
|
819
|
+
}
|
|
820
|
+
});
|
|
821
|
+
})();
|
|
822
|
+
}
|
|
823
|
+
},
|
|
824
|
+
{
|
|
825
|
+
key: "updateWranglerConfiguration",
|
|
826
|
+
value: function updateWranglerConfiguration(projectRoot, serverDir) {
|
|
827
|
+
return _async_to_generator(function() {
|
|
828
|
+
var wranglerConfigPath, parsedEnv, hasR2Credentials;
|
|
829
|
+
return _ts_generator(this, function(_state) {
|
|
830
|
+
switch(_state.label){
|
|
831
|
+
case 0:
|
|
832
|
+
wranglerConfigPath = path.join(serverDir, 'wrangler.jsonc');
|
|
833
|
+
if (!fs.existsSync(wranglerConfigPath)) {
|
|
834
|
+
return [
|
|
835
|
+
2
|
|
836
|
+
];
|
|
837
|
+
}
|
|
838
|
+
// Parse environment variables
|
|
839
|
+
parsedEnv = this.parseEnvironmentFile(projectRoot);
|
|
840
|
+
// Check R2 configuration mode
|
|
841
|
+
hasR2Credentials = this.hasCompleteR2Credentials(parsedEnv);
|
|
842
|
+
// Update wrangler config if needed
|
|
843
|
+
return [
|
|
844
|
+
4,
|
|
845
|
+
this.applyWranglerConfigUpdates(wranglerConfigPath, parsedEnv, hasR2Credentials)
|
|
846
|
+
];
|
|
847
|
+
case 1:
|
|
848
|
+
_state.sent();
|
|
849
|
+
return [
|
|
850
|
+
2
|
|
851
|
+
];
|
|
852
|
+
}
|
|
853
|
+
});
|
|
854
|
+
}).call(this);
|
|
855
|
+
}
|
|
856
|
+
},
|
|
857
|
+
{
|
|
858
|
+
key: "parseEnvironmentFile",
|
|
859
|
+
value: function parseEnvironmentFile(projectRoot) {
|
|
860
|
+
var rootEnvFilePath = path.join(projectRoot, '.env');
|
|
861
|
+
if (!fs.existsSync(rootEnvFilePath)) {
|
|
862
|
+
return {};
|
|
863
|
+
}
|
|
864
|
+
var rootEnvFileContent = fs.readFileSync(rootEnvFilePath);
|
|
865
|
+
return dotenv.parse(rootEnvFileContent);
|
|
866
|
+
}
|
|
867
|
+
},
|
|
868
|
+
{
|
|
869
|
+
key: "hasCompleteR2Credentials",
|
|
870
|
+
value: function hasCompleteR2Credentials(env) {
|
|
871
|
+
var _env_R2_ACCESS_KEY_ID, _env_R2_SECRET_ACCESS_KEY, _env_R2_ACCOUNT_ID, _env_R2_BUCKET_NAME;
|
|
872
|
+
return Boolean(((_env_R2_ACCESS_KEY_ID = env.R2_ACCESS_KEY_ID) === null || _env_R2_ACCESS_KEY_ID === void 0 ? void 0 : _env_R2_ACCESS_KEY_ID.trim()) && ((_env_R2_SECRET_ACCESS_KEY = env.R2_SECRET_ACCESS_KEY) === null || _env_R2_SECRET_ACCESS_KEY === void 0 ? void 0 : _env_R2_SECRET_ACCESS_KEY.trim()) && ((_env_R2_ACCOUNT_ID = env.R2_ACCOUNT_ID) === null || _env_R2_ACCOUNT_ID === void 0 ? void 0 : _env_R2_ACCOUNT_ID.trim()) && ((_env_R2_BUCKET_NAME = env.R2_BUCKET_NAME) === null || _env_R2_BUCKET_NAME === void 0 ? void 0 : _env_R2_BUCKET_NAME.trim()));
|
|
873
|
+
}
|
|
874
|
+
},
|
|
875
|
+
{
|
|
876
|
+
key: "applyWranglerConfigUpdates",
|
|
877
|
+
value: function applyWranglerConfigUpdates(configPath, env, hasR2Credentials) {
|
|
878
|
+
return _async_to_generator(function() {
|
|
879
|
+
var wranglerContent, wranglerConfig, configChanged, updatedContent;
|
|
880
|
+
return _ts_generator(this, function(_state) {
|
|
881
|
+
// Read and parse the wrangler config
|
|
882
|
+
wranglerContent = fs.readFileSync(configPath, 'utf-8');
|
|
883
|
+
wranglerConfig = JSON.parse(wranglerContent);
|
|
884
|
+
configChanged = false;
|
|
885
|
+
if (hasR2Credentials) {
|
|
886
|
+
configChanged = this.configureRemoteR2(wranglerConfig, env);
|
|
887
|
+
} else {
|
|
888
|
+
configChanged = this.configureLocalR2(wranglerConfig);
|
|
889
|
+
}
|
|
890
|
+
// Write back the updated configuration only if it changed
|
|
891
|
+
if (configChanged) {
|
|
892
|
+
updatedContent = JSON.stringify(wranglerConfig, null, 2);
|
|
893
|
+
fs.writeFileSync(configPath, updatedContent);
|
|
894
|
+
console.log(hasR2Credentials ? '🔗 Configured for remote R2 bindings' : '🏠 Configured for local R2 bindings');
|
|
895
|
+
}
|
|
896
|
+
return [
|
|
897
|
+
2
|
|
898
|
+
];
|
|
899
|
+
});
|
|
900
|
+
}).call(this);
|
|
901
|
+
}
|
|
902
|
+
},
|
|
903
|
+
{
|
|
904
|
+
key: "configureRemoteR2",
|
|
905
|
+
value: function configureRemoteR2(config, env) {
|
|
906
|
+
var changed = false;
|
|
907
|
+
if (config.r2_buckets && config.r2_buckets[0]) {
|
|
908
|
+
if (config.r2_buckets[0].bucket_name !== env.R2_BUCKET_NAME) {
|
|
909
|
+
config.r2_buckets[0].bucket_name = env.R2_BUCKET_NAME;
|
|
910
|
+
changed = true;
|
|
911
|
+
}
|
|
912
|
+
if (!config.r2_buckets[0].experimental_remote) {
|
|
913
|
+
config.r2_buckets[0].experimental_remote = true;
|
|
914
|
+
changed = true;
|
|
915
|
+
}
|
|
916
|
+
}
|
|
917
|
+
// Also update the vars section
|
|
918
|
+
if (config.vars && config.vars.R2_BUCKET_NAME !== env.R2_BUCKET_NAME) {
|
|
919
|
+
config.vars.R2_BUCKET_NAME = env.R2_BUCKET_NAME;
|
|
920
|
+
changed = true;
|
|
921
|
+
}
|
|
922
|
+
return changed;
|
|
923
|
+
}
|
|
924
|
+
},
|
|
925
|
+
{
|
|
926
|
+
key: "configureLocalR2",
|
|
927
|
+
value: function configureLocalR2(config) {
|
|
928
|
+
var changed = false;
|
|
929
|
+
if (config.r2_buckets && config.r2_buckets[0]) {
|
|
930
|
+
// Get project name from the wrangler config name (remove "positronic-dev-" prefix)
|
|
931
|
+
var configName = config.name || 'local-project';
|
|
932
|
+
var projectName = configName.replace(/^positronic-dev-/, '') || 'local-project';
|
|
933
|
+
if (config.r2_buckets[0].experimental_remote) {
|
|
934
|
+
delete config.r2_buckets[0].experimental_remote;
|
|
935
|
+
changed = true;
|
|
936
|
+
}
|
|
937
|
+
if (config.r2_buckets[0].bucket_name !== projectName) {
|
|
938
|
+
config.r2_buckets[0].bucket_name = projectName;
|
|
939
|
+
changed = true;
|
|
940
|
+
}
|
|
941
|
+
// Also update the vars section
|
|
942
|
+
if (config.vars && config.vars.R2_BUCKET_NAME !== projectName) {
|
|
943
|
+
config.vars.R2_BUCKET_NAME = projectName;
|
|
944
|
+
changed = true;
|
|
945
|
+
}
|
|
946
|
+
}
|
|
947
|
+
return changed;
|
|
948
|
+
}
|
|
949
|
+
},
|
|
950
|
+
{
|
|
951
|
+
key: "start",
|
|
952
|
+
value: function start(port) {
|
|
953
|
+
return _async_to_generator(function() {
|
|
954
|
+
var _this, // Capture and forward stdout
|
|
955
|
+
_wranglerProcess_stdout, // Capture and forward stderr
|
|
956
|
+
_wranglerProcess_stderr, serverDir, wranglerArgs, wranglerProcess;
|
|
957
|
+
return _ts_generator(this, function(_state) {
|
|
958
|
+
_this = this;
|
|
959
|
+
serverDir = path.join(this.projectRootDir, '.positronic');
|
|
960
|
+
// Start wrangler dev server
|
|
961
|
+
wranglerArgs = [
|
|
962
|
+
'dev',
|
|
963
|
+
'--x-remote-bindings'
|
|
964
|
+
];
|
|
965
|
+
if (port) {
|
|
966
|
+
wranglerArgs.push('--port', String(port));
|
|
967
|
+
}
|
|
968
|
+
wranglerProcess = spawn('npx', [
|
|
969
|
+
'wrangler'
|
|
970
|
+
].concat(_to_consumable_array(wranglerArgs)), {
|
|
971
|
+
cwd: serverDir,
|
|
972
|
+
stdio: [
|
|
973
|
+
'inherit',
|
|
974
|
+
'pipe',
|
|
975
|
+
'pipe'
|
|
976
|
+
]
|
|
977
|
+
});
|
|
978
|
+
(_wranglerProcess_stdout = wranglerProcess.stdout) === null || _wranglerProcess_stdout === void 0 ? void 0 : _wranglerProcess_stdout.on('data', function(data) {
|
|
979
|
+
var message = data.toString();
|
|
980
|
+
// Send to registered callbacks
|
|
981
|
+
_this.logCallbacks.forEach(function(cb) {
|
|
982
|
+
return cb(message);
|
|
983
|
+
});
|
|
984
|
+
// Always forward to console
|
|
985
|
+
process.stdout.write(data);
|
|
986
|
+
});
|
|
987
|
+
(_wranglerProcess_stderr = wranglerProcess.stderr) === null || _wranglerProcess_stderr === void 0 ? void 0 : _wranglerProcess_stderr.on('data', function(data) {
|
|
988
|
+
var message = data.toString();
|
|
989
|
+
// Parse for warnings vs errors
|
|
990
|
+
if (message.includes('WARNING') || message.includes('⚠')) {
|
|
991
|
+
_this.warningCallbacks.forEach(function(cb) {
|
|
992
|
+
return cb(message);
|
|
993
|
+
});
|
|
994
|
+
} else {
|
|
995
|
+
_this.errorCallbacks.forEach(function(cb) {
|
|
996
|
+
return cb(message);
|
|
997
|
+
});
|
|
998
|
+
}
|
|
999
|
+
// Always forward to console
|
|
1000
|
+
process.stderr.write(data);
|
|
1001
|
+
});
|
|
1002
|
+
wranglerProcess.on('error', function(err) {
|
|
1003
|
+
var errorMessage = "Failed to start Wrangler dev server: ".concat(err.message, "\n");
|
|
1004
|
+
_this.errorCallbacks.forEach(function(cb) {
|
|
1005
|
+
return cb(errorMessage);
|
|
1006
|
+
});
|
|
1007
|
+
console.error('Failed to start Wrangler dev server:', err);
|
|
1008
|
+
});
|
|
1009
|
+
return [
|
|
1010
|
+
2,
|
|
1011
|
+
new ProcessServerHandle(wranglerProcess, port)
|
|
1012
|
+
];
|
|
1013
|
+
});
|
|
1014
|
+
}).call(this);
|
|
1015
|
+
}
|
|
1016
|
+
},
|
|
1017
|
+
{
|
|
1018
|
+
key: "watch",
|
|
1019
|
+
value: function watch(filePath, event) {
|
|
1020
|
+
return _async_to_generator(function() {
|
|
1021
|
+
var projectRoot, serverDir, srcDir;
|
|
1022
|
+
return _ts_generator(this, function(_state) {
|
|
1023
|
+
switch(_state.label){
|
|
1024
|
+
case 0:
|
|
1025
|
+
projectRoot = this.projectRootDir;
|
|
1026
|
+
// Regenerate manifest when brain files change
|
|
1027
|
+
serverDir = path.join(projectRoot, '.positronic');
|
|
1028
|
+
srcDir = path.join(serverDir, 'src');
|
|
1029
|
+
console.log("Brain file ".concat(event, ": ").concat(path.relative(projectRoot, filePath)));
|
|
1030
|
+
return [
|
|
1031
|
+
4,
|
|
1032
|
+
regenerateManifestFile(projectRoot, srcDir)
|
|
1033
|
+
];
|
|
1034
|
+
case 1:
|
|
1035
|
+
_state.sent();
|
|
1036
|
+
return [
|
|
1037
|
+
2
|
|
1038
|
+
];
|
|
1039
|
+
}
|
|
1040
|
+
});
|
|
1041
|
+
}).call(this);
|
|
1042
|
+
}
|
|
1043
|
+
},
|
|
1044
|
+
{
|
|
1045
|
+
key: "deploy",
|
|
1046
|
+
value: function deploy() {
|
|
1047
|
+
return _async_to_generator(function() {
|
|
1048
|
+
var _this, projectRoot, serverDir;
|
|
1049
|
+
return _ts_generator(this, function(_state) {
|
|
1050
|
+
switch(_state.label){
|
|
1051
|
+
case 0:
|
|
1052
|
+
_this = this;
|
|
1053
|
+
projectRoot = this.projectRootDir;
|
|
1054
|
+
serverDir = path.join(projectRoot, '.positronic');
|
|
1055
|
+
// Ensure .positronic directory and manifest are up to date, but don't force regeneration
|
|
1056
|
+
return [
|
|
1057
|
+
4,
|
|
1058
|
+
this.setup()
|
|
1059
|
+
];
|
|
1060
|
+
case 1:
|
|
1061
|
+
_state.sent();
|
|
1062
|
+
// Check for required Cloudflare credentials in environment variables
|
|
1063
|
+
if (!process.env.CLOUDFLARE_API_TOKEN || !process.env.CLOUDFLARE_ACCOUNT_ID) {
|
|
1064
|
+
throw new Error('Missing required Cloudflare credentials.\n' + 'Please set CLOUDFLARE_API_TOKEN and CLOUDFLARE_ACCOUNT_ID environment variables.\n' + 'For example:\n' + ' export CLOUDFLARE_API_TOKEN=your-api-token\n' + ' export CLOUDFLARE_ACCOUNT_ID=your-account-id');
|
|
1065
|
+
}
|
|
1066
|
+
console.log('🚀 Deploying to Cloudflare Workers (production)...');
|
|
1067
|
+
// Deploy to production using wrangler
|
|
1068
|
+
return [
|
|
1069
|
+
2,
|
|
1070
|
+
new Promise(function(resolve, reject) {
|
|
1071
|
+
var // Capture and forward stdout
|
|
1072
|
+
_wranglerProcess_stdout, // Capture and forward stderr
|
|
1073
|
+
_wranglerProcess_stderr;
|
|
1074
|
+
var wranglerProcess = spawn('npx', [
|
|
1075
|
+
'wrangler',
|
|
1076
|
+
'deploy',
|
|
1077
|
+
'--env',
|
|
1078
|
+
'production'
|
|
1079
|
+
], {
|
|
1080
|
+
cwd: serverDir,
|
|
1081
|
+
stdio: [
|
|
1082
|
+
'inherit',
|
|
1083
|
+
'pipe',
|
|
1084
|
+
'pipe'
|
|
1085
|
+
],
|
|
1086
|
+
env: _object_spread_props(_object_spread({}, process.env), {
|
|
1087
|
+
CLOUDFLARE_API_TOKEN: process.env.CLOUDFLARE_API_TOKEN,
|
|
1088
|
+
CLOUDFLARE_ACCOUNT_ID: process.env.CLOUDFLARE_ACCOUNT_ID
|
|
1089
|
+
})
|
|
1090
|
+
});
|
|
1091
|
+
(_wranglerProcess_stdout = wranglerProcess.stdout) === null || _wranglerProcess_stdout === void 0 ? void 0 : _wranglerProcess_stdout.on('data', function(data) {
|
|
1092
|
+
var message = data.toString();
|
|
1093
|
+
_this.logCallbacks.forEach(function(cb) {
|
|
1094
|
+
return cb(message);
|
|
1095
|
+
});
|
|
1096
|
+
process.stdout.write(data);
|
|
1097
|
+
});
|
|
1098
|
+
(_wranglerProcess_stderr = wranglerProcess.stderr) === null || _wranglerProcess_stderr === void 0 ? void 0 : _wranglerProcess_stderr.on('data', function(data) {
|
|
1099
|
+
var message = data.toString();
|
|
1100
|
+
if (message.includes('WARNING') || message.includes('⚠')) {
|
|
1101
|
+
_this.warningCallbacks.forEach(function(cb) {
|
|
1102
|
+
return cb(message);
|
|
1103
|
+
});
|
|
1104
|
+
} else {
|
|
1105
|
+
_this.errorCallbacks.forEach(function(cb) {
|
|
1106
|
+
return cb(message);
|
|
1107
|
+
});
|
|
1108
|
+
}
|
|
1109
|
+
process.stderr.write(data);
|
|
1110
|
+
});
|
|
1111
|
+
wranglerProcess.on('error', function(err) {
|
|
1112
|
+
var errorMessage = "Failed to start Wrangler deploy: ".concat(err.message, "\n");
|
|
1113
|
+
_this.errorCallbacks.forEach(function(cb) {
|
|
1114
|
+
return cb(errorMessage);
|
|
1115
|
+
});
|
|
1116
|
+
console.error('Failed to start Wrangler deploy:', err);
|
|
1117
|
+
reject(err);
|
|
1118
|
+
});
|
|
1119
|
+
wranglerProcess.on('exit', function(code) {
|
|
1120
|
+
if (code === 0) {
|
|
1121
|
+
var successMessage = '✅ Deployment complete!\n';
|
|
1122
|
+
_this.logCallbacks.forEach(function(cb) {
|
|
1123
|
+
return cb(successMessage);
|
|
1124
|
+
});
|
|
1125
|
+
console.log('✅ Deployment complete!');
|
|
1126
|
+
resolve();
|
|
1127
|
+
} else {
|
|
1128
|
+
reject(new Error("Wrangler deploy exited with code ".concat(code)));
|
|
1129
|
+
}
|
|
1130
|
+
});
|
|
1131
|
+
})
|
|
1132
|
+
];
|
|
1133
|
+
}
|
|
1134
|
+
});
|
|
1135
|
+
}).call(this);
|
|
1136
|
+
}
|
|
1137
|
+
},
|
|
1138
|
+
{
|
|
1139
|
+
key: "onLog",
|
|
1140
|
+
value: function onLog(callback) {
|
|
1141
|
+
this.logCallbacks.push(callback);
|
|
1142
|
+
}
|
|
1143
|
+
},
|
|
1144
|
+
{
|
|
1145
|
+
key: "onError",
|
|
1146
|
+
value: function onError(callback) {
|
|
1147
|
+
this.errorCallbacks.push(callback);
|
|
1148
|
+
}
|
|
1149
|
+
},
|
|
1150
|
+
{
|
|
1151
|
+
key: "onWarning",
|
|
1152
|
+
value: function onWarning(callback) {
|
|
1153
|
+
this.warningCallbacks.push(callback);
|
|
1154
|
+
}
|
|
1155
|
+
},
|
|
1156
|
+
{
|
|
1157
|
+
key: "listSecrets",
|
|
1158
|
+
value: function listSecrets() {
|
|
1159
|
+
return _async_to_generator(function() {
|
|
1160
|
+
var serverDir;
|
|
1161
|
+
return _ts_generator(this, function(_state) {
|
|
1162
|
+
serverDir = path.join(this.projectRootDir, '.positronic');
|
|
1163
|
+
// Get auth from environment variables
|
|
1164
|
+
if (!process.env.CLOUDFLARE_API_TOKEN || !process.env.CLOUDFLARE_ACCOUNT_ID) {
|
|
1165
|
+
throw new Error('Missing Cloudflare credentials. Please set CLOUDFLARE_API_TOKEN and CLOUDFLARE_ACCOUNT_ID environment variables.');
|
|
1166
|
+
}
|
|
1167
|
+
return [
|
|
1168
|
+
2,
|
|
1169
|
+
new Promise(function(resolve, reject) {
|
|
1170
|
+
var child = spawn('npx', [
|
|
1171
|
+
'wrangler',
|
|
1172
|
+
'secret',
|
|
1173
|
+
'list'
|
|
1174
|
+
], {
|
|
1175
|
+
cwd: serverDir,
|
|
1176
|
+
env: _object_spread_props(_object_spread({}, process.env), {
|
|
1177
|
+
CLOUDFLARE_API_TOKEN: process.env.CLOUDFLARE_API_TOKEN,
|
|
1178
|
+
CLOUDFLARE_ACCOUNT_ID: process.env.CLOUDFLARE_ACCOUNT_ID
|
|
1179
|
+
}),
|
|
1180
|
+
stdio: 'inherit'
|
|
1181
|
+
});
|
|
1182
|
+
child.on('close', function(code) {
|
|
1183
|
+
if (code !== 0) {
|
|
1184
|
+
// Don't wrap the error - backend CLI already printed it
|
|
1185
|
+
reject(new Error(''));
|
|
1186
|
+
} else {
|
|
1187
|
+
// Return empty array - output was already printed
|
|
1188
|
+
resolve([]);
|
|
1189
|
+
}
|
|
1190
|
+
});
|
|
1191
|
+
child.on('error', function(err) {
|
|
1192
|
+
reject(err);
|
|
1193
|
+
});
|
|
1194
|
+
})
|
|
1195
|
+
];
|
|
1196
|
+
});
|
|
1197
|
+
}).call(this);
|
|
1198
|
+
}
|
|
1199
|
+
},
|
|
1200
|
+
{
|
|
1201
|
+
key: "setSecret",
|
|
1202
|
+
value: function setSecret(name, value) {
|
|
1203
|
+
return _async_to_generator(function() {
|
|
1204
|
+
var serverDir;
|
|
1205
|
+
return _ts_generator(this, function(_state) {
|
|
1206
|
+
serverDir = path.join(this.projectRootDir, '.positronic');
|
|
1207
|
+
// Get auth from environment variables
|
|
1208
|
+
if (!process.env.CLOUDFLARE_API_TOKEN || !process.env.CLOUDFLARE_ACCOUNT_ID) {
|
|
1209
|
+
throw new Error('Missing Cloudflare credentials. Please set CLOUDFLARE_API_TOKEN and CLOUDFLARE_ACCOUNT_ID environment variables.');
|
|
1210
|
+
}
|
|
1211
|
+
return [
|
|
1212
|
+
2,
|
|
1213
|
+
new Promise(function(resolve, reject) {
|
|
1214
|
+
var child = spawn('npx', [
|
|
1215
|
+
'wrangler',
|
|
1216
|
+
'secret',
|
|
1217
|
+
'put',
|
|
1218
|
+
name
|
|
1219
|
+
], {
|
|
1220
|
+
cwd: serverDir,
|
|
1221
|
+
env: _object_spread_props(_object_spread({}, process.env), {
|
|
1222
|
+
CLOUDFLARE_API_TOKEN: process.env.CLOUDFLARE_API_TOKEN,
|
|
1223
|
+
CLOUDFLARE_ACCOUNT_ID: process.env.CLOUDFLARE_ACCOUNT_ID
|
|
1224
|
+
}),
|
|
1225
|
+
stdio: [
|
|
1226
|
+
'pipe',
|
|
1227
|
+
'inherit',
|
|
1228
|
+
'inherit'
|
|
1229
|
+
]
|
|
1230
|
+
});
|
|
1231
|
+
child.stdin.write(value);
|
|
1232
|
+
child.stdin.end();
|
|
1233
|
+
child.on('close', function(code) {
|
|
1234
|
+
if (code !== 0) {
|
|
1235
|
+
// Don't wrap the error - backend CLI already printed it
|
|
1236
|
+
reject(new Error(''));
|
|
1237
|
+
} else {
|
|
1238
|
+
resolve();
|
|
1239
|
+
}
|
|
1240
|
+
});
|
|
1241
|
+
child.on('error', function(err) {
|
|
1242
|
+
reject(err);
|
|
1243
|
+
});
|
|
1244
|
+
})
|
|
1245
|
+
];
|
|
1246
|
+
});
|
|
1247
|
+
}).call(this);
|
|
1248
|
+
}
|
|
1249
|
+
},
|
|
1250
|
+
{
|
|
1251
|
+
key: "deleteSecret",
|
|
1252
|
+
value: function deleteSecret(name) {
|
|
1253
|
+
return _async_to_generator(function() {
|
|
1254
|
+
var serverDir;
|
|
1255
|
+
return _ts_generator(this, function(_state) {
|
|
1256
|
+
serverDir = path.join(this.projectRootDir, '.positronic');
|
|
1257
|
+
// Get auth from environment variables
|
|
1258
|
+
if (!process.env.CLOUDFLARE_API_TOKEN || !process.env.CLOUDFLARE_ACCOUNT_ID) {
|
|
1259
|
+
throw new Error('Missing Cloudflare credentials. Please set CLOUDFLARE_API_TOKEN and CLOUDFLARE_ACCOUNT_ID environment variables.');
|
|
1260
|
+
}
|
|
1261
|
+
return [
|
|
1262
|
+
2,
|
|
1263
|
+
new Promise(function(resolve, reject) {
|
|
1264
|
+
var child = spawn('npx', [
|
|
1265
|
+
'wrangler',
|
|
1266
|
+
'secret',
|
|
1267
|
+
'delete',
|
|
1268
|
+
name
|
|
1269
|
+
], {
|
|
1270
|
+
cwd: serverDir,
|
|
1271
|
+
env: _object_spread_props(_object_spread({}, process.env), {
|
|
1272
|
+
CLOUDFLARE_API_TOKEN: process.env.CLOUDFLARE_API_TOKEN,
|
|
1273
|
+
CLOUDFLARE_ACCOUNT_ID: process.env.CLOUDFLARE_ACCOUNT_ID
|
|
1274
|
+
}),
|
|
1275
|
+
stdio: 'inherit'
|
|
1276
|
+
});
|
|
1277
|
+
child.on('close', function(code) {
|
|
1278
|
+
if (code !== 0) {
|
|
1279
|
+
// Don't wrap the error - backend CLI already printed it
|
|
1280
|
+
reject(new Error(''));
|
|
1281
|
+
} else {
|
|
1282
|
+
resolve(true);
|
|
1283
|
+
}
|
|
1284
|
+
});
|
|
1285
|
+
child.on('error', function(err) {
|
|
1286
|
+
reject(err);
|
|
1287
|
+
});
|
|
1288
|
+
})
|
|
1289
|
+
];
|
|
1290
|
+
});
|
|
1291
|
+
}).call(this);
|
|
1292
|
+
}
|
|
1293
|
+
},
|
|
1294
|
+
{
|
|
1295
|
+
key: "bulkSecrets",
|
|
1296
|
+
value: function bulkSecrets(filePath) {
|
|
1297
|
+
return _async_to_generator(function() {
|
|
1298
|
+
var serverDir, envContent, secrets, jsonContent;
|
|
1299
|
+
return _ts_generator(this, function(_state) {
|
|
1300
|
+
serverDir = path.join(this.projectRootDir, '.positronic');
|
|
1301
|
+
// Check auth credentials
|
|
1302
|
+
if (!process.env.CLOUDFLARE_API_TOKEN || !process.env.CLOUDFLARE_ACCOUNT_ID) {
|
|
1303
|
+
throw new Error('Missing Cloudflare credentials. Please set CLOUDFLARE_API_TOKEN and CLOUDFLARE_ACCOUNT_ID environment variables.');
|
|
1304
|
+
}
|
|
1305
|
+
// Read and parse the .env file
|
|
1306
|
+
if (!fs.existsSync(filePath)) {
|
|
1307
|
+
throw new Error("File not found: ".concat(filePath));
|
|
1308
|
+
}
|
|
1309
|
+
envContent = fs.readFileSync(filePath, 'utf8');
|
|
1310
|
+
secrets = dotenv.parse(envContent);
|
|
1311
|
+
if (Object.keys(secrets).length === 0) {
|
|
1312
|
+
throw new Error('No secrets found in the .env file');
|
|
1313
|
+
}
|
|
1314
|
+
// Convert to JSON format that wrangler expects
|
|
1315
|
+
jsonContent = JSON.stringify(secrets);
|
|
1316
|
+
return [
|
|
1317
|
+
2,
|
|
1318
|
+
new Promise(function(resolve, reject) {
|
|
1319
|
+
// Use wrangler secret:bulk command
|
|
1320
|
+
var child = spawn('npx', [
|
|
1321
|
+
'wrangler',
|
|
1322
|
+
'secret:bulk'
|
|
1323
|
+
], {
|
|
1324
|
+
cwd: serverDir,
|
|
1325
|
+
env: _object_spread_props(_object_spread({}, process.env), {
|
|
1326
|
+
CLOUDFLARE_API_TOKEN: process.env.CLOUDFLARE_API_TOKEN,
|
|
1327
|
+
CLOUDFLARE_ACCOUNT_ID: process.env.CLOUDFLARE_ACCOUNT_ID
|
|
1328
|
+
}),
|
|
1329
|
+
stdio: [
|
|
1330
|
+
'pipe',
|
|
1331
|
+
'inherit',
|
|
1332
|
+
'inherit'
|
|
1333
|
+
]
|
|
1334
|
+
});
|
|
1335
|
+
// Write JSON to stdin
|
|
1336
|
+
child.stdin.write(jsonContent);
|
|
1337
|
+
child.stdin.end();
|
|
1338
|
+
child.on('close', function(code) {
|
|
1339
|
+
if (code !== 0) {
|
|
1340
|
+
// Don't wrap the error - backend CLI already printed it
|
|
1341
|
+
reject(new Error(''));
|
|
1342
|
+
} else {
|
|
1343
|
+
resolve();
|
|
1344
|
+
}
|
|
1345
|
+
});
|
|
1346
|
+
child.on('error', function(err) {
|
|
1347
|
+
reject(err);
|
|
1348
|
+
});
|
|
1349
|
+
})
|
|
1350
|
+
];
|
|
1351
|
+
});
|
|
1352
|
+
}).call(this);
|
|
1353
|
+
}
|
|
1354
|
+
}
|
|
1355
|
+
]);
|
|
1356
|
+
return CloudflareDevServer;
|
|
1357
|
+
}();
|