Skip to content
This repository has been archived by the owner on Aug 1, 2024. It is now read-only.

Commit

Permalink
Merge pull request #5 from Tsukina-7mochi/refactor
Browse files Browse the repository at this point in the history
Refactored and re-implemented all scripts
  • Loading branch information
Tsukina-7mochi authored Mar 8, 2024
2 parents 609949b + 3790425 commit 26096ee
Show file tree
Hide file tree
Showing 143 changed files with 4,873 additions and 2,725 deletions.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# test coverage
coverage

*.orig
*.pyc
*.swp
Expand Down Expand Up @@ -36,4 +39,4 @@ cli/tests/.test_coverage/

# WPT generated cert files
/tools/wpt/certs/index.txt*
/tools/wpt/certs/serial*
/tools/wpt/certs/serial*
23 changes: 14 additions & 9 deletions deno.json
Original file line number Diff line number Diff line change
@@ -1,32 +1,42 @@
{
"importMap": "import_map.json",
"compilerOptions": {
"allowJs": true,
"strict": true,
"strictNullChecks": true,
"noImplicitThis": true,
"noImplicitAny": true,
"noUnusedParameters": true,
"noImplicitReturns": true,
"lib": [
"ESNext",
"deno.window"
]
},
"exclude": [
"example/*/bundle.js"
],
"lint": {
"include": [
"mod.ts",
"deps.ts"
"deps.ts",
"src/"
],
"rules": {
"tags": [
"recommended"
],
"include": [
"explicit-function-return-type"
]
}
},
"fmt": {
"include": [
"mod.ts",
"deps.ts",
"example/"
"example/",
"src/"
],
"indentWidth": 2,
"lineWidth": 80,
Expand All @@ -36,12 +46,7 @@
},
"tasks": {
"build": "bash ./example/cache.sh && deno run -A ./example/build.ts",
"test": "bash ./test/build/cache.sh && deno test -A",
"test:unit": "deno test -A test/unit",
"test:build": "bash ./test/build/cache.sh && deno test -A test/build",
"debug:build": "bash ./example/cache.sh && deno run -A --inspect-brk ./example/build.ts",
"debug:test": "bash ./test/cache.sh && deno test -A --inspect-brk",
"debug:test:unit": "deno test -A --inspect-brk test/unit",
"debug:test:build": "bash ./test/build/cache.sh && deno test -A --inspect-brk test/build"
"test": "deno test -A",
"test:unit": "deno test -A test/unit"
}
}
241 changes: 143 additions & 98 deletions deno.lock

Large diffs are not rendered by default.

7 changes: 3 additions & 4 deletions deps.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
export * as esbuild from 'https://deno.land/x/[email protected]/mod.js';
export { posix } from 'https://deno.land/[email protected]/path/mod.ts';
export * as fs from 'https://deno.land/[email protected]/fs/mod.ts';
export { crypto } from 'https://deno.land/[email protected]/crypto/mod.ts';
export * as asserts from 'https://deno.land/[email protected]/testing/asserts.ts';
export * as path from 'https://deno.land/[email protected]/path/mod.ts';
export * as fs from 'https://deno.land/[email protected]/fs/mod.ts';
export { crypto } from 'https://deno.land/[email protected]/crypto/mod.ts';
2 changes: 0 additions & 2 deletions example/.gitignore

This file was deleted.

36 changes: 0 additions & 36 deletions example/build.ts

This file was deleted.

5 changes: 0 additions & 5 deletions example/cache.sh

This file was deleted.

1 change: 1 addition & 0 deletions example/ignore-modules/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/bundle.js
22 changes: 22 additions & 0 deletions example/ignore-modules/build.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { esbuild } from '../../deps.ts';
import esbuildCachePlugin from '../../mod.ts';

const lockMap = JSON.parse(Deno.readTextFileSync('./deno.lock'));

const denoPath = await esbuildCachePlugin.util.getDenoDir();
await esbuild.build({
entryPoints: ['./index.ts'],
bundle: true,
outfile: './bundle.js',
plugins: [
esbuildCachePlugin({
denoCacheDirectory: denoPath,
lockMap,
loaderRules: [
{ test: /^node:/, loader: 'empty' },
],
}),
],
});

await esbuild.stop();
9 changes: 9 additions & 0 deletions example/ignore-modules/deno.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"tasks": {
"build": "deno run -A build.ts",
"cache": "rm deno.lock && deno cache **/*.ts",
"clean": "rm -f bundle.js",
"run:bundle": "deno run bundle.js",
"run:raw": "deno run index.ts"
}
}
122 changes: 122 additions & 0 deletions example/ignore-modules/deno.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions example/ignore-modules/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import 'node:fs';
import 'node:util';

console.log('/index.ts');
15 changes: 15 additions & 0 deletions example/ignore-modules/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Example: Ignoring Modules

You can ignore specific module import with `loaderRules` option by mapping
`empty` loader to `node:` modules:

```javascript
esbuildCachePlugin({
loaderRules: [
// ignore node core modules
{ test: /^node:/, loader: 'empty' },
],
});
```

You can also map other patterns to loaders such as `.css$` to `css` loader.
1 change: 1 addition & 0 deletions example/import-map/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/bundle.js
21 changes: 21 additions & 0 deletions example/import-map/build.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { esbuild } from '../../deps.ts';
import esbuildCachePlugin from '../../mod.ts';

const importMap = JSON.parse(Deno.readTextFileSync('./import_map.json'));
const lockMap = JSON.parse(Deno.readTextFileSync('./deno.lock'));

const denoPath = await esbuildCachePlugin.util.getDenoDir();
await esbuild.build({
entryPoints: ['./src/index.ts'],
bundle: true,
outfile: './bundle.js',
plugins: [
esbuildCachePlugin({
denoCacheDirectory: denoPath,
lockMap,
importMap,
}),
],
});

await esbuild.stop();
Loading

0 comments on commit 26096ee

Please sign in to comment.