File tree Expand file tree Collapse file tree 7 files changed +270
-14
lines changed
Expand file tree Collapse file tree 7 files changed +270
-14
lines changed Original file line number Diff line number Diff line change 4444 run : |
4545 micromamba activate untarjs
4646
47- yarn run build:prod
47+ yarn run build
4848
4949 - name : Run eslint
5050 run : |
Original file line number Diff line number Diff line change @@ -5,4 +5,4 @@ In order to make a new release:
55- Commit the change with the message "Release x.x.x" on the ` main ` branch
66- Create a tag ` git tag x.x.x `
77- Push the new commit and the tag ` git push https://github.com/emscripten-forge/untarjs main x.x.x `
8- - Build and publish ` git clean -fdx && yarn && yarn run build:prod && npm publish `
8+ - Build and publish ` git clean -fdx && yarn && yarn run build && npm publish `
Original file line number Diff line number Diff line change 55 "main" : " lib/index.js" ,
66 "types" : " lib/index.d.ts" ,
77 "scripts" : {
8+ "build" : " yarn run clean && tsc && yarn run build:wasm && copyfiles -u 1 \" src/**/*.d.ts\" lib" ,
89 "build:wasm" : " node build_wasm.js" ,
910 "clean" : " rimraf lib && rimraf tsconfig.tsbuildinfo" ,
10- "build" : " yarn run clean && tsc && yarn run build:wasm" ,
11- "build:prod" : " yarn run clean && tsc && yarn run build:wasm" ,
1211 "prettier" : " prettier --list-different --write \" src/**/*.ts\" " ,
1312 "prettier:check" : " prettier --check \" src/**/*.ts\" " ,
1413 "eslint" : " eslint --ext .ts --fix ." ,
4443 },
4544 "devDependencies" : {
4645 "@eslint/js" : " ^9.13.0" ,
46+ "@types/copyfiles" : " ^2" ,
4747 "@types/node" : " ^22.8.1" ,
4848 "@typescript-eslint/eslint-plugin" : " ~6.13.2" ,
4949 "@typescript-eslint/parser" : " ~6.13.2" ,
50+ "copyfiles" : " ^2.4.1" ,
5051 "eslint" : " ~8.55.0" ,
5152 "eslint-config-prettier" : " ~9.1.0" ,
5253 "eslint-plugin-prettier" : " ~5.0.1" ,
Original file line number Diff line number Diff line change 11import unpack , { IWasmModule } from './unpack' ;
22import unpackWasm from './unpack.wasm' ;
33
4- const initializeWasm = async ( ) : Promise < IWasmModule > => {
4+ const initializeWasm = async ( locateWasm ?: ( file : string ) => string ) : Promise < IWasmModule > => {
55 const wasmModule : IWasmModule = await unpack ( {
66 locateFile ( path : string ) {
77 if ( path . endsWith ( '.wasm' ) ) {
8+ if ( locateWasm ) {
9+ return locateWasm ( path ) ;
10+ }
811 return unpackWasm ;
912 }
1013 return path ;
Original file line number Diff line number Diff line change 11import initializeWasm from './helper' ;
22import { FilesData , IUnpackJSAPI } from './types' ;
33
4- const fetchByteArray = async ( url : string ) : Promise < Uint8Array > => {
4+ export const fetchByteArray = async ( url : string ) : Promise < Uint8Array > => {
55 const response = await fetch ( url ) ;
66 if ( ! response . ok ) {
77 throw new Error ( `HTTP error! status: ${ response . status } ` ) ;
@@ -10,8 +10,8 @@ const fetchByteArray = async (url: string): Promise<Uint8Array> => {
1010 return new Uint8Array ( arrayBuffer ) ;
1111} ;
1212
13- export const initUntarJS = async ( ) : Promise < IUnpackJSAPI > => {
14- const wasmModule = await initializeWasm ( ) ;
13+ export const initUntarJS = async ( locateWasm ?: ( file : string ) => string ) : Promise < IUnpackJSAPI > => {
14+ const wasmModule = await initializeWasm ( locateWasm ) ;
1515
1616 const extractData = async (
1717 data : Uint8Array ,
Original file line number Diff line number Diff line change 11export type FilesData = { [ filename : string ] : Uint8Array } ;
22
33export interface IUnpackJSAPI {
4- extractData : ( data : Uint8Array ) => Promise < FilesData > ;
4+ extractData : ( data : Uint8Array , decompressionOnly ?: boolean ) => Promise < FilesData > ;
55 extract : ( url : string ) => Promise < FilesData > ;
66}
You can’t perform that action at this time.
0 commit comments