mirror of
https://github.com/fluencelabs/assemblyscript
synced 2025-06-13 06:51:34 +00:00
Also bundle definition files with asc
This commit is contained in:
@ -71,13 +71,13 @@ const bin = {
|
||||
const libDir = path.join(__dirname, "std", "assembly");
|
||||
const libFiles = require("glob").sync("**/*.ts", { cwd: libDir });
|
||||
const lib = {};
|
||||
libFiles.forEach(file => {
|
||||
// console.log("bundling '(lib)/" + file + "'");
|
||||
var source = fs.readFileSync(path.join(libDir, file), { encoding: "utf8" });
|
||||
lib["(lib)/" + file.replace(/\.ts$/, "")] = JSON.stringify(source);
|
||||
});
|
||||
libFiles.forEach(file => lib["(lib)/" + file.replace(/\.ts$/, "")] = bundleFile(path.join(libDir, file)));
|
||||
return lib;
|
||||
})(),
|
||||
BUNDLE_DEFINITIONS: {
|
||||
"assembly": bundleFile(path.join(__dirname, "std", "assembly.d.ts")),
|
||||
"portable": bundleFile(path.join(__dirname, "std", "portable.d.ts"))
|
||||
},
|
||||
__dirname: JSON.stringify(".")
|
||||
}),
|
||||
new webpack.IgnorePlugin(/\.\/src|package\.json|^(ts\-node|glob|source\-map\-support)$/),
|
||||
@ -91,4 +91,8 @@ const bin = {
|
||||
]
|
||||
};
|
||||
|
||||
function bundleFile(filename) {
|
||||
return JSON.stringify(fs.readFileSync(filename, { encoding: "utf8" }).replace(/\r\n/g, "\n"));
|
||||
}
|
||||
|
||||
module.exports = [ lib, bin ];
|
||||
|
Reference in New Issue
Block a user