@cedarjs/api-server 1.0.0-canary.12775 → 1.0.0-canary.12777
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 +64 -45
- package/dist/watch.d.ts +6 -1
- package/dist/watch.d.ts.map +1 -1
- package/dist/watch.js +56 -46
- 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":"AAgFA;;;;GAIG;AACH,wBAAgB,UAAU,SAiEzB"}
|
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";
|
|
@@ -244,49 +254,58 @@ async function validateSdls() {
|
|
|
244
254
|
var IGNORED_API_PATHS = [
|
|
245
255
|
"api/dist",
|
|
246
256
|
// use this, because using rwjsPaths.api.dist seems to not ignore on first build
|
|
247
|
-
|
|
248
|
-
|
|
257
|
+
cedarPaths.api.types,
|
|
258
|
+
cedarPaths.api.db
|
|
249
259
|
].map((path3) => (0, import_project_config2.ensurePosixPath)(path3));
|
|
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
|
-
|
|
260
|
+
function startWatch() {
|
|
261
|
+
const watcher = import_chokidar.default.watch([cedarPaths.api.src], {
|
|
262
|
+
persistent: true,
|
|
263
|
+
ignoreInitial: true,
|
|
264
|
+
ignored: (file) => {
|
|
265
|
+
const x = file.includes("node_modules") || IGNORED_API_PATHS.some((ignoredPath) => file.includes(ignoredPath)) || [
|
|
266
|
+
".DS_Store",
|
|
267
|
+
".db",
|
|
268
|
+
".sqlite",
|
|
269
|
+
"-journal",
|
|
270
|
+
".test.js",
|
|
271
|
+
".test.ts",
|
|
272
|
+
".scenarios.ts",
|
|
273
|
+
".scenarios.js",
|
|
274
|
+
".d.ts",
|
|
275
|
+
".log"
|
|
276
|
+
].some((ext) => file.endsWith(ext));
|
|
277
|
+
return x;
|
|
278
|
+
}
|
|
279
|
+
});
|
|
280
|
+
watcher.on("ready", async () => {
|
|
281
|
+
await buildManager.run({ clean: true, rebuild: false });
|
|
282
|
+
await validateSdls();
|
|
283
|
+
});
|
|
284
|
+
watcher.on("all", async (eventName, filePath) => {
|
|
285
|
+
if (eventName === "addDir" && filePath === cedarPaths.api.base) {
|
|
286
|
+
return;
|
|
287
|
+
}
|
|
288
|
+
if (eventName) {
|
|
289
|
+
if (filePath.includes(".sdl")) {
|
|
290
|
+
const isValid = await validateSdls();
|
|
291
|
+
if (!isValid) {
|
|
292
|
+
return;
|
|
293
|
+
}
|
|
280
294
|
}
|
|
281
295
|
}
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
}
|
|
296
|
+
console.log(
|
|
297
|
+
import_ansis2.default.dim(`[${eventName}] ${filePath.replace(cedarPaths.api.base, "")}`)
|
|
298
|
+
);
|
|
299
|
+
buildManager.cancelScheduledBuild();
|
|
300
|
+
if (eventName === "add" || eventName === "unlink") {
|
|
301
|
+
await buildManager.run({ rebuild: false });
|
|
302
|
+
} else {
|
|
303
|
+
await buildManager.run({ rebuild: true });
|
|
304
|
+
}
|
|
305
|
+
});
|
|
306
|
+
}
|
|
307
|
+
startWatch();
|
|
308
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
309
|
+
0 && (module.exports = {
|
|
310
|
+
startWatch
|
|
292
311
|
});
|
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":"AAgFA;;;;GAIG;AACH,wBAAgB,UAAU,SAiEzB"}
|
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";
|
|
@@ -225,49 +225,59 @@ async function validateSdls() {
|
|
|
225
225
|
var IGNORED_API_PATHS = [
|
|
226
226
|
"api/dist",
|
|
227
227
|
// use this, because using rwjsPaths.api.dist seems to not ignore on first build
|
|
228
|
-
|
|
229
|
-
|
|
228
|
+
cedarPaths.api.types,
|
|
229
|
+
cedarPaths.api.db
|
|
230
230
|
].map((path3) => ensurePosixPath(path3));
|
|
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
|
-
|
|
231
|
+
function startWatch() {
|
|
232
|
+
const watcher = chokidar.watch([cedarPaths.api.src], {
|
|
233
|
+
persistent: true,
|
|
234
|
+
ignoreInitial: true,
|
|
235
|
+
ignored: (file) => {
|
|
236
|
+
const x = file.includes("node_modules") || IGNORED_API_PATHS.some((ignoredPath) => file.includes(ignoredPath)) || [
|
|
237
|
+
".DS_Store",
|
|
238
|
+
".db",
|
|
239
|
+
".sqlite",
|
|
240
|
+
"-journal",
|
|
241
|
+
".test.js",
|
|
242
|
+
".test.ts",
|
|
243
|
+
".scenarios.ts",
|
|
244
|
+
".scenarios.js",
|
|
245
|
+
".d.ts",
|
|
246
|
+
".log"
|
|
247
|
+
].some((ext) => file.endsWith(ext));
|
|
248
|
+
return x;
|
|
249
|
+
}
|
|
250
|
+
});
|
|
251
|
+
watcher.on("ready", async () => {
|
|
252
|
+
await buildManager.run({ clean: true, rebuild: false });
|
|
253
|
+
await validateSdls();
|
|
254
|
+
});
|
|
255
|
+
watcher.on("all", async (eventName, filePath) => {
|
|
256
|
+
if (eventName === "addDir" && filePath === cedarPaths.api.base) {
|
|
257
|
+
return;
|
|
258
|
+
}
|
|
259
|
+
if (eventName) {
|
|
260
|
+
if (filePath.includes(".sdl")) {
|
|
261
|
+
const isValid = await validateSdls();
|
|
262
|
+
if (!isValid) {
|
|
263
|
+
return;
|
|
264
|
+
}
|
|
261
265
|
}
|
|
262
266
|
}
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
}
|
|
273
|
-
}
|
|
267
|
+
console.log(
|
|
268
|
+
ansis2.dim(`[${eventName}] ${filePath.replace(cedarPaths.api.base, "")}`)
|
|
269
|
+
);
|
|
270
|
+
buildManager.cancelScheduledBuild();
|
|
271
|
+
if (eventName === "add" || eventName === "unlink") {
|
|
272
|
+
await buildManager.run({ rebuild: false });
|
|
273
|
+
} else {
|
|
274
|
+
await buildManager.run({ rebuild: true });
|
|
275
|
+
}
|
|
276
|
+
});
|
|
277
|
+
}
|
|
278
|
+
if (import.meta.url === `file://${process.argv[1]}`) {
|
|
279
|
+
startWatch();
|
|
280
|
+
}
|
|
281
|
+
export {
|
|
282
|
+
startWatch
|
|
283
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cedarjs/api-server",
|
|
3
|
-
"version": "1.0.0-canary.
|
|
3
|
+
"version": "1.0.0-canary.12777+8004fc8b8",
|
|
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.0-canary.
|
|
101
|
-
"@cedarjs/fastify-web": "1.0.0-canary.
|
|
102
|
-
"@cedarjs/internal": "1.0.0-canary.
|
|
103
|
-
"@cedarjs/project-config": "1.0.0-canary.
|
|
104
|
-
"@cedarjs/web-server": "1.0.0-canary.
|
|
110
|
+
"@cedarjs/context": "1.0.0-canary.12777",
|
|
111
|
+
"@cedarjs/fastify-web": "1.0.0-canary.12777",
|
|
112
|
+
"@cedarjs/internal": "1.0.0-canary.12777",
|
|
113
|
+
"@cedarjs/project-config": "1.0.0-canary.12777",
|
|
114
|
+
"@cedarjs/web-server": "1.0.0-canary.12777",
|
|
105
115
|
"@fastify/multipart": "9.0.3",
|
|
106
116
|
"@fastify/url-data": "6.0.3",
|
|
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.0-canary.
|
|
131
|
+
"@cedarjs/framework-tools": "1.0.0-canary.12777",
|
|
122
132
|
"@types/aws-lambda": "8.10.152",
|
|
123
133
|
"@types/dotenv-defaults": "^2.0.4",
|
|
124
134
|
"@types/qs": "6.9.16",
|
|
@@ -131,7 +141,7 @@
|
|
|
131
141
|
"vitest": "3.2.4"
|
|
132
142
|
},
|
|
133
143
|
"peerDependencies": {
|
|
134
|
-
"@cedarjs/graphql-server": "1.0.0-canary.
|
|
144
|
+
"@cedarjs/graphql-server": "1.0.0-canary.12777"
|
|
135
145
|
},
|
|
136
146
|
"peerDependenciesMeta": {
|
|
137
147
|
"@cedarjs/graphql-server": {
|
|
@@ -141,5 +151,5 @@
|
|
|
141
151
|
"publishConfig": {
|
|
142
152
|
"access": "public"
|
|
143
153
|
},
|
|
144
|
-
"gitHead": "
|
|
154
|
+
"gitHead": "8004fc8b869a8c7f3babe365a0e9db26f4f80518"
|
|
145
155
|
}
|