Skip to content

Commit

Permalink
updates esbuild (to support jsr for example)
Browse files Browse the repository at this point in the history
  • Loading branch information
mattvr committed Jul 10, 2024
1 parent ce8257c commit 8cae3d8
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 12 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ JS-powered web sites entirely using Deno.
2. Run the following command to install dsbuild:

```sh
deno install -frA -n dsbuild https://deno.land/x/dsbuild/mod.ts
deno install -frAg -n dsbuild https://deno.land/x/dsbuild/mod.ts
```

3. Ensure `$HOME/.deno/bin` is in your `PATH` environment variable.
Expand Down
16 changes: 7 additions & 9 deletions deps.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
// Import the WASM build on platforms where running subprocesses is not
// permitted, such as Deno Deploy, or when running without `--allow-run`.
import * as esbuild from "https://deno.land/x/[email protected]/mod.js";
// import * as esbuild from "https://deno.land/x/[email protected]/wasm.js";

import * as esbuild from "npm:esbuild@^0.23.0"
import { compile as compileMdx } from "https://esm.sh/@mdx-js/[email protected]"
import { renderToStaticMarkup as compileReactStatic } from "https://esm.sh/[email protected]/server"
import { denoLoaderPlugin, denoResolverPlugin } from "https://deno.land/x/[email protected]/mod.ts";
import {parseArgs} from "https://deno.land/[email protected]/cli/parse_args.ts";
import { isAbsolute, join, resolve, normalize, dirname } from "https://deno.land/[email protected]/path/mod.ts";
import { denoLoaderPlugin, denoResolverPlugin } from "jsr:@luca/esbuild-deno-loader@^0.10.3";
import React from "https://esm.sh/[email protected]";
import {parseArgs} from "jsr:@std/cli@^0.224.7/parse-args";
import { isAbsolute, join, resolve, normalize, dirname, extname, parse } from 'jsr:@std/path@^0.225.2'

export {
// esbuild
Expand All @@ -33,5 +29,7 @@ export {
join,
resolve,
normalize,
dirname
dirname,
extname,
parse
}
11 changes: 9 additions & 2 deletions mod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ import { isAbsolute, join, resolve, normalize } from "./deps.ts";
import { serve, setServeDir } from "./serve.ts";
import { compileMdx, mdxPlugin } from './plugin-mdx.ts'
import { compileReactStatic } from "./plugin-react-static.tsx";
import { extname, parse } from "https://deno.land/[email protected]/path/mod.ts";
import { extname, parse } from "./deps.ts";

export const VERSION = "0.1.2"

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

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

const isHelp = args["help"] || args["h"];
const isVersion = args["version"] || args["v"];

if (isHelp) {
console.log(helpText);
Deno.exit(0);
}
if (isVersion) {
console.log(VERSION);
Deno.exit(0);
}

const generateTsConfig = args['tsconfig'] || false;
const generateDenoConfig = args['denoconfig'] || false;
Expand Down

0 comments on commit 8cae3d8

Please sign in to comment.