Skip to content

Commit

Permalink
latest rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
guybedford committed Jan 12, 2025
1 parent a3e42b6 commit dba52c3
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 8 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ If using more modern features like CSS Modules or JSON Modules, these need to be

```html
<script>
window.esmsInitOptions = { polyfillEnable: ['css-modules', 'json-modules', 'wasm-modules'] }
window.esmsInitOptions = { polyfillEnable: ['css-modules', 'json-modules', 'wasm-modules', 'typescript'] }
</script>
```

Expand Down
4 changes: 2 additions & 2 deletions chompfile.toml
Original file line number Diff line number Diff line change
Expand Up @@ -93,12 +93,12 @@ dep = 'test:'
[[task]]
name = 'test:#'
serial = true
deps = ['npm:install', 'dist/es-module-shims.js', 'dist/es-module-shims.wasm.js', 'dist/es-module-shims.dev.js', 'test/test-#.html']
deps = ['npm:install', 'dist/es-module-shims.js', 'dist/es-module-shims.wasm.js', 'dist/es-module-shims-typescript.js', 'test/test-#.html']
run = 'node test/server.mjs test-${{ MATCH }}'

[[task]]
name = 'test:firefox'
env = { CI_BROWSER = 'C:\Program Files\Mozilla Firefox\firefox.exe', CI_BROWSER_FLAGS = '-headless', CI_BROWSER_FLUSH = 'taskkill /IM firefox.exe /F' }
serial = true
deps = ['npm:install', 'dist/es-module-shims.js', 'dist/es-module-shims.wasm.js', 'dist/es-module-shims.dev.js', 'test/test-#.html']
deps = ['npm:install', 'dist/es-module-shims.js', 'dist/es-module-shims.wasm.js', 'dist/es-module-shims-typescript.js', 'test/test-#.html']
run = 'node test/server.mjs test-${{ MATCH }}'
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,16 @@
"./wasm": {
"types": "./index.d.ts",
"default": "./dist/es-module-shims.wasm.js"
}
},
"./typescript-transform": "./dist/es-module-shims-typescript.js"
},
"types": "index.d.ts",
"type": "module",
"files": [
"dist/es-module-shims.debug.js",
"dist/es-module-shims.dev.js",
"dist/es-module-shims.js",
"dist/es-module-shims.wasm.js",
"dist/es-module-shims-typescript.js",
"index.d.ts"
],
"author": "Guy Bedford",
Expand Down
4 changes: 2 additions & 2 deletions src/es-module-shims.js
Original file line number Diff line number Diff line change
Expand Up @@ -473,10 +473,10 @@ const sourceURLCommentPrefix = '\n//# sourceURL=';
const sourceMapURLCommentPrefix = '\n//# sourceMappingURL=';

const jsContentType = /^(text|application)\/(x-)?javascript(;|$)/;
const wasmContentType = /^(application)\/wasm(;|$)/;
const wasmContentType = /^application\/wasm(;|$)/;
const jsonContentType = /^(text|application)\/json(;|$)/;
const cssContentType = /^(text|application)\/css(;|$)/;
const tsContentType = /^video\/mp2t(;|$)/;
const tsContentType = /^(application\/typescript|video\/mp2t)(;|$)|/;

const cssUrlRegEx = /url\(\s*(?:(["'])((?:\\.|[^\n\\"'])+)\1|((?:\\.|[^\s,"'()\\])+))\s*\)/g;

Expand Down
3 changes: 2 additions & 1 deletion test/server.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ const mimes = {
'.js': 'application/javascript',
'.mjs': 'application/javascript',
'.json': 'application/json',
'.wasm': 'application/wasm'
'.wasm': 'application/wasm',
'.ts': 'application/typescript'
};

const shouldExit = process.env.WATCH_MODE !== 'true';
Expand Down
3 changes: 3 additions & 0 deletions test/test-ts.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,7 @@
}
</script>

<script type="text/typescript">
</script>

<div id="mocha"></div>

0 comments on commit dba52c3

Please sign in to comment.