@cedarjs/internal 4.0.0-canary.13863 → 4.0.0-canary.13865
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/build/api.d.ts +1 -1
- package/dist/build/api.d.ts.map +1 -1
- package/dist/build/api.js +76 -2
- package/dist/cjs/build/api.d.ts +1 -1
- package/dist/cjs/build/api.d.ts.map +1 -1
- package/dist/cjs/build/api.js +78 -4
- package/package.json +12 -11
package/dist/build/api.d.ts
CHANGED
|
@@ -2,5 +2,5 @@ import type { BuildOptions } from 'esbuild';
|
|
|
2
2
|
export declare const buildApi: () => Promise<import("esbuild").BuildResult<BuildOptions>>;
|
|
3
3
|
export declare const rebuildApi: () => Promise<import("esbuild").BuildResult<BuildOptions>>;
|
|
4
4
|
export declare const cleanApiBuild: () => Promise<void>;
|
|
5
|
-
export declare const
|
|
5
|
+
export declare const buildApiWithVite: () => Promise<import("rollup").RollupOutput | import("rollup").RollupOutput[] | import("rollup").RollupWatcher>;
|
|
6
6
|
//# sourceMappingURL=api.d.ts.map
|
package/dist/build/api.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../src/build/api.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../src/build/api.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAgB,YAAY,EAAe,MAAM,SAAS,CAAA;AAetE,eAAO,MAAM,QAAQ,4DAIpB,CAAA;AAED,eAAO,MAAM,UAAU,4DAMtB,CAAA;AAED,eAAO,MAAM,aAAa,qBAGzB,CAAA;AAqED,eAAO,MAAM,gBAAgB,iHAiD5B,CAAA"}
|
package/dist/build/api.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import fs from "node:fs";
|
|
2
|
+
import path from "node:path";
|
|
2
3
|
import { build, context } from "esbuild";
|
|
4
|
+
import { build as viteBuild, normalizePath } from "vite";
|
|
3
5
|
import {
|
|
4
6
|
getApiSideBabelPlugins,
|
|
5
7
|
transformWithBabel
|
|
@@ -45,6 +47,78 @@ const runCedarBabelTransformsPlugin = {
|
|
|
45
47
|
});
|
|
46
48
|
}
|
|
47
49
|
};
|
|
50
|
+
function createCedarViteApiPlugin() {
|
|
51
|
+
const cedarConfig = getConfig();
|
|
52
|
+
const isEsm = projectSideIsEsm("api");
|
|
53
|
+
return {
|
|
54
|
+
name: "cedar-vite-api-babel-transform",
|
|
55
|
+
async transform(_code, id) {
|
|
56
|
+
if (!/\.(js|ts|tsx|jsx)$/.test(id)) {
|
|
57
|
+
return null;
|
|
58
|
+
}
|
|
59
|
+
if (id.includes("node_modules")) {
|
|
60
|
+
return null;
|
|
61
|
+
}
|
|
62
|
+
const cedarPaths = getPaths();
|
|
63
|
+
if (!normalizePath(id).startsWith(normalizePath(cedarPaths.api.base))) {
|
|
64
|
+
return null;
|
|
65
|
+
}
|
|
66
|
+
const transformedCode = await transformWithBabel(
|
|
67
|
+
id,
|
|
68
|
+
getApiSideBabelPlugins({
|
|
69
|
+
openTelemetry: cedarConfig.experimental.opentelemetry.enabled && cedarConfig.experimental.opentelemetry.wrapApi,
|
|
70
|
+
projectIsEsm: isEsm
|
|
71
|
+
})
|
|
72
|
+
);
|
|
73
|
+
if (transformedCode?.code) {
|
|
74
|
+
return {
|
|
75
|
+
code: transformedCode.code,
|
|
76
|
+
map: transformedCode.map ?? null
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
throw new Error(`Could not transform file: ${id}`);
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
const buildApiWithVite = async () => {
|
|
84
|
+
const cedarPaths = getPaths();
|
|
85
|
+
const isEsm = projectSideIsEsm("api");
|
|
86
|
+
const format = isEsm ? "es" : "cjs";
|
|
87
|
+
const apiFiles = findApiFiles();
|
|
88
|
+
const input = {};
|
|
89
|
+
for (const f of apiFiles) {
|
|
90
|
+
const key = path.relative(cedarPaths.api.src, f).replace(/\.(ts|tsx|mts|js|jsx|mjs)$/, "");
|
|
91
|
+
input[key] = f;
|
|
92
|
+
}
|
|
93
|
+
return viteBuild({
|
|
94
|
+
root: cedarPaths.api.base,
|
|
95
|
+
logLevel: "warn",
|
|
96
|
+
build: {
|
|
97
|
+
ssr: true,
|
|
98
|
+
sourcemap: true,
|
|
99
|
+
outDir: cedarPaths.api.dist,
|
|
100
|
+
rollupOptions: {
|
|
101
|
+
input,
|
|
102
|
+
output: {
|
|
103
|
+
format,
|
|
104
|
+
preserveModules: true,
|
|
105
|
+
preserveModulesRoot: cedarPaths.api.src,
|
|
106
|
+
entryFileNames: "[name].js"
|
|
107
|
+
},
|
|
108
|
+
external: (id) => {
|
|
109
|
+
if (id.startsWith("node:")) {
|
|
110
|
+
return true;
|
|
111
|
+
}
|
|
112
|
+
if (!id.startsWith(".") && !path.isAbsolute(id)) {
|
|
113
|
+
return true;
|
|
114
|
+
}
|
|
115
|
+
return false;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
},
|
|
119
|
+
plugins: [createCedarViteApiPlugin()]
|
|
120
|
+
});
|
|
121
|
+
};
|
|
48
122
|
const transpileApi = async (files) => {
|
|
49
123
|
return build(getEsbuildOptions(files));
|
|
50
124
|
};
|
|
@@ -69,7 +143,7 @@ function getEsbuildOptions(files) {
|
|
|
69
143
|
}
|
|
70
144
|
export {
|
|
71
145
|
buildApi,
|
|
146
|
+
buildApiWithVite,
|
|
72
147
|
cleanApiBuild,
|
|
73
|
-
rebuildApi
|
|
74
|
-
transpileApi
|
|
148
|
+
rebuildApi
|
|
75
149
|
};
|
package/dist/cjs/build/api.d.ts
CHANGED
|
@@ -2,5 +2,5 @@ import type { BuildOptions } from 'esbuild';
|
|
|
2
2
|
export declare const buildApi: () => Promise<import("esbuild").BuildResult<BuildOptions>>;
|
|
3
3
|
export declare const rebuildApi: () => Promise<import("esbuild").BuildResult<BuildOptions>>;
|
|
4
4
|
export declare const cleanApiBuild: () => Promise<void>;
|
|
5
|
-
export declare const
|
|
5
|
+
export declare const buildApiWithVite: () => Promise<import("rollup").RollupOutput | import("rollup").RollupOutput[] | import("rollup").RollupWatcher>;
|
|
6
6
|
//# sourceMappingURL=api.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../../src/build/api.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../../src/build/api.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAgB,YAAY,EAAe,MAAM,SAAS,CAAA;AAetE,eAAO,MAAM,QAAQ,4DAIpB,CAAA;AAED,eAAO,MAAM,UAAU,4DAMtB,CAAA;AAED,eAAO,MAAM,aAAa,qBAGzB,CAAA;AAqED,eAAO,MAAM,gBAAgB,iHAiD5B,CAAA"}
|
package/dist/cjs/build/api.js
CHANGED
|
@@ -29,13 +29,15 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
29
29
|
var api_exports = {};
|
|
30
30
|
__export(api_exports, {
|
|
31
31
|
buildApi: () => buildApi,
|
|
32
|
+
buildApiWithVite: () => buildApiWithVite,
|
|
32
33
|
cleanApiBuild: () => cleanApiBuild,
|
|
33
|
-
rebuildApi: () => rebuildApi
|
|
34
|
-
transpileApi: () => transpileApi
|
|
34
|
+
rebuildApi: () => rebuildApi
|
|
35
35
|
});
|
|
36
36
|
module.exports = __toCommonJS(api_exports);
|
|
37
37
|
var import_node_fs = __toESM(require("node:fs"), 1);
|
|
38
|
+
var import_node_path = __toESM(require("node:path"), 1);
|
|
38
39
|
var import_esbuild = require("esbuild");
|
|
40
|
+
var import_vite = require("vite");
|
|
39
41
|
var import_babel_config = require("@cedarjs/babel-config");
|
|
40
42
|
var import_project_config = require("@cedarjs/project-config");
|
|
41
43
|
var import_files = require("../files.js");
|
|
@@ -78,6 +80,78 @@ const runCedarBabelTransformsPlugin = {
|
|
|
78
80
|
});
|
|
79
81
|
}
|
|
80
82
|
};
|
|
83
|
+
function createCedarViteApiPlugin() {
|
|
84
|
+
const cedarConfig = (0, import_project_config.getConfig)();
|
|
85
|
+
const isEsm = (0, import_project_config.projectSideIsEsm)("api");
|
|
86
|
+
return {
|
|
87
|
+
name: "cedar-vite-api-babel-transform",
|
|
88
|
+
async transform(_code, id) {
|
|
89
|
+
if (!/\.(js|ts|tsx|jsx)$/.test(id)) {
|
|
90
|
+
return null;
|
|
91
|
+
}
|
|
92
|
+
if (id.includes("node_modules")) {
|
|
93
|
+
return null;
|
|
94
|
+
}
|
|
95
|
+
const cedarPaths = (0, import_project_config.getPaths)();
|
|
96
|
+
if (!(0, import_vite.normalizePath)(id).startsWith((0, import_vite.normalizePath)(cedarPaths.api.base))) {
|
|
97
|
+
return null;
|
|
98
|
+
}
|
|
99
|
+
const transformedCode = await (0, import_babel_config.transformWithBabel)(
|
|
100
|
+
id,
|
|
101
|
+
(0, import_babel_config.getApiSideBabelPlugins)({
|
|
102
|
+
openTelemetry: cedarConfig.experimental.opentelemetry.enabled && cedarConfig.experimental.opentelemetry.wrapApi,
|
|
103
|
+
projectIsEsm: isEsm
|
|
104
|
+
})
|
|
105
|
+
);
|
|
106
|
+
if (transformedCode?.code) {
|
|
107
|
+
return {
|
|
108
|
+
code: transformedCode.code,
|
|
109
|
+
map: transformedCode.map ?? null
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
throw new Error(`Could not transform file: ${id}`);
|
|
113
|
+
}
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
const buildApiWithVite = async () => {
|
|
117
|
+
const cedarPaths = (0, import_project_config.getPaths)();
|
|
118
|
+
const isEsm = (0, import_project_config.projectSideIsEsm)("api");
|
|
119
|
+
const format = isEsm ? "es" : "cjs";
|
|
120
|
+
const apiFiles = (0, import_files.findApiFiles)();
|
|
121
|
+
const input = {};
|
|
122
|
+
for (const f of apiFiles) {
|
|
123
|
+
const key = import_node_path.default.relative(cedarPaths.api.src, f).replace(/\.(ts|tsx|mts|js|jsx|mjs)$/, "");
|
|
124
|
+
input[key] = f;
|
|
125
|
+
}
|
|
126
|
+
return (0, import_vite.build)({
|
|
127
|
+
root: cedarPaths.api.base,
|
|
128
|
+
logLevel: "warn",
|
|
129
|
+
build: {
|
|
130
|
+
ssr: true,
|
|
131
|
+
sourcemap: true,
|
|
132
|
+
outDir: cedarPaths.api.dist,
|
|
133
|
+
rollupOptions: {
|
|
134
|
+
input,
|
|
135
|
+
output: {
|
|
136
|
+
format,
|
|
137
|
+
preserveModules: true,
|
|
138
|
+
preserveModulesRoot: cedarPaths.api.src,
|
|
139
|
+
entryFileNames: "[name].js"
|
|
140
|
+
},
|
|
141
|
+
external: (id) => {
|
|
142
|
+
if (id.startsWith("node:")) {
|
|
143
|
+
return true;
|
|
144
|
+
}
|
|
145
|
+
if (!id.startsWith(".") && !import_node_path.default.isAbsolute(id)) {
|
|
146
|
+
return true;
|
|
147
|
+
}
|
|
148
|
+
return false;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
},
|
|
152
|
+
plugins: [createCedarViteApiPlugin()]
|
|
153
|
+
});
|
|
154
|
+
};
|
|
81
155
|
const transpileApi = async (files) => {
|
|
82
156
|
return (0, import_esbuild.build)(getEsbuildOptions(files));
|
|
83
157
|
};
|
|
@@ -103,7 +177,7 @@ function getEsbuildOptions(files) {
|
|
|
103
177
|
// Annotate the CommonJS export names for ESM import in node:
|
|
104
178
|
0 && (module.exports = {
|
|
105
179
|
buildApi,
|
|
180
|
+
buildApiWithVite,
|
|
106
181
|
cleanApiBuild,
|
|
107
|
-
rebuildApi
|
|
108
|
-
transpileApi
|
|
182
|
+
rebuildApi
|
|
109
183
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cedarjs/internal",
|
|
3
|
-
"version": "4.0.0-canary.
|
|
3
|
+
"version": "4.0.0-canary.13865+57f1e8c260",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/cedarjs/cedar.git",
|
|
@@ -159,13 +159,13 @@
|
|
|
159
159
|
"@babel/plugin-transform-react-jsx": "7.28.6",
|
|
160
160
|
"@babel/plugin-transform-typescript": "^7.26.8",
|
|
161
161
|
"@babel/traverse": "7.29.0",
|
|
162
|
-
"@cedarjs/babel-config": "4.0.0-canary.
|
|
163
|
-
"@cedarjs/cli-helpers": "4.0.0-canary.
|
|
164
|
-
"@cedarjs/graphql-server": "4.0.0-canary.
|
|
165
|
-
"@cedarjs/project-config": "4.0.0-canary.
|
|
166
|
-
"@cedarjs/router": "4.0.0-canary.
|
|
167
|
-
"@cedarjs/structure": "4.0.0-canary.
|
|
168
|
-
"@cedarjs/utils": "4.0.0-canary.
|
|
162
|
+
"@cedarjs/babel-config": "4.0.0-canary.13865",
|
|
163
|
+
"@cedarjs/cli-helpers": "4.0.0-canary.13865",
|
|
164
|
+
"@cedarjs/graphql-server": "4.0.0-canary.13865",
|
|
165
|
+
"@cedarjs/project-config": "4.0.0-canary.13865",
|
|
166
|
+
"@cedarjs/router": "4.0.0-canary.13865",
|
|
167
|
+
"@cedarjs/structure": "4.0.0-canary.13865",
|
|
168
|
+
"@cedarjs/utils": "4.0.0-canary.13865",
|
|
169
169
|
"@graphql-codegen/add": "6.0.1",
|
|
170
170
|
"@graphql-codegen/cli": "6.3.1",
|
|
171
171
|
"@graphql-codegen/client-preset": "5.3.0",
|
|
@@ -194,11 +194,12 @@
|
|
|
194
194
|
"systeminformation": "5.31.5",
|
|
195
195
|
"termi-link": "1.1.0",
|
|
196
196
|
"ts-node": "10.9.2",
|
|
197
|
-
"typescript": "5.9.3"
|
|
197
|
+
"typescript": "5.9.3",
|
|
198
|
+
"vite": "7.3.2"
|
|
198
199
|
},
|
|
199
200
|
"devDependencies": {
|
|
200
201
|
"@arethetypeswrong/cli": "0.18.2",
|
|
201
|
-
"@cedarjs/framework-tools": "4.0.0-canary.
|
|
202
|
+
"@cedarjs/framework-tools": "4.0.0-canary.13865",
|
|
202
203
|
"concurrently": "9.2.1",
|
|
203
204
|
"graphql-tag": "2.12.6",
|
|
204
205
|
"publint": "0.3.18",
|
|
@@ -211,5 +212,5 @@
|
|
|
211
212
|
"publishConfig": {
|
|
212
213
|
"access": "public"
|
|
213
214
|
},
|
|
214
|
-
"gitHead": "
|
|
215
|
+
"gitHead": "57f1e8c260ef230a4d43b620d51f610cee65f91f"
|
|
215
216
|
}
|