@vercel/cervel 0.0.3 → 0.0.5

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/bin/cervel.mjs CHANGED
@@ -1,4 +1,4 @@
1
1
  #!/usr/bin/env node
2
- import { main } from '../dist/cli.js';
2
+ import { main } from '../dist/cli.mjs';
3
3
 
4
4
  await main();
@@ -170,16 +170,6 @@ const rolldown = async (args) => {
170
170
  for (const dependency of Object.keys(pkg.peerDependencies || {})) external.push(dependency);
171
171
  for (const dependency of Object.keys(pkg.optionalDependencies || {})) external.push(dependency);
172
172
  }
173
- const absoluteImportPlugin = {
174
- name: "absolute-import-resolver",
175
- resolveId(source) {
176
- if (external.includes(source)) return {
177
- id: source,
178
- external: true
179
- };
180
- return null;
181
- }
182
- };
183
173
  const tsconfig = await findNearestTsconfig(baseDir);
184
174
  const relativeOutputDir = args.out;
185
175
  const outputDir = join(baseDir, relativeOutputDir);
@@ -188,8 +178,12 @@ const rolldown = async (args) => {
188
178
  input: entrypointPath,
189
179
  cwd: baseDir,
190
180
  platform: "node",
191
- external: /node_modules/,
192
- plugins: [absoluteImportPlugin],
181
+ external: (source) => {
182
+ if (source.startsWith(".") || source.startsWith("/")) return false;
183
+ return external.some((pkg$1) => {
184
+ return source === pkg$1 || source.startsWith(pkg$1 + "/");
185
+ });
186
+ },
193
187
  tsconfig,
194
188
  output: {
195
189
  dir: outputDir,
@@ -236,7 +230,14 @@ const rolldown = async (args) => {
236
230
 
237
231
  //#endregion
238
232
  //#region src/find-entrypoint.ts
239
- const frameworks = ["express", "hono"];
233
+ const frameworks = [
234
+ "express",
235
+ "hono",
236
+ "elysia",
237
+ "fastify",
238
+ "@nestjs/core",
239
+ "h3"
240
+ ];
240
241
  const entrypointFilenames = [
241
242
  "app",
242
243
  "index",
@@ -289,6 +290,11 @@ const findEntrypoint = async (cwd, options) => {
289
290
  const require = createRequire(import.meta.url);
290
291
  const build$1 = async (args) => {
291
292
  const entrypoint = args.entrypoint || await findEntrypoint(args.cwd);
293
+ const tsPromise = typescript({
294
+ ...args,
295
+ entrypoint,
296
+ workPath: args.cwd
297
+ });
292
298
  const rolldownResult = await rolldown({
293
299
  ...args,
294
300
  entrypoint,
@@ -297,12 +303,9 @@ const build$1 = async (args) => {
297
303
  out: args.out
298
304
  });
299
305
  await writeFile(join(args.cwd, args.out, ".cervel.json"), JSON.stringify({ handler: rolldownResult.result.handler }, null, 2));
300
- const tsPromise = typescript({
301
- ...args,
302
- entrypoint,
303
- workPath: args.cwd
304
- });
305
306
  console.log(Colors.gray(`${Colors.bold(Colors.cyan("✓"))} Build complete`));
307
+ const typecheckComplete = true;
308
+ if (!await Promise.race([tsPromise.then(() => typecheckComplete), Promise.resolve(false)])) console.log(Colors.gray(`${Colors.bold(Colors.gray("*"))} Waiting for typecheck...`));
306
309
  return {
307
310
  rolldownResult: rolldownResult.result,
308
311
  tsPromise
@@ -169,16 +169,6 @@ const rolldown = async (args) => {
169
169
  for (const dependency of Object.keys(pkg.peerDependencies || {})) external.push(dependency);
170
170
  for (const dependency of Object.keys(pkg.optionalDependencies || {})) external.push(dependency);
171
171
  }
172
- const absoluteImportPlugin = {
173
- name: "absolute-import-resolver",
174
- resolveId(source) {
175
- if (external.includes(source)) return {
176
- id: source,
177
- external: true
178
- };
179
- return null;
180
- }
181
- };
182
172
  const tsconfig = await findNearestTsconfig(baseDir);
183
173
  const relativeOutputDir = args.out;
184
174
  const outputDir = join(baseDir, relativeOutputDir);
@@ -187,8 +177,12 @@ const rolldown = async (args) => {
187
177
  input: entrypointPath,
188
178
  cwd: baseDir,
189
179
  platform: "node",
190
- external: /node_modules/,
191
- plugins: [absoluteImportPlugin],
180
+ external: (source) => {
181
+ if (source.startsWith(".") || source.startsWith("/")) return false;
182
+ return external.some((pkg$1) => {
183
+ return source === pkg$1 || source.startsWith(pkg$1 + "/");
184
+ });
185
+ },
192
186
  tsconfig,
193
187
  output: {
194
188
  dir: outputDir,
@@ -235,7 +229,14 @@ const rolldown = async (args) => {
235
229
 
236
230
  //#endregion
237
231
  //#region src/find-entrypoint.ts
238
- const frameworks = ["express", "hono"];
232
+ const frameworks = [
233
+ "express",
234
+ "hono",
235
+ "elysia",
236
+ "fastify",
237
+ "@nestjs/core",
238
+ "h3"
239
+ ];
239
240
  const entrypointFilenames = [
240
241
  "app",
241
242
  "index",
@@ -292,6 +293,11 @@ const getBuildSummary = async (outputDir) => {
292
293
  };
293
294
  const build = async (args) => {
294
295
  const entrypoint = args.entrypoint || await findEntrypoint(args.cwd);
296
+ const tsPromise = typescript({
297
+ ...args,
298
+ entrypoint,
299
+ workPath: args.cwd
300
+ });
295
301
  const rolldownResult = await rolldown({
296
302
  ...args,
297
303
  entrypoint,
@@ -300,12 +306,9 @@ const build = async (args) => {
300
306
  out: args.out
301
307
  });
302
308
  await writeFile(join(args.cwd, args.out, ".cervel.json"), JSON.stringify({ handler: rolldownResult.result.handler }, null, 2));
303
- const tsPromise = typescript({
304
- ...args,
305
- entrypoint,
306
- workPath: args.cwd
307
- });
308
309
  console.log(Colors.gray(`${Colors.bold(Colors.cyan("✓"))} Build complete`));
310
+ const typecheckComplete = true;
311
+ if (!await Promise.race([tsPromise.then(() => typecheckComplete), Promise.resolve(false)])) console.log(Colors.gray(`${Colors.bold(Colors.gray("*"))} Waiting for typecheck...`));
309
312
  return {
310
313
  rolldownResult: rolldownResult.result,
311
314
  tsPromise
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vercel/cervel",
3
- "version": "0.0.3",
3
+ "version": "0.0.5",
4
4
  "license": "Apache-2.0",
5
5
  "homepage": "https://vercel.com/docs",
6
6
  "publishConfig": {
@@ -14,10 +14,12 @@
14
14
  "sideEffects": false,
15
15
  "type": "module",
16
16
  "exports": {
17
- "./cli": "./dist/cli.js",
18
- ".": "./dist/index.js"
17
+ "./cli": "./dist/cli.mjs",
18
+ ".": {
19
+ "import": "./dist/index.mjs",
20
+ "types": "./dist/index.d.mts"
21
+ }
19
22
  },
20
- "types": "./dist/index.d.ts",
21
23
  "bin": {
22
24
  "cervel": "./bin/cervel.mjs"
23
25
  },
@@ -37,7 +39,7 @@
37
39
  "devDependencies": {
38
40
  "@types/node": "24.7.0",
39
41
  "typescript": "4.9.5",
40
- "tsdown": "0.15.6",
42
+ "tsdown": "0.16.3",
41
43
  "vitest": "^2.0.1"
42
44
  },
43
45
  "scripts": {
File without changes
File without changes