@cedarjs/vite 6.0.0-canary.2698 → 6.0.0-canary.2700
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/plugins/vite-plugin-cedar-log-formatter-dev.js +35 -25
- package/dist/plugins/vite-plugin-cedar-log-formatter-dev.d.ts +7 -0
- package/dist/plugins/vite-plugin-cedar-log-formatter-dev.d.ts.map +1 -1
- package/dist/plugins/vite-plugin-cedar-log-formatter-dev.js +32 -24
- package/package.json +17 -17
|
@@ -18,9 +18,12 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
19
|
var vite_plugin_cedar_log_formatter_dev_exports = {};
|
|
20
20
|
__export(vite_plugin_cedar_log_formatter_dev_exports, {
|
|
21
|
-
cedarApiLogFormatterDevPlugin: () => cedarApiLogFormatterDevPlugin
|
|
21
|
+
cedarApiLogFormatterDevPlugin: () => cedarApiLogFormatterDevPlugin,
|
|
22
|
+
createFormattingDestination: () => createFormattingDestination,
|
|
23
|
+
createLogger: () => createLogger
|
|
22
24
|
});
|
|
23
25
|
module.exports = __toCommonJS(vite_plugin_cedar_log_formatter_dev_exports);
|
|
26
|
+
var import_logFormatter = require("@cedarjs/api-server/logFormatter");
|
|
24
27
|
const INTERCEPTED_SPECIFIER = "@cedarjs/api/logger";
|
|
25
28
|
const VIRTUAL_MODULE_ID = "virtual:cedar-api-logger-dev";
|
|
26
29
|
const RESOLVED_VIRTUAL_MODULE_ID = "\0" + VIRTUAL_MODULE_ID;
|
|
@@ -39,45 +42,52 @@ function cedarApiLogFormatterDevPlugin() {
|
|
|
39
42
|
return null;
|
|
40
43
|
}
|
|
41
44
|
return `
|
|
42
|
-
import * as realLogger from ${JSON.stringify(INTERCEPTED_SPECIFIER)}
|
|
43
|
-
import { LogFormatter } from '@cedarjs/api-server/logFormatter'
|
|
45
|
+
import * as realLogger from ${JSON.stringify(INTERCEPTED_SPECIFIER)}
|
|
46
|
+
import { LogFormatter } from '@cedarjs/api-server/logFormatter'
|
|
44
47
|
|
|
45
|
-
export * from ${JSON.stringify(INTERCEPTED_SPECIFIER)}
|
|
48
|
+
export * from ${JSON.stringify(INTERCEPTED_SPECIFIER)}
|
|
46
49
|
|
|
47
|
-
|
|
48
|
-
const format = LogFormatter()
|
|
49
|
-
let buffered = ''
|
|
50
|
+
${createFormattingDestination.toString()}
|
|
50
51
|
|
|
52
|
+
// toString() doesn't include the 'export' keyword
|
|
53
|
+
export ${createLogger.toString()}
|
|
54
|
+
`;
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
function createFormattingDestination() {
|
|
59
|
+
const format = (0, import_logFormatter.LogFormatter)();
|
|
60
|
+
let buffered = "";
|
|
51
61
|
return {
|
|
52
62
|
write(chunk) {
|
|
53
|
-
buffered += chunk
|
|
54
|
-
const lines = buffered.split(
|
|
55
|
-
buffered = lines.pop() ??
|
|
56
|
-
|
|
63
|
+
buffered += chunk;
|
|
64
|
+
const lines = buffered.split("\n");
|
|
65
|
+
buffered = lines.pop() ?? "";
|
|
57
66
|
for (const line of lines) {
|
|
58
67
|
if (line.length > 0) {
|
|
59
|
-
process.stdout.write(format(line))
|
|
68
|
+
process.stdout.write(format(line));
|
|
60
69
|
}
|
|
61
70
|
}
|
|
62
|
-
}
|
|
63
|
-
}
|
|
71
|
+
}
|
|
72
|
+
};
|
|
64
73
|
}
|
|
65
|
-
|
|
66
|
-
|
|
74
|
+
const realLogger = {
|
|
75
|
+
createLogger: (_params) => {
|
|
76
|
+
return {};
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
function createLogger(params = {}) {
|
|
67
80
|
if (params.destination) {
|
|
68
|
-
return realLogger.createLogger(params)
|
|
81
|
+
return realLogger.createLogger(params);
|
|
69
82
|
}
|
|
70
|
-
|
|
71
83
|
return realLogger.createLogger({
|
|
72
84
|
...params,
|
|
73
|
-
destination: createFormattingDestination()
|
|
74
|
-
})
|
|
75
|
-
}
|
|
76
|
-
`;
|
|
77
|
-
}
|
|
78
|
-
};
|
|
85
|
+
destination: createFormattingDestination()
|
|
86
|
+
});
|
|
79
87
|
}
|
|
80
88
|
// Annotate the CommonJS export names for ESM import in node:
|
|
81
89
|
0 && (module.exports = {
|
|
82
|
-
cedarApiLogFormatterDevPlugin
|
|
90
|
+
cedarApiLogFormatterDevPlugin,
|
|
91
|
+
createFormattingDestination,
|
|
92
|
+
createLogger
|
|
83
93
|
});
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Plugin } from 'vite';
|
|
2
|
+
import type * as apiLogger from '@cedarjs/api/logger';
|
|
2
3
|
/**
|
|
3
4
|
* Dev-only Vite plugin that makes the api's pino logger pretty-print
|
|
4
5
|
* through the same formatter plain `yarn cedar dev` gets via its
|
|
@@ -18,4 +19,10 @@ import type { Plugin } from 'vite';
|
|
|
18
19
|
* (and no dependency footprint added to) a deployed api.
|
|
19
20
|
*/
|
|
20
21
|
export declare function cedarApiLogFormatterDevPlugin(): Plugin;
|
|
22
|
+
export declare function createFormattingDestination(): {
|
|
23
|
+
write(chunk: string): void;
|
|
24
|
+
};
|
|
25
|
+
type CreateLoggerParams = Parameters<typeof apiLogger.createLogger>[0];
|
|
26
|
+
export declare function createLogger(params?: CreateLoggerParams): apiLogger.Logger;
|
|
27
|
+
export {};
|
|
21
28
|
//# sourceMappingURL=vite-plugin-cedar-log-formatter-dev.d.ts.map
|
|
@@ -1 +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,
|
|
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,OAAO,KAAK,KAAK,SAAS,MAAM,qBAAqB,CAAA;AAOrD;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,6BAA6B,IAAI,MAAM,CAoCtD;AAED,wBAAgB,2BAA2B;iBAK1B,MAAM;EAYtB;AAED,KAAK,kBAAkB,GAAG,UAAU,CAAC,OAAO,SAAS,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAAA;AAUtE,wBAAgB,YAAY,CAAC,MAAM,GAAE,kBAAuB,oBAS3D"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { LogFormatter } from "@cedarjs/api-server/logFormatter";
|
|
1
2
|
const INTERCEPTED_SPECIFIER = "@cedarjs/api/logger";
|
|
2
3
|
const VIRTUAL_MODULE_ID = "virtual:cedar-api-logger-dev";
|
|
3
4
|
const RESOLVED_VIRTUAL_MODULE_ID = "\0" + VIRTUAL_MODULE_ID;
|
|
@@ -16,44 +17,51 @@ function cedarApiLogFormatterDevPlugin() {
|
|
|
16
17
|
return null;
|
|
17
18
|
}
|
|
18
19
|
return `
|
|
19
|
-
import * as realLogger from ${JSON.stringify(INTERCEPTED_SPECIFIER)}
|
|
20
|
-
import { LogFormatter } from '@cedarjs/api-server/logFormatter'
|
|
20
|
+
import * as realLogger from ${JSON.stringify(INTERCEPTED_SPECIFIER)}
|
|
21
|
+
import { LogFormatter } from '@cedarjs/api-server/logFormatter'
|
|
21
22
|
|
|
22
|
-
export * from ${JSON.stringify(INTERCEPTED_SPECIFIER)}
|
|
23
|
+
export * from ${JSON.stringify(INTERCEPTED_SPECIFIER)}
|
|
23
24
|
|
|
24
|
-
|
|
25
|
-
const format = LogFormatter()
|
|
26
|
-
let buffered = ''
|
|
25
|
+
${createFormattingDestination.toString()}
|
|
27
26
|
|
|
27
|
+
// toString() doesn't include the 'export' keyword
|
|
28
|
+
export ${createLogger.toString()}
|
|
29
|
+
`;
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
function createFormattingDestination() {
|
|
34
|
+
const format = LogFormatter();
|
|
35
|
+
let buffered = "";
|
|
28
36
|
return {
|
|
29
37
|
write(chunk) {
|
|
30
|
-
buffered += chunk
|
|
31
|
-
const lines = buffered.split(
|
|
32
|
-
buffered = lines.pop() ??
|
|
33
|
-
|
|
38
|
+
buffered += chunk;
|
|
39
|
+
const lines = buffered.split("\n");
|
|
40
|
+
buffered = lines.pop() ?? "";
|
|
34
41
|
for (const line of lines) {
|
|
35
42
|
if (line.length > 0) {
|
|
36
|
-
process.stdout.write(format(line))
|
|
43
|
+
process.stdout.write(format(line));
|
|
37
44
|
}
|
|
38
45
|
}
|
|
39
|
-
}
|
|
40
|
-
}
|
|
46
|
+
}
|
|
47
|
+
};
|
|
41
48
|
}
|
|
42
|
-
|
|
43
|
-
|
|
49
|
+
const realLogger = {
|
|
50
|
+
createLogger: (_params) => {
|
|
51
|
+
return {};
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
function createLogger(params = {}) {
|
|
44
55
|
if (params.destination) {
|
|
45
|
-
return realLogger.createLogger(params)
|
|
56
|
+
return realLogger.createLogger(params);
|
|
46
57
|
}
|
|
47
|
-
|
|
48
58
|
return realLogger.createLogger({
|
|
49
59
|
...params,
|
|
50
|
-
destination: createFormattingDestination()
|
|
51
|
-
})
|
|
52
|
-
}
|
|
53
|
-
`;
|
|
54
|
-
}
|
|
55
|
-
};
|
|
60
|
+
destination: createFormattingDestination()
|
|
61
|
+
});
|
|
56
62
|
}
|
|
57
63
|
export {
|
|
58
|
-
cedarApiLogFormatterDevPlugin
|
|
64
|
+
cedarApiLogFormatterDevPlugin,
|
|
65
|
+
createFormattingDestination,
|
|
66
|
+
createLogger
|
|
59
67
|
};
|
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.2700",
|
|
4
4
|
"description": "Vite configuration package for CedarJS",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -63,16 +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/api-server": "6.0.0-canary.
|
|
68
|
-
"@cedarjs/babel-config": "6.0.0-canary.
|
|
69
|
-
"@cedarjs/context": "6.0.0-canary.
|
|
70
|
-
"@cedarjs/cookie-jar": "6.0.0-canary.
|
|
71
|
-
"@cedarjs/graphql-server": "6.0.0-canary.
|
|
72
|
-
"@cedarjs/internal": "6.0.0-canary.
|
|
73
|
-
"@cedarjs/project-config": "6.0.0-canary.
|
|
74
|
-
"@cedarjs/server-store": "6.0.0-canary.
|
|
75
|
-
"@cedarjs/testing": "6.0.0-canary.
|
|
66
|
+
"@cedarjs/api": "6.0.0-canary.2700",
|
|
67
|
+
"@cedarjs/api-server": "6.0.0-canary.2700",
|
|
68
|
+
"@cedarjs/babel-config": "6.0.0-canary.2700",
|
|
69
|
+
"@cedarjs/context": "6.0.0-canary.2700",
|
|
70
|
+
"@cedarjs/cookie-jar": "6.0.0-canary.2700",
|
|
71
|
+
"@cedarjs/graphql-server": "6.0.0-canary.2700",
|
|
72
|
+
"@cedarjs/internal": "6.0.0-canary.2700",
|
|
73
|
+
"@cedarjs/project-config": "6.0.0-canary.2700",
|
|
74
|
+
"@cedarjs/server-store": "6.0.0-canary.2700",
|
|
75
|
+
"@cedarjs/testing": "6.0.0-canary.2700",
|
|
76
76
|
"@fastify/url-data": "6.0.3",
|
|
77
77
|
"@swc/core": "1.15.41",
|
|
78
78
|
"@universal-deploy/store": "^0.2.1",
|
|
@@ -109,9 +109,9 @@
|
|
|
109
109
|
},
|
|
110
110
|
"devDependencies": {
|
|
111
111
|
"@arethetypeswrong/cli": "0.18.5",
|
|
112
|
-
"@cedarjs/auth": "6.0.0-canary.
|
|
113
|
-
"@cedarjs/router": "6.0.0-canary.
|
|
114
|
-
"@cedarjs/web": "6.0.0-canary.
|
|
112
|
+
"@cedarjs/auth": "6.0.0-canary.2700",
|
|
113
|
+
"@cedarjs/router": "6.0.0-canary.2700",
|
|
114
|
+
"@cedarjs/web": "6.0.0-canary.2700",
|
|
115
115
|
"@hyrious/esbuild-plugin-commonjs": "0.2.6",
|
|
116
116
|
"@jridgewell/trace-mapping": "0.3.31",
|
|
117
117
|
"@types/aws-lambda": "8.10.162",
|
|
@@ -130,9 +130,9 @@
|
|
|
130
130
|
"vitest": "4.1.10"
|
|
131
131
|
},
|
|
132
132
|
"peerDependencies": {
|
|
133
|
-
"@cedarjs/auth": "6.0.0-canary.
|
|
134
|
-
"@cedarjs/router": "6.0.0-canary.
|
|
135
|
-
"@cedarjs/web": "6.0.0-canary.
|
|
133
|
+
"@cedarjs/auth": "6.0.0-canary.2700",
|
|
134
|
+
"@cedarjs/router": "6.0.0-canary.2700",
|
|
135
|
+
"@cedarjs/web": "6.0.0-canary.2700"
|
|
136
136
|
},
|
|
137
137
|
"engines": {
|
|
138
138
|
"node": ">=24"
|