@cedarjs/vite 6.0.0-canary.2682 → 6.0.0-canary.2685
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/apiDevMiddleware.d.ts.map +1 -1
- package/dist/apiDevMiddleware.js +2 -0
- package/dist/cjs/apiDevMiddleware.js +2 -0
- package/dist/cjs/lib/getMergedConfig.js +4 -5
- package/dist/cjs/plugins/vite-plugin-cedar-log-formatter-dev.js +83 -0
- package/dist/lib/getMergedConfig.d.ts.map +1 -1
- package/dist/lib/getMergedConfig.js +4 -5
- package/dist/plugins/vite-plugin-cedar-log-formatter-dev.d.ts +21 -0
- package/dist/plugins/vite-plugin-cedar-log-formatter-dev.d.ts.map +1 -0
- package/dist/plugins/vite-plugin-cedar-log-formatter-dev.js +59 -0
- package/package.json +14 -13
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apiDevMiddleware.d.ts","sourceRoot":"","sources":["../src/apiDevMiddleware.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAsB,aAAa,EAAE,MAAM,MAAM,CAAA;
|
|
1
|
+
{"version":3,"file":"apiDevMiddleware.d.ts","sourceRoot":"","sources":["../src/apiDevMiddleware.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAsB,aAAa,EAAE,MAAM,MAAM,CAAA;AAgE7D,wBAAsB,gBAAgB,CAAC,UAAU,EAAE,aAAa,iBAe/D;AA+GD,wBAAsB,mBAAmB,IAAI,OAAO,CAAC,aAAa,CAAC,CA8IlE;AA0BD,wBAAgB,gBAAgB,CAAC,UAAU,EAAE,aAAa,GAAG,IAAI,CA0EhE;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,KAIrB,SAAS,OAAO,KAAG,OAAO,CAAC,QAAQ,CAAC,CAoFnD;AAED,wBAAsB,qBAAqB,IAAI,OAAO,CAAC;IACrD,UAAU,EAAE,aAAa,CAAA;IACzB,KAAK,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;IAC1B,OAAO,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAA;CACjD,CAAC,CAcD"}
|
package/dist/apiDevMiddleware.js
CHANGED
|
@@ -25,6 +25,7 @@ import { cedarAutoImportsPlugin } from "./plugins/vite-plugin-cedar-auto-import.
|
|
|
25
25
|
import { cedarDirectoryNamedImportPlugin } from "./plugins/vite-plugin-cedar-directory-named-import.js";
|
|
26
26
|
import { applyGraphqlOptionsExtract } from "./plugins/vite-plugin-cedar-graphql-options-extract.js";
|
|
27
27
|
import { cedarImportDirPlugin } from "./plugins/vite-plugin-cedar-import-dir.js";
|
|
28
|
+
import { cedarApiLogFormatterDevPlugin } from "./plugins/vite-plugin-cedar-log-formatter-dev.js";
|
|
28
29
|
import { applyOtelWrapping } from "./plugins/vite-plugin-cedar-otel-wrapping.js";
|
|
29
30
|
import { cedarjsJobPathInjectorPlugin } from "./plugins/vite-plugin-cedarjs-job-path-injector.js";
|
|
30
31
|
function resolveWithExtensions(id) {
|
|
@@ -170,6 +171,7 @@ async function createApiViteServer() {
|
|
|
170
171
|
// tsconfigPaths resolves user-defined tsconfig.json `paths` aliases; it
|
|
171
172
|
// replaces the Babel module-resolver's tsconfig-paths handling for dev.
|
|
172
173
|
tsconfigPaths(),
|
|
174
|
+
cedarApiLogFormatterDevPlugin(),
|
|
173
175
|
{
|
|
174
176
|
name: "cedar-api-src-redirect",
|
|
175
177
|
enforce: "pre",
|
|
@@ -54,6 +54,7 @@ var import_vite_plugin_cedar_auto_import = require("./plugins/vite-plugin-cedar-
|
|
|
54
54
|
var import_vite_plugin_cedar_directory_named_import = require("./plugins/vite-plugin-cedar-directory-named-import.js");
|
|
55
55
|
var import_vite_plugin_cedar_graphql_options_extract = require("./plugins/vite-plugin-cedar-graphql-options-extract.js");
|
|
56
56
|
var import_vite_plugin_cedar_import_dir = require("./plugins/vite-plugin-cedar-import-dir.js");
|
|
57
|
+
var import_vite_plugin_cedar_log_formatter_dev = require("./plugins/vite-plugin-cedar-log-formatter-dev.js");
|
|
57
58
|
var import_vite_plugin_cedar_otel_wrapping = require("./plugins/vite-plugin-cedar-otel-wrapping.js");
|
|
58
59
|
var import_vite_plugin_cedarjs_job_path_injector = require("./plugins/vite-plugin-cedarjs-job-path-injector.js");
|
|
59
60
|
const tsconfigPaths = (
|
|
@@ -204,6 +205,7 @@ async function createApiViteServer() {
|
|
|
204
205
|
// tsconfigPaths resolves user-defined tsconfig.json `paths` aliases; it
|
|
205
206
|
// replaces the Babel module-resolver's tsconfig-paths handling for dev.
|
|
206
207
|
tsconfigPaths(),
|
|
208
|
+
(0, import_vite_plugin_cedar_log_formatter_dev.cedarApiLogFormatterDevPlugin)(),
|
|
207
209
|
{
|
|
208
210
|
name: "cedar-api-src-redirect",
|
|
209
211
|
enforce: "pre",
|
|
@@ -54,11 +54,10 @@ function getMergedConfig(cedarConfig, cedarPaths) {
|
|
|
54
54
|
resolve: {
|
|
55
55
|
alias: {
|
|
56
56
|
...workspaceAliases,
|
|
57
|
-
//
|
|
58
|
-
//
|
|
59
|
-
//
|
|
60
|
-
//
|
|
61
|
-
$api: cedarPaths.api.base,
|
|
57
|
+
// $api/ bare specifiers (e.g. "from '$api/src/lib/db'") are
|
|
58
|
+
// resolved by cedarjsResolveCedarStyleImportsPlugin, which is
|
|
59
|
+
// always included alongside this config in cedar()'s plugin list
|
|
60
|
+
// (see packages/vite/src/index.ts) — no alias needed here too.
|
|
62
61
|
// In test mode, register the virtual module alias so that
|
|
63
62
|
// MockProviders can resolve the user's Routes file
|
|
64
63
|
...env.mode === "test" ? { "~__CEDAR__USER_ROUTES_FOR_MOCK": cedarPaths.web.routes } : {}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var vite_plugin_cedar_log_formatter_dev_exports = {};
|
|
20
|
+
__export(vite_plugin_cedar_log_formatter_dev_exports, {
|
|
21
|
+
cedarApiLogFormatterDevPlugin: () => cedarApiLogFormatterDevPlugin
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(vite_plugin_cedar_log_formatter_dev_exports);
|
|
24
|
+
const INTERCEPTED_SPECIFIER = "@cedarjs/api/logger";
|
|
25
|
+
const VIRTUAL_MODULE_ID = "virtual:cedar-api-logger-dev";
|
|
26
|
+
const RESOLVED_VIRTUAL_MODULE_ID = "\0" + VIRTUAL_MODULE_ID;
|
|
27
|
+
function cedarApiLogFormatterDevPlugin() {
|
|
28
|
+
return {
|
|
29
|
+
name: "cedar-api-log-formatter-dev",
|
|
30
|
+
enforce: "pre",
|
|
31
|
+
resolveId(id, importer) {
|
|
32
|
+
if (id === INTERCEPTED_SPECIFIER && importer !== RESOLVED_VIRTUAL_MODULE_ID) {
|
|
33
|
+
return RESOLVED_VIRTUAL_MODULE_ID;
|
|
34
|
+
}
|
|
35
|
+
return null;
|
|
36
|
+
},
|
|
37
|
+
load(id) {
|
|
38
|
+
if (id !== RESOLVED_VIRTUAL_MODULE_ID) {
|
|
39
|
+
return null;
|
|
40
|
+
}
|
|
41
|
+
return `
|
|
42
|
+
import * as realLogger from ${JSON.stringify(INTERCEPTED_SPECIFIER)}
|
|
43
|
+
import { LogFormatter } from '@cedarjs/api-server/logFormatter'
|
|
44
|
+
|
|
45
|
+
export * from ${JSON.stringify(INTERCEPTED_SPECIFIER)}
|
|
46
|
+
|
|
47
|
+
function createFormattingDestination() {
|
|
48
|
+
const format = LogFormatter()
|
|
49
|
+
let buffered = ''
|
|
50
|
+
|
|
51
|
+
return {
|
|
52
|
+
write(chunk) {
|
|
53
|
+
buffered += chunk
|
|
54
|
+
const lines = buffered.split('\\n')
|
|
55
|
+
buffered = lines.pop() ?? ''
|
|
56
|
+
|
|
57
|
+
for (const line of lines) {
|
|
58
|
+
if (line.length > 0) {
|
|
59
|
+
process.stdout.write(format(line))
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export function createLogger(params = {}) {
|
|
67
|
+
if (params.destination) {
|
|
68
|
+
return realLogger.createLogger(params)
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
return realLogger.createLogger({
|
|
72
|
+
...params,
|
|
73
|
+
destination: createFormattingDestination(),
|
|
74
|
+
})
|
|
75
|
+
}
|
|
76
|
+
`;
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
81
|
+
0 && (module.exports = {
|
|
82
|
+
cedarApiLogFormatterDevPlugin
|
|
83
|
+
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getMergedConfig.d.ts","sourceRoot":"","sources":["../../src/lib/getMergedConfig.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAE9D,OAAO,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAA;AAS5D;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,WAAW,EAAE,MAAM,EAAE,UAAU,EAAE,KAAK,IAC5D,YAAY,cAAc,EAAE,KAAK,SAAS,KAAG,cAAc,
|
|
1
|
+
{"version":3,"file":"getMergedConfig.d.ts","sourceRoot":"","sources":["../../src/lib/getMergedConfig.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAE9D,OAAO,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAA;AAS5D;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,WAAW,EAAE,MAAM,EAAE,UAAU,EAAE,KAAK,IAC5D,YAAY,cAAc,EAAE,KAAK,SAAS,KAAG,cAAc,CAgIpE"}
|
|
@@ -25,11 +25,10 @@ function getMergedConfig(cedarConfig, cedarPaths) {
|
|
|
25
25
|
resolve: {
|
|
26
26
|
alias: {
|
|
27
27
|
...workspaceAliases,
|
|
28
|
-
//
|
|
29
|
-
//
|
|
30
|
-
//
|
|
31
|
-
//
|
|
32
|
-
$api: cedarPaths.api.base,
|
|
28
|
+
// $api/ bare specifiers (e.g. "from '$api/src/lib/db'") are
|
|
29
|
+
// resolved by cedarjsResolveCedarStyleImportsPlugin, which is
|
|
30
|
+
// always included alongside this config in cedar()'s plugin list
|
|
31
|
+
// (see packages/vite/src/index.ts) — no alias needed here too.
|
|
33
32
|
// In test mode, register the virtual module alias so that
|
|
34
33
|
// MockProviders can resolve the user's Routes file
|
|
35
34
|
...env.mode === "test" ? { "~__CEDAR__USER_ROUTES_FOR_MOCK": cedarPaths.web.routes } : {}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { Plugin } from 'vite';
|
|
2
|
+
/**
|
|
3
|
+
* Dev-only Vite plugin that makes the api's pino logger pretty-print
|
|
4
|
+
* through the same formatter plain `yarn cedar dev` gets via its
|
|
5
|
+
* `... | cedar-log-formatter` shell pipe.
|
|
6
|
+
*
|
|
7
|
+
* `--ud` mode runs the api in-process as Vite SSR middleware, so there's no
|
|
8
|
+
* separate api process whose stdout a shell pipe could format externally,
|
|
9
|
+
* and pino's default destination writes straight to file descriptor 1
|
|
10
|
+
* (bypassing `process.stdout.write`), so patching stdout wouldn't see the
|
|
11
|
+
* log lines either. Instead, this intercepts resolution of
|
|
12
|
+
* `@cedarjs/api/logger` and swaps in a wrapped `createLogger` that injects
|
|
13
|
+
* a formatting `destination` whenever the caller (the app's own
|
|
14
|
+
* `api/src/lib/logger.ts`) doesn't already supply one.
|
|
15
|
+
*
|
|
16
|
+
* Only registered in `createApiViteServer()`'s dev-only Vite instance —
|
|
17
|
+
* never touched by any production build path — so this has no effect on
|
|
18
|
+
* (and no dependency footprint added to) a deployed api.
|
|
19
|
+
*/
|
|
20
|
+
export declare function cedarApiLogFormatterDevPlugin(): Plugin;
|
|
21
|
+
//# sourceMappingURL=vite-plugin-cedar-log-formatter-dev.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vite-plugin-cedar-log-formatter-dev.d.ts","sourceRoot":"","sources":["../../src/plugins/vite-plugin-cedar-log-formatter-dev.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAA;AAMlC;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,6BAA6B,IAAI,MAAM,CA6DtD"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
const INTERCEPTED_SPECIFIER = "@cedarjs/api/logger";
|
|
2
|
+
const VIRTUAL_MODULE_ID = "virtual:cedar-api-logger-dev";
|
|
3
|
+
const RESOLVED_VIRTUAL_MODULE_ID = "\0" + VIRTUAL_MODULE_ID;
|
|
4
|
+
function cedarApiLogFormatterDevPlugin() {
|
|
5
|
+
return {
|
|
6
|
+
name: "cedar-api-log-formatter-dev",
|
|
7
|
+
enforce: "pre",
|
|
8
|
+
resolveId(id, importer) {
|
|
9
|
+
if (id === INTERCEPTED_SPECIFIER && importer !== RESOLVED_VIRTUAL_MODULE_ID) {
|
|
10
|
+
return RESOLVED_VIRTUAL_MODULE_ID;
|
|
11
|
+
}
|
|
12
|
+
return null;
|
|
13
|
+
},
|
|
14
|
+
load(id) {
|
|
15
|
+
if (id !== RESOLVED_VIRTUAL_MODULE_ID) {
|
|
16
|
+
return null;
|
|
17
|
+
}
|
|
18
|
+
return `
|
|
19
|
+
import * as realLogger from ${JSON.stringify(INTERCEPTED_SPECIFIER)}
|
|
20
|
+
import { LogFormatter } from '@cedarjs/api-server/logFormatter'
|
|
21
|
+
|
|
22
|
+
export * from ${JSON.stringify(INTERCEPTED_SPECIFIER)}
|
|
23
|
+
|
|
24
|
+
function createFormattingDestination() {
|
|
25
|
+
const format = LogFormatter()
|
|
26
|
+
let buffered = ''
|
|
27
|
+
|
|
28
|
+
return {
|
|
29
|
+
write(chunk) {
|
|
30
|
+
buffered += chunk
|
|
31
|
+
const lines = buffered.split('\\n')
|
|
32
|
+
buffered = lines.pop() ?? ''
|
|
33
|
+
|
|
34
|
+
for (const line of lines) {
|
|
35
|
+
if (line.length > 0) {
|
|
36
|
+
process.stdout.write(format(line))
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export function createLogger(params = {}) {
|
|
44
|
+
if (params.destination) {
|
|
45
|
+
return realLogger.createLogger(params)
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
return realLogger.createLogger({
|
|
49
|
+
...params,
|
|
50
|
+
destination: createFormattingDestination(),
|
|
51
|
+
})
|
|
52
|
+
}
|
|
53
|
+
`;
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
export {
|
|
58
|
+
cedarApiLogFormatterDevPlugin
|
|
59
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cedarjs/vite",
|
|
3
|
-
"version": "6.0.0-canary.
|
|
3
|
+
"version": "6.0.0-canary.2685",
|
|
4
4
|
"description": "Vite configuration package for CedarJS",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -63,15 +63,16 @@
|
|
|
63
63
|
"@babel/parser": "7.29.7",
|
|
64
64
|
"@babel/traverse": "7.29.7",
|
|
65
65
|
"@babel/types": "7.29.7",
|
|
66
|
-
"@cedarjs/api": "6.0.0-canary.
|
|
67
|
-
"@cedarjs/
|
|
68
|
-
"@cedarjs/
|
|
69
|
-
"@cedarjs/
|
|
70
|
-
"@cedarjs/
|
|
71
|
-
"@cedarjs/
|
|
72
|
-
"@cedarjs/
|
|
73
|
-
"@cedarjs/
|
|
74
|
-
"@cedarjs/
|
|
66
|
+
"@cedarjs/api": "6.0.0-canary.2685",
|
|
67
|
+
"@cedarjs/api-server": "6.0.0-canary.2685",
|
|
68
|
+
"@cedarjs/babel-config": "6.0.0-canary.2685",
|
|
69
|
+
"@cedarjs/context": "6.0.0-canary.2685",
|
|
70
|
+
"@cedarjs/cookie-jar": "6.0.0-canary.2685",
|
|
71
|
+
"@cedarjs/graphql-server": "6.0.0-canary.2685",
|
|
72
|
+
"@cedarjs/internal": "6.0.0-canary.2685",
|
|
73
|
+
"@cedarjs/project-config": "6.0.0-canary.2685",
|
|
74
|
+
"@cedarjs/server-store": "6.0.0-canary.2685",
|
|
75
|
+
"@cedarjs/testing": "6.0.0-canary.2685",
|
|
75
76
|
"@fastify/url-data": "6.0.3",
|
|
76
77
|
"@swc/core": "1.15.41",
|
|
77
78
|
"@universal-deploy/store": "^0.2.1",
|
|
@@ -108,9 +109,9 @@
|
|
|
108
109
|
},
|
|
109
110
|
"devDependencies": {
|
|
110
111
|
"@arethetypeswrong/cli": "0.18.5",
|
|
111
|
-
"@cedarjs/auth": "6.0.0-canary.
|
|
112
|
-
"@cedarjs/router": "6.0.0-canary.
|
|
113
|
-
"@cedarjs/web": "6.0.0-canary.
|
|
112
|
+
"@cedarjs/auth": "6.0.0-canary.2685",
|
|
113
|
+
"@cedarjs/router": "6.0.0-canary.2685",
|
|
114
|
+
"@cedarjs/web": "6.0.0-canary.2685",
|
|
114
115
|
"@hyrious/esbuild-plugin-commonjs": "0.2.6",
|
|
115
116
|
"@jridgewell/trace-mapping": "0.3.31",
|
|
116
117
|
"@types/aws-lambda": "8.10.162",
|