HiraokaHyperTools / msgreader

40 stars 9 forks source link

Please make version targeting ES5 #8

Closed daweffe closed 1 year ago

daweffe commented 4 years ago

Either this library or a dependency is using ES6 features. I love the text decoding in this msgreader library, but I need to be able to support IE 11.

kenjiuno commented 4 years ago

I have tweaked tsconfig.json and package.json in order to support optionally building ES5 CommonJS module, by using TypeScript compiler instead of babel @babel/typescript.

Try yarn build:use-tsc

H:\Proj\msgreader>yarn build:use-tsc
yarn run v1.22.4
$ tsc
Done in 2.84s.

Files are written under lib dir

H:\Proj\msgreader>dir lib
 Volume in drive H is 新新新H
 Volume Serial Number is 6AC3-C354

 Directory of H:\Proj\msgreader\lib

2020/11/11  10:33    <DIR>          .
2020/11/11  10:33    <DIR>          ..
2020/11/11  10:35             2,200 const.d.ts
2020/11/11  10:35             2,583 const.js
2020/11/11  10:35            25,992 DataStream.d.ts
2020/11/11  10:35            61,165 DataStream.js
2020/11/11  10:35                65 index.d.ts
2020/11/11  10:35               321 index.js
2020/11/11  10:35             4,107 MsgReader.d.ts
2020/11/11  10:35            19,766 MsgReader.js
2020/11/11  10:35               146 utils.d.ts
2020/11/11  10:35               686 utils.js
              10 File(s)        117,031 bytes
               2 Dir(s)  163,964,387,328 bytes free

build:use-tsc is simply command tsc in package.json

{
  ...
  "scripts": {
    "build": "npm run build:types && npm run build:js",
    "build:js": "babel src --out-dir lib --extensions .ts",
    "build:types": "tsc --emitDeclarationOnly",
    "build:use-tsc": "tsc",

Edit tsconfig.json on your demand:

{
    "compilerOptions": {
        "target": "ES5",
        "module": "CommonJS",
        "declaration": true,
        "outDir": "lib",
        "allowSyntheticDefaultImports": true,
        "esModuleInterop": true,
    },
}

tsconfig help will be found at https://www.typescriptlang.org/tsconfig

daweffe commented 3 years ago

Thanks for the quick reply and help. I have been distracted by other things I am working on. Using this library to read .msg files is a side project.

github-actions[bot] commented 1 year ago

This issue is stale because it has been open for 30 days with no activity.

github-actions[bot] commented 1 year ago

This issue was closed because it has been inactive for 14 days since being marked as stale.