Skip to content

Commit 8cae3d8

Browse files
committed
updates esbuild (to support jsr for example)
1 parent ce8257c commit 8cae3d8

3 files changed

Lines changed: 17 additions & 12 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ JS-powered web sites entirely using Deno.
3535
2. Run the following command to install dsbuild:
3636

3737
```sh
38-
deno install -frA -n dsbuild https://deno.land/x/dsbuild/mod.ts
38+
deno install -frAg -n dsbuild https://deno.land/x/dsbuild/mod.ts
3939
```
4040

4141
3. Ensure `$HOME/.deno/bin` is in your `PATH` environment variable.

deps.ts

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,10 @@
1-
// Import the WASM build on platforms where running subprocesses is not
2-
// permitted, such as Deno Deploy, or when running without `--allow-run`.
3-
import * as esbuild from "https://deno.land/x/esbuild@v0.19.2/mod.js";
4-
// import * as esbuild from "https://deno.land/x/esbuild@v0.19.2/wasm.js";
5-
1+
import * as esbuild from "npm:esbuild@^0.23.0"
62
import { compile as compileMdx } from "https://esm.sh/@mdx-js/mdx@3.0.0"
73
import { renderToStaticMarkup as compileReactStatic } from "https://esm.sh/react-dom@18.2.0/server"
8-
import { denoLoaderPlugin, denoResolverPlugin } from "https://deno.land/x/esbuild_deno_loader@0.8.2/mod.ts";
9-
import {parseArgs} from "https://deno.land/std@0.208.0/cli/parse_args.ts";
10-
import { isAbsolute, join, resolve, normalize, dirname } from "https://deno.land/std@0.208.0/path/mod.ts";
4+
import { denoLoaderPlugin, denoResolverPlugin } from "jsr:@luca/esbuild-deno-loader@^0.10.3";
115
import React from "https://esm.sh/react@18.2.0";
6+
import {parseArgs} from "jsr:@std/cli@^0.224.7/parse-args";
7+
import { isAbsolute, join, resolve, normalize, dirname, extname, parse } from 'jsr:@std/path@^0.225.2'
128

139
export {
1410
// esbuild
@@ -33,5 +29,7 @@ export {
3329
join,
3430
resolve,
3531
normalize,
36-
dirname
32+
dirname,
33+
extname,
34+
parse
3735
}

mod.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@ import { isAbsolute, join, resolve, normalize } from "./deps.ts";
77
import { serve, setServeDir } from "./serve.ts";
88
import { compileMdx, mdxPlugin } from './plugin-mdx.ts'
99
import { compileReactStatic } from "./plugin-react-static.tsx";
10-
import { extname, parse } from "https://deno.land/std@0.208.0/path/mod.ts";
10+
import { extname, parse } from "./deps.ts";
11+
12+
export const VERSION = "0.1.2"
1113

1214
const isDev = Deno.env.get("DENO_ENV") === "development";
1315
let isFirstBuild = true;
@@ -432,7 +434,7 @@ export const buildReactStatic = async (options: {
432434
}
433435

434436
if (import.meta.main) {
435-
const helpText = `dsbuild - Deno + esbuild
437+
const helpText = `dsbuild (Deno + esbuild) v${VERSION}
436438
437439
This is a simple build tool for Deno + esbuild. It compiles Deno TypeScript
438440
to a single JavaScript file that can be run in the browser.
@@ -466,11 +468,16 @@ Example usage:
466468
const args = parseArgs(Deno.args);
467469

468470
const isHelp = args["help"] || args["h"];
471+
const isVersion = args["version"] || args["v"];
469472

470473
if (isHelp) {
471474
console.log(helpText);
472475
Deno.exit(0);
473476
}
477+
if (isVersion) {
478+
console.log(VERSION);
479+
Deno.exit(0);
480+
}
474481

475482
const generateTsConfig = args['tsconfig'] || false;
476483
const generateDenoConfig = args['denoconfig'] || false;

0 commit comments

Comments
 (0)