Skip to content

Commit 222592e

Browse files
authored
Merge pull request #47 from atom-community/asc
feat: add assemblyscript support
2 parents a964ab7 + 65e4553 commit 222592e

3 files changed

Lines changed: 37 additions & 10 deletions

File tree

package.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,17 +35,20 @@
3535
"csso-cli": "^3.0.0",
3636
"array-includes-any": "^2.7.3",
3737
"rollup-plugin-sourcemaps": "^0.6.3",
38-
"rollup-plugin-visualizer": "^4.2.0"
38+
"rollup-plugin-visualizer": "^4.2.0",
39+
"rollup-plugin-assemblyscript": "^1.3.0"
3940
},
4041
"peerDependencies": {
4142
"rollup": "^2"
4243
},
4344
"optionalDependencies": {
4445
"typescript": "^4",
4546
"coffeescript": "^1",
46-
"@babel/core": "^7"
47+
"@babel/core": "^7",
48+
"assemblyscript": "*"
4749
},
4850
"devDependencies": {
51+
"assemblyscript": "*",
4952
"typescript": "^4.0.3",
5053
"rollup": "2.31.0",
5154
"prettier": "^2.2.1",

pnpm-lock.yaml

Lines changed: 16 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/main.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import json from "@rollup/plugin-json"
1313
import cssOnly from "rollup-plugin-css-only"
1414
import babel from "@rollup/plugin-babel"
1515
import { wasm } from "@rollup/plugin-wasm"
16+
import { asc } from "rollup-plugin-assemblyscript"
1617

1718
export type Plugin =
1819
| "js"
@@ -22,12 +23,14 @@ export type Plugin =
2223
| "css"
2324
| "babel"
2425
| "wasm"
26+
| "as"
2527
| ["ts", typeof typescript]
2628
| ["babel", typeof babel]
2729
| ["coffee", typeof coffeescript]
2830
| ["json", typeof json]
2931
| ["css", typeof cssOnly]
3032
| ["wasm", typeof wasm]
33+
| ["as", typeof asc]
3134

3235
// function to check if the first array has any of the second array
3336
// first array can have `[string, object]` as their input
@@ -171,6 +174,19 @@ export function createPlugins(
171174
}
172175
}
173176

177+
// as
178+
const ascIndex = includesAny(inputPluginsNames, ["as", "asc", "assemblyscript", "AssemblyScript"])
179+
if (ascIndex !== null) {
180+
const asc = require("rollup-plugin-assemblyscript")
181+
if (typeof inputPluginsNames[ascIndex] === "string") {
182+
// plugin name only
183+
plugins.push(asc())
184+
} else {
185+
// plugin with options
186+
plugins.push(asc(inputPluginsNames[ascIndex][1]))
187+
}
188+
}
189+
174190
// visualizer
175191
const visualizerIndex = includesAny(inputPluginsNames, ["visualizer", "plot"])
176192
if (visualizerIndex !== null) {

0 commit comments

Comments
 (0)