Skip to content

Commit

Permalink
first try
Browse files Browse the repository at this point in the history
  • Loading branch information
balazs-lengyel committed May 10, 2022
1 parent e51955f commit d92237b
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 14 deletions.
4 changes: 2 additions & 2 deletions packages/transformers/elm/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@
"dependencies": {
"@parcel/diagnostic": "2.5.0",
"@parcel/plugin": "2.5.0",
"@swc/core": "^1.2.106",
"command-exists": "^1.2.8",
"cross-spawn": "^7.0.3",
"elm-hot": "^1.1.5",
"node-elm-compiler": "^5.0.5",
"nullthrows": "^1.1.1",
"terser": "^5.2.1"
"nullthrows": "^1.1.1"
},
"peerDependencies": {
"elm": "^0.19.1-5"
Expand Down
29 changes: 17 additions & 12 deletions packages/transformers/elm/src/ElmTransformer.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {Transformer} from '@parcel/plugin';
import commandExists from 'command-exists';
import spawn from 'cross-spawn';
import path from 'path';
import {minify} from 'terser';
import {minify} from "@swc/core";
import nullthrows from 'nullthrows';
import ThrowableDiagnostic from '@parcel/diagnostic';
// $FlowFixMe
Expand Down Expand Up @@ -144,17 +144,22 @@ async function minifyElmOutput(source) {
// Recommended minification
// Based on: http://elm-lang.org/0.19.0/optimize
let result = await minify(source, {
compress: {
keep_fargs: false,
passes: 2,
pure_funcs: elmPureFuncs,
pure_getters: true,
unsafe: true,
unsafe_comps: true,
},
mangle: {
reserved: elmPureFuncs,
},
minify: true,
jsc: {
minify: {
compress: {
keep_fargs: false,
passes: 2,
pure_funcs: elmPureFuncs,
pure_getters: true,
unsafe: true,
unsafe_comps: true,
},
mangle: {
reserved: elmPureFuncs,
}
}
}
});

if (result.code != null) return result.code;
Expand Down

0 comments on commit d92237b

Please sign in to comment.