mirror of
https://github.com/mdgriffith/elm-optimize-level-2.git
synced 2024-11-25 22:50:42 +03:00
Merge branch 'master' of https://github.com/mdgriffith/elm-optimize-level-2
This commit is contained in:
commit
203f251dd2
@ -1,8 +1,7 @@
|
|||||||
import * as fs from 'fs';
|
import * as fs from 'fs';
|
||||||
import * as path from 'path';
|
import * as path from 'path';
|
||||||
import { Transforms, RunTestcaseOptions, InlineLists, BrowserOptions, Browser } from '../types';
|
import { Transforms, RunTestcaseOptions, InlineLists, BrowserOptions, Browser, emptyOpts } from '../types';
|
||||||
import * as Visit from './visit';
|
import * as Visit from './visit';
|
||||||
import chalk from 'chalk';
|
|
||||||
import * as Transform from '../transform';
|
import * as Transform from '../transform';
|
||||||
import { compileToStringSync } from 'node-elm-compiler';
|
import { compileToStringSync } from 'node-elm-compiler';
|
||||||
import * as Post from '../postprocess';
|
import * as Post from '../postprocess';
|
||||||
@ -251,26 +250,6 @@ export const run = async function (
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const emptyOpts: Transforms = {
|
|
||||||
replaceVDomNode: false,
|
|
||||||
variantShapes: false,
|
|
||||||
inlineNumberToString: false,
|
|
||||||
inlineFunctions: false,
|
|
||||||
inlineEquality: false,
|
|
||||||
listLiterals: false,
|
|
||||||
passUnwrappedFunctions: false,
|
|
||||||
arrowFns: false,
|
|
||||||
shorthandObjectLiterals: false,
|
|
||||||
objectUpdate: false,
|
|
||||||
unusedValues: false,
|
|
||||||
replaceListFunctions: false,
|
|
||||||
replaceStringFunctions: false,
|
|
||||||
recordUpdates: false,
|
|
||||||
v8Analysis: false,
|
|
||||||
replacements: null
|
|
||||||
};
|
|
||||||
|
|
||||||
const breakdown = function (
|
const breakdown = function (
|
||||||
options: Transforms
|
options: Transforms
|
||||||
): { name: string; options: Transforms }[] {
|
): { name: string; options: Transforms }[] {
|
||||||
|
@ -27,10 +27,10 @@ Give me an Elm file, I'll compile it behind the scenes using Elm 0.19.1, and the
|
|||||||
)
|
)
|
||||||
.usage('[options] <src/Main.elm>')
|
.usage('[options] <src/Main.elm>')
|
||||||
.option('--output <output>', 'the javascript file to create.', 'elm.js')
|
.option('--output <output>', 'the javascript file to create.', 'elm.js')
|
||||||
|
.option('-O3, --optimize-speed', 'Enable optimizations that likely increases asset size', false)
|
||||||
.option('--init-benchmark <dir>', 'Generate some files to help run benchmarks')
|
.option('--init-benchmark <dir>', 'Generate some files to help run benchmarks')
|
||||||
.option('--benchmark <dir>', 'Run the benchmark in the given directory.')
|
.option('--benchmark <dir>', 'Run the benchmark in the given directory.')
|
||||||
.option('--replacements <dir>', 'Replace stuff')
|
.option('--replacements <dir>', 'Replace stuff')
|
||||||
.option('-O3, --optimize-speed', 'Enable optimizations that likely increases asset size', false)
|
|
||||||
.parse(process.argv);
|
.parse(process.argv);
|
||||||
|
|
||||||
async function run(inputFilePath: string | undefined) {
|
async function run(inputFilePath: string | undefined) {
|
||||||
|
24
src/types.ts
24
src/types.ts
@ -75,6 +75,28 @@ export enum Browser {
|
|||||||
|
|
||||||
export const unallowedChars = /[^A-Za-z0-9]/g;
|
export const unallowedChars = /[^A-Za-z0-9]/g;
|
||||||
|
|
||||||
|
|
||||||
|
export const emptyOpts: Transforms = {
|
||||||
|
replaceVDomNode: false,
|
||||||
|
variantShapes: false,
|
||||||
|
inlineNumberToString: false,
|
||||||
|
inlineFunctions: false,
|
||||||
|
inlineEquality: false,
|
||||||
|
listLiterals: false,
|
||||||
|
passUnwrappedFunctions: false,
|
||||||
|
arrowFns: false,
|
||||||
|
shorthandObjectLiterals: false,
|
||||||
|
objectUpdate: false,
|
||||||
|
unusedValues: false,
|
||||||
|
replaceListFunctions: false,
|
||||||
|
replaceStringFunctions: false,
|
||||||
|
recordUpdates: false,
|
||||||
|
v8Analysis: false,
|
||||||
|
fastCurriedFns: false,
|
||||||
|
replacements: null
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
export function toolDefaults(o3Enabled: boolean, replacements: { string: string } | null): Transforms {
|
export function toolDefaults(o3Enabled: boolean, replacements: { string: string } | null): Transforms {
|
||||||
return {
|
return {
|
||||||
replaceVDomNode: false,
|
replaceVDomNode: false,
|
||||||
@ -112,7 +134,7 @@ export function benchmarkDefaults(o3Enabled: boolean, replacements: { string: st
|
|||||||
objectUpdate: false,
|
objectUpdate: false,
|
||||||
unusedValues: false,
|
unusedValues: false,
|
||||||
replaceListFunctions: true,
|
replaceListFunctions: true,
|
||||||
replaceStringFunctions: true,
|
replaceStringFunctions: false,
|
||||||
recordUpdates: o3Enabled,
|
recordUpdates: o3Enabled,
|
||||||
v8Analysis: false,
|
v8Analysis: false,
|
||||||
fastCurriedFns: true,
|
fastCurriedFns: true,
|
||||||
|
Loading…
Reference in New Issue
Block a user