-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
swc_ecma_codegen: - Fix sourcemap of `export` tokens. - Fix codegen of numeric operands in left of a binary expression. - Fix codegen of unary operations. swc_ecma_minifier: - Visit `AssignPatProp.valie`. - Move `inline_prevented` to analyzer. - Add `Ctx.dont_invoke_iife`. - `iife`: Check for `arugments` swc: - `inline_sources_content`: true by default for `minify()`.
- Loading branch information
Showing
38 changed files
with
1,459 additions
and
486 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
ecmascript/codegen/tests/fixture/vercel/d3-color/1/input.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import define, { extend } from "./define.js"; | ||
import { Color, rgbConvert, Rgb, darker, brighter } from "./color.js"; | ||
import { deg2rad, rad2deg } from "./math.js"; | ||
var A = -0.14861, B = 1.78277, C = -0.29227, D = -0.90649, E = 1.97294, ED = E * D, EB = E * B, BC_DA = B * C - D * A; | ||
function cubehelixConvert(o) { | ||
if (o instanceof Cubehelix) return new Cubehelix(o.h, o.s, o.l, o.opacity); | ||
o instanceof Rgb || (o = rgbConvert(o)); | ||
var r = o.r / 255, g = o.g / 255, b = o.b / 255, l = (BC_DA * b + ED * r - EB * g) / (BC_DA + ED - EB), bl = b - l, k = (E * (g - l) - C * bl) / D, s = Math.sqrt(k * k + bl * bl) / (E * l * (1 - l)), h = s ? Math.atan2(k, bl) * rad2deg - 120 : NaN; | ||
return new Cubehelix(h < 0 ? h + 360 : h, s, l, o.opacity); | ||
} | ||
export default function cubehelix(h, s, l, opacity) { | ||
return 1 === arguments.length ? cubehelixConvert(h) : new Cubehelix(h, s, l, null == opacity ? 1 : opacity); | ||
}; | ||
export function Cubehelix(h, s, l, opacity) { | ||
this.h = +h, this.s = +s, this.l = +l, this.opacity = +opacity; | ||
} | ||
define(Cubehelix, cubehelix, extend(Color, { | ||
brighter: function (k) { | ||
return k = null == k ? brighter : Math.pow(brighter, k), new Cubehelix(this.h, this.s, this.l * k, this.opacity); | ||
}, | ||
darker: function (k) { | ||
return k = null == k ? darker : Math.pow(darker, k), new Cubehelix(this.h, this.s, this.l * k, this.opacity); | ||
}, | ||
rgb: function () { | ||
var h = isNaN(this.h) ? 0 : (this.h + 120) * deg2rad, l = +this.l, a = isNaN(this.s) ? 0 : this.s * l * (1 - l), cosh = Math.cos(h), sinh = Math.sin(h); | ||
return new Rgb(255 * (l + a * (A * cosh + B * sinh)), 255 * (l + a * (C * cosh + D * sinh)), 255 * (l + a * (E * cosh)), this.opacity); | ||
} | ||
})); |
29 changes: 29 additions & 0 deletions
29
ecmascript/codegen/tests/fixture/vercel/d3-color/1/output.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import define, { extend } from "./define.js"; | ||
import { Color, rgbConvert, Rgb, darker, brighter } from "./color.js"; | ||
import { deg2rad, rad2deg } from "./math.js"; | ||
var A = -0.14861, B = 1.78277, C = -0.29227, D = -0.90649, E = 1.97294, ED = E * D, EB = E * B, BC_DA = B * C - D * A; | ||
function cubehelixConvert(o) { | ||
if (o instanceof Cubehelix) return new Cubehelix(o.h, o.s, o.l, o.opacity); | ||
o instanceof Rgb || (o = rgbConvert(o)); | ||
var r = o.r / 255, g = o.g / 255, b = o.b / 255, l = (BC_DA * b + ED * r - EB * g) / (BC_DA + ED - EB), bl = b - l, k = (E * (g - l) - C * bl) / D, s = Math.sqrt(k * k + bl * bl) / (E * l * (1 - l)), h = s ? Math.atan2(k, bl) * rad2deg - 120 : NaN; | ||
return new Cubehelix(h < 0 ? h + 360 : h, s, l, o.opacity); | ||
} | ||
export default function cubehelix(h, s, l, opacity) { | ||
return 1 === arguments.length ? cubehelixConvert(h) : new Cubehelix(h, s, l, null == opacity ? 1 : opacity); | ||
}; | ||
; | ||
export function Cubehelix(h, s, l, opacity) { | ||
this.h = +h, this.s = +s, this.l = +l, this.opacity = +opacity; | ||
} | ||
define(Cubehelix, cubehelix, extend(Color, { | ||
brighter: function(k) { | ||
return k = null == k ? brighter : Math.pow(brighter, k), new Cubehelix(this.h, this.s, this.l * k, this.opacity); | ||
}, | ||
darker: function(k) { | ||
return k = null == k ? darker : Math.pow(darker, k), new Cubehelix(this.h, this.s, this.l * k, this.opacity); | ||
}, | ||
rgb: function() { | ||
var h = isNaN(this.h) ? 0 : (this.h + 120) * deg2rad, l = +this.l, a = isNaN(this.s) ? 0 : this.s * l * (1 - l), cosh = Math.cos(h), sinh = Math.sin(h); | ||
return new Rgb(255 * (l + a * (A * cosh + B * sinh)), 255 * (l + a * (C * cosh + D * sinh)), 255 * (l + a * (E * cosh)), this.opacity); | ||
} | ||
})); |
1 change: 1 addition & 0 deletions
1
ecmascript/codegen/tests/fixture/vercel/d3-color/1/output.min.js
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.