Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 63 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: ci

on: [push, pull_request]

concurrency:
group: "${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}"
cancel-in-progress: true

jobs:
deno:
if: |
github.event_name == 'push' ||
!startsWith(github.event.pull_request.head.label, 'denoland:')
runs-on: ubuntu-latest
timeout-minutes: 30

steps:
- uses: actions/checkout@v4
with:
submodules: true

- uses: denoland/setup-deno@v2
with:
deno-version: canary

- uses: Swatinem/rust-cache@v2
with:
workspaces: src/rs_lib

- name: build
run: deno task wasmbuild

- name: fmt
run: deno fmt --check

- name: lint
run: deno lint

- name: check
run: deno check --doc

- name: test
run: deno test -A

jsr:
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@v4
with:
submodules: true
- uses: denoland/setup-deno@v2
with:
deno-version: canary
- uses: Swatinem/rust-cache@v2
with:
workspaces: src/rs_lib
- name: build
run: deno task wasmbuild
- name: Publish to JSR on tag
run: deno run -A jsr:@david/publish-on-tag@0.2.0
4 changes: 4 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[submodule "deno"]
path = deno
url = https://github.com/denoland/deno
shallow = true
11 changes: 0 additions & 11 deletions Cargo.toml

This file was deleted.

1 change: 1 addition & 0 deletions deno
Submodule deno added at 1a8e5e
8 changes: 5 additions & 3 deletions deno.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
{
"name": "@deno/loader",
"version": "0.0.8",
"tasks": {
"wasmbuild": "deno run -A jsr:@deno/wasmbuild@0.19.2 --out ./src/lib"
"wasmbuild": "cd src/rs_lib && deno run -A jsr:@deno/wasmbuild@0.19.2 --out ../lib"
},
"publish": {
"exclude": [
Expand All @@ -12,7 +11,10 @@
},
"exports": "./src/mod.ts",
"exclude": [
"./target",
".vscode",
"deno",
"src/rs_lib/target",
"target",
"tests/jsx/testdata"
],
"imports": {
Expand Down
File renamed without changes.
File renamed without changes.
14 changes: 10 additions & 4 deletions src/rs_lib/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,18 @@ deno_cache_dir = { version = "0.22.2", features = ["sync"] }
deno_config = { version = "0.56.0", features = ["workspace", "sync"] }
deno_error = "0.6.1"
deno_graph = { version = "0.95.1", features = ["swc"], default-features = false }
deno_npm_cache = { path = "../../../deno/resolvers/npm_cache" }
deno_npm_installer = { path = "../../../deno/resolvers/npm_installer", default-features = false }
deno_npm_cache = { path = "../../deno/resolvers/npm_cache" }
deno_npm_installer = { path = "../../deno/resolvers/npm_installer", default-features = false }
deno_path_util = "0.4.0"
deno_resolver = { path = "../../../deno/resolvers/deno", features = ["deno_ast", "graph", "sync"] }
deno_resolver = { path = "../../deno/resolvers/deno", features = ["deno_ast", "graph", "sync"] }
deno_semver = "0.8.0"
deno_unsync = { version = "0.4.4", default-features = false }
node_resolver = { path = "../../../deno/resolvers/node", features = ["sync"] }
node_resolver = { path = "../../deno/resolvers/node", features = ["sync"] }
sys_traits = { version = "0.1.16", features = ["real", "wasm"] }
url = "2.5.4"

[profile.release]
codegen-units = 1
incremental = true
lto = true
opt-level = "z"
7 changes: 6 additions & 1 deletion src/rs_lib/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ use std::rc::Rc;
use std::sync::Arc;

use anyhow::bail;
use deno_ast::EmitOptions;
use deno_ast::ModuleKind;
use deno_ast::TranspileModuleOptions;
use deno_ast::TranspileOptions;
Expand Down Expand Up @@ -564,13 +565,17 @@ impl DenoLoader {
} else {
Cow::Borrowed(&transpile_and_emit_options.transpile)
};
let emit_options = EmitOptions {
source_map_base: Some(self.workspace_factory.workspace_directory()?.workspace.root_dir().as_ref().clone()),
..transpile_and_emit_options.emit.clone()
};
let transpiled_source = parsed_source
.transpile(
&transpile_options,
&TranspileModuleOptions {
module_kind: Some(ModuleKind::from_is_cjs(is_cjs)),
},
&transpile_and_emit_options.emit,
&emit_options,
)?
.into_source()
.text;
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions tests/jsx/main.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ Deno.test("loads jsx transpiled", async () => {
});

const mainJsxSourceMappingURL =
"//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImZpbGU6Ly8vVjovZGVuby1qcy1sb2FkZXIvdGVzdHMvanN4L3Rlc3RkYXRhL21haW4uanN4Il0sInNvdXJjZXNDb250ZW50IjpbImNvbnNvbGUubG9nKDxkaXYgLz4pO1xuIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7QUFBQSxRQUFRLEdBQUcifQ==";
"//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm1haW4uanN4Il0sInNvdXJjZXNDb250ZW50IjpbImNvbnNvbGUubG9nKDxkaXYgLz4pO1xuIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7QUFBQSxRQUFRLEdBQUcifQ==";
const mainTsxSourceMappingURL =
"//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImZpbGU6Ly8vVjovZGVuby1qcy1sb2FkZXIvdGVzdHMvanN4L3Rlc3RkYXRhL21haW4udHN4Il0sInNvdXJjZXNDb250ZW50IjpbImNvbnN0IHZhbHVlOiBzdHJpbmcgPSBcIlwiO1xuY29uc29sZS5sb2coPGRpdiAvPiwgdmFsdWUpO1xuIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE1BQU0sUUFBZ0I7QUFDdEIsUUFBUSxHQUFHLEVBQUUsT0FBUSJ9";
"//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm1haW4udHN4Il0sInNvdXJjZXNDb250ZW50IjpbImNvbnN0IHZhbHVlOiBzdHJpbmcgPSBcIlwiO1xuY29uc29sZS5sb2coPGRpdiAvPiwgdmFsdWUpO1xuIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE1BQU0sUUFBZ0I7QUFDdEIsUUFBUSxHQUFHLEVBQUUsT0FBUSJ9";
const mainJsxUrl = loader.resolve(mainJsx, undefined, ResolutionMode.Import);
const mainTsxUrl = loader.resolve(mainTsx, undefined, ResolutionMode.Import);

Expand Down
Loading