@cedarjs/api-server 1.0.1-next.0 → 1.1.0-rc.33
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/cjs/watch.d.ts +6 -1
- package/dist/cjs/watch.d.ts.map +1 -1
- package/dist/cjs/watch.js +70 -49
- package/dist/watch.d.ts +6 -1
- package/dist/watch.d.ts.map +1 -1
- package/dist/watch.js +62 -50
- package/package.json +19 -9
package/dist/cjs/watch.d.ts
CHANGED
package/dist/cjs/watch.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"watch.d.ts","sourceRoot":"","sources":["../../src/watch.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"watch.d.ts","sourceRoot":"","sources":["../../src/watch.ts"],"names":[],"mappings":"AAuEA;;;;GAIG;AACH,wBAAsB,UAAU,kBA6E/B"}
|
package/dist/cjs/watch.js
CHANGED
|
@@ -6,6 +6,10 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
6
6
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
7
|
var __getProtoOf = Object.getPrototypeOf;
|
|
8
8
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
+
var __export = (target, all) => {
|
|
10
|
+
for (var name in all)
|
|
11
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
12
|
+
};
|
|
9
13
|
var __copyProps = (to, from, except, desc) => {
|
|
10
14
|
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
15
|
for (let key of __getOwnPropNames(from))
|
|
@@ -22,8 +26,14 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
22
26
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
23
27
|
mod
|
|
24
28
|
));
|
|
29
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
25
30
|
|
|
26
31
|
// src/watch.ts
|
|
32
|
+
var watch_exports = {};
|
|
33
|
+
__export(watch_exports, {
|
|
34
|
+
startWatch: () => startWatch
|
|
35
|
+
});
|
|
36
|
+
module.exports = __toCommonJS(watch_exports);
|
|
27
37
|
var import_path2 = __toESM(require("path"), 1);
|
|
28
38
|
var import_ansis2 = __toESM(require("ansis"), 1);
|
|
29
39
|
var import_chokidar = __toESM(require("chokidar"), 1);
|
|
@@ -202,11 +212,11 @@ var ServerManager = class {
|
|
|
202
212
|
var serverManager = new ServerManager();
|
|
203
213
|
|
|
204
214
|
// src/watch.ts
|
|
205
|
-
var
|
|
215
|
+
var cedarPaths = (0, import_project_config2.getPaths)();
|
|
206
216
|
if (!process.env.REDWOOD_ENV_FILES_LOADED) {
|
|
207
217
|
(0, import_dotenv_defaults.config)({
|
|
208
|
-
path: import_path2.default.join(
|
|
209
|
-
defaults: import_path2.default.join(
|
|
218
|
+
path: import_path2.default.join(cedarPaths.base, ".env"),
|
|
219
|
+
defaults: import_path2.default.join(cedarPaths.base, ".env.defaults"),
|
|
210
220
|
multiline: true
|
|
211
221
|
});
|
|
212
222
|
process.env.REDWOOD_ENV_FILES_LOADED = "true";
|
|
@@ -241,52 +251,63 @@ async function validateSdls() {
|
|
|
241
251
|
return false;
|
|
242
252
|
}
|
|
243
253
|
}
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
})
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
254
|
+
async function startWatch() {
|
|
255
|
+
const ignoredApiPaths = [
|
|
256
|
+
// use this, because using cedarPaths.api.dist seems to not ignore on first
|
|
257
|
+
// build
|
|
258
|
+
"api/dist",
|
|
259
|
+
cedarPaths.api.types,
|
|
260
|
+
cedarPaths.api.db
|
|
261
|
+
].map((path3) => (0, import_project_config2.ensurePosixPath)(path3));
|
|
262
|
+
const ignoredExtensions = [
|
|
263
|
+
".DS_Store",
|
|
264
|
+
".db",
|
|
265
|
+
".sqlite",
|
|
266
|
+
"-journal",
|
|
267
|
+
".test.js",
|
|
268
|
+
".test.ts",
|
|
269
|
+
".scenarios.ts",
|
|
270
|
+
".scenarios.js",
|
|
271
|
+
".d.ts",
|
|
272
|
+
".log"
|
|
273
|
+
];
|
|
274
|
+
const watcher = import_chokidar.default.watch([cedarPaths.api.src], {
|
|
275
|
+
persistent: true,
|
|
276
|
+
ignoreInitial: true,
|
|
277
|
+
ignored: (file) => {
|
|
278
|
+
const shouldIgnore = file.includes("node_modules") || ignoredApiPaths.some((ignoredPath) => file.includes(ignoredPath)) || ignoredExtensions.some((ext) => file.endsWith(ext));
|
|
279
|
+
return shouldIgnore;
|
|
280
|
+
}
|
|
281
|
+
});
|
|
282
|
+
watcher.on("ready", async () => {
|
|
283
|
+
await buildManager.run({ clean: true, rebuild: false });
|
|
284
|
+
await validateSdls();
|
|
285
|
+
});
|
|
286
|
+
watcher.on("all", async (eventName, filePath) => {
|
|
287
|
+
if (eventName === "addDir" && filePath === cedarPaths.api.base) {
|
|
288
|
+
return;
|
|
289
|
+
}
|
|
290
|
+
if (eventName) {
|
|
291
|
+
if (filePath.includes(".sdl")) {
|
|
292
|
+
const isValid = await validateSdls();
|
|
293
|
+
if (!isValid) {
|
|
294
|
+
return;
|
|
295
|
+
}
|
|
280
296
|
}
|
|
281
297
|
}
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
}
|
|
298
|
+
console.log(
|
|
299
|
+
import_ansis2.default.dim(`[${eventName}] ${filePath.replace(cedarPaths.api.base, "")}`)
|
|
300
|
+
);
|
|
301
|
+
buildManager.cancelScheduledBuild();
|
|
302
|
+
if (eventName === "add" || eventName === "unlink") {
|
|
303
|
+
await buildManager.run({ rebuild: false });
|
|
304
|
+
} else {
|
|
305
|
+
await buildManager.run({ rebuild: true });
|
|
306
|
+
}
|
|
307
|
+
});
|
|
308
|
+
}
|
|
309
|
+
startWatch();
|
|
310
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
311
|
+
0 && (module.exports = {
|
|
312
|
+
startWatch
|
|
292
313
|
});
|
package/dist/watch.d.ts
CHANGED
package/dist/watch.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"watch.d.ts","sourceRoot":"","sources":["../src/watch.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"watch.d.ts","sourceRoot":"","sources":["../src/watch.ts"],"names":[],"mappings":"AAuEA;;;;GAIG;AACH,wBAAsB,UAAU,kBA6E/B"}
|
package/dist/watch.js
CHANGED
|
@@ -183,11 +183,11 @@ var ServerManager = class {
|
|
|
183
183
|
var serverManager = new ServerManager();
|
|
184
184
|
|
|
185
185
|
// src/watch.ts
|
|
186
|
-
var
|
|
186
|
+
var cedarPaths = getPaths2();
|
|
187
187
|
if (!process.env.REDWOOD_ENV_FILES_LOADED) {
|
|
188
188
|
config({
|
|
189
|
-
path: path2.join(
|
|
190
|
-
defaults: path2.join(
|
|
189
|
+
path: path2.join(cedarPaths.base, ".env"),
|
|
190
|
+
defaults: path2.join(cedarPaths.base, ".env.defaults"),
|
|
191
191
|
multiline: true
|
|
192
192
|
});
|
|
193
193
|
process.env.REDWOOD_ENV_FILES_LOADED = "true";
|
|
@@ -222,52 +222,64 @@ async function validateSdls() {
|
|
|
222
222
|
return false;
|
|
223
223
|
}
|
|
224
224
|
}
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
})
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
225
|
+
async function startWatch() {
|
|
226
|
+
const ignoredApiPaths = [
|
|
227
|
+
// use this, because using cedarPaths.api.dist seems to not ignore on first
|
|
228
|
+
// build
|
|
229
|
+
"api/dist",
|
|
230
|
+
cedarPaths.api.types,
|
|
231
|
+
cedarPaths.api.db
|
|
232
|
+
].map((path3) => ensurePosixPath(path3));
|
|
233
|
+
const ignoredExtensions = [
|
|
234
|
+
".DS_Store",
|
|
235
|
+
".db",
|
|
236
|
+
".sqlite",
|
|
237
|
+
"-journal",
|
|
238
|
+
".test.js",
|
|
239
|
+
".test.ts",
|
|
240
|
+
".scenarios.ts",
|
|
241
|
+
".scenarios.js",
|
|
242
|
+
".d.ts",
|
|
243
|
+
".log"
|
|
244
|
+
];
|
|
245
|
+
const watcher = chokidar.watch([cedarPaths.api.src], {
|
|
246
|
+
persistent: true,
|
|
247
|
+
ignoreInitial: true,
|
|
248
|
+
ignored: (file) => {
|
|
249
|
+
const shouldIgnore = file.includes("node_modules") || ignoredApiPaths.some((ignoredPath) => file.includes(ignoredPath)) || ignoredExtensions.some((ext) => file.endsWith(ext));
|
|
250
|
+
return shouldIgnore;
|
|
251
|
+
}
|
|
252
|
+
});
|
|
253
|
+
watcher.on("ready", async () => {
|
|
254
|
+
await buildManager.run({ clean: true, rebuild: false });
|
|
255
|
+
await validateSdls();
|
|
256
|
+
});
|
|
257
|
+
watcher.on("all", async (eventName, filePath) => {
|
|
258
|
+
if (eventName === "addDir" && filePath === cedarPaths.api.base) {
|
|
259
|
+
return;
|
|
260
|
+
}
|
|
261
|
+
if (eventName) {
|
|
262
|
+
if (filePath.includes(".sdl")) {
|
|
263
|
+
const isValid = await validateSdls();
|
|
264
|
+
if (!isValid) {
|
|
265
|
+
return;
|
|
266
|
+
}
|
|
261
267
|
}
|
|
262
268
|
}
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
}
|
|
273
|
-
}
|
|
269
|
+
console.log(
|
|
270
|
+
ansis2.dim(`[${eventName}] ${filePath.replace(cedarPaths.api.base, "")}`)
|
|
271
|
+
);
|
|
272
|
+
buildManager.cancelScheduledBuild();
|
|
273
|
+
if (eventName === "add" || eventName === "unlink") {
|
|
274
|
+
await buildManager.run({ rebuild: false });
|
|
275
|
+
} else {
|
|
276
|
+
await buildManager.run({ rebuild: true });
|
|
277
|
+
}
|
|
278
|
+
});
|
|
279
|
+
}
|
|
280
|
+
if (import.meta.url === `file://${process.argv[1]}`) {
|
|
281
|
+
startWatch();
|
|
282
|
+
}
|
|
283
|
+
export {
|
|
284
|
+
startWatch
|
|
285
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cedarjs/api-server",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.1.0-rc.33",
|
|
4
4
|
"description": "CedarJS's HTTP server for Serverless Functions",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -68,6 +68,16 @@
|
|
|
68
68
|
"./cjs/cliHelpers": {
|
|
69
69
|
"types": "./dist/cjs/cliHelpers.d.ts",
|
|
70
70
|
"default": "./dist/cjs/cliHelpers.js"
|
|
71
|
+
},
|
|
72
|
+
"./watch": {
|
|
73
|
+
"import": {
|
|
74
|
+
"types": "./dist/watch.d.ts",
|
|
75
|
+
"default": "./dist/watch.js"
|
|
76
|
+
},
|
|
77
|
+
"require": {
|
|
78
|
+
"types": "./dist/cjs/watch.d.ts",
|
|
79
|
+
"default": "./dist/cjs/watch.js"
|
|
80
|
+
}
|
|
71
81
|
}
|
|
72
82
|
},
|
|
73
83
|
"main": "./dist/createServer.js",
|
|
@@ -97,11 +107,11 @@
|
|
|
97
107
|
"test:watch": "vitest watch"
|
|
98
108
|
},
|
|
99
109
|
"dependencies": {
|
|
100
|
-
"@cedarjs/context": "1.0
|
|
101
|
-
"@cedarjs/fastify-web": "1.0
|
|
102
|
-
"@cedarjs/internal": "1.0
|
|
103
|
-
"@cedarjs/project-config": "1.0
|
|
104
|
-
"@cedarjs/web-server": "1.0
|
|
110
|
+
"@cedarjs/context": "1.1.0-rc.33",
|
|
111
|
+
"@cedarjs/fastify-web": "1.1.0-rc.33",
|
|
112
|
+
"@cedarjs/internal": "1.1.0-rc.33",
|
|
113
|
+
"@cedarjs/project-config": "1.1.0-rc.33",
|
|
114
|
+
"@cedarjs/web-server": "1.1.0-rc.33",
|
|
105
115
|
"@fastify/multipart": "8.3.1",
|
|
106
116
|
"@fastify/url-data": "5.4.0",
|
|
107
117
|
"ansis": "4.1.0",
|
|
@@ -118,7 +128,7 @@
|
|
|
118
128
|
"yargs": "17.7.2"
|
|
119
129
|
},
|
|
120
130
|
"devDependencies": {
|
|
121
|
-
"@cedarjs/framework-tools": "1.0.
|
|
131
|
+
"@cedarjs/framework-tools": "1.1.0-rc.33",
|
|
122
132
|
"@types/aws-lambda": "8.10.152",
|
|
123
133
|
"@types/dotenv-defaults": "^2.0.4",
|
|
124
134
|
"@types/qs": "6.9.16",
|
|
@@ -130,7 +140,7 @@
|
|
|
130
140
|
"vitest": "3.2.4"
|
|
131
141
|
},
|
|
132
142
|
"peerDependencies": {
|
|
133
|
-
"@cedarjs/graphql-server": "1.0.
|
|
143
|
+
"@cedarjs/graphql-server": "1.1.0-rc.33"
|
|
134
144
|
},
|
|
135
145
|
"peerDependenciesMeta": {
|
|
136
146
|
"@cedarjs/graphql-server": {
|
|
@@ -140,5 +150,5 @@
|
|
|
140
150
|
"publishConfig": {
|
|
141
151
|
"access": "public"
|
|
142
152
|
},
|
|
143
|
-
"gitHead": "
|
|
153
|
+
"gitHead": "86cce410c6f5611663ebcdb11df912f35d0b17fb"
|
|
144
154
|
}
|