-
I want to migrate plugin parcel-plugin-transcrypt to V2, have some problems. parcel-plugin-transcrypt's code is here it's process is described as follows: Step1 Call transcrypt to compile the python code into JS files and Map files. All files are placed in the _target_ directory. After transcrypt excuted, a file named asset.project will be generated, which contains the source file list and the map file list. for example Step2 Parse the project file and put the map files in the dependency list. If don’t add it, you cannot watch the changed files. in async collectDependencies() Step3 returns the result in generate generate() { V2 plugin system is different from V1, so i don’t how to migrate |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Would something like this work in your case (you have to provide the used functions)? export default new Transformer({
async transform({asset, resolve}) {
let inputCode = await asset.getCode();
// Compile and bundle that file, return resulting JS and files that are used
let result = await compilePyToJs(asset.filePath, inputCode);
for(let f of result.includedFile) {
asset.invalidateOnFileChange(f); // rerun this transformer after that file changed
}
asset.type = "js";
asset.setCode(result.code);
return [asset];
},
}); The GLSL transformer is similar: https://github.com/parcel-bundler/parcel/blob/v2/packages/transformers/glsl/src/GLSLTransformer.js |
Beta Was this translation helpful? Give feedback.
Would something like this work in your case (you have to provide the used functions)?
The GLSL transformer is similar: https://github.com/parcel-bundler/parcel/blob/v2/packages/transformers/glsl/src/GLSLTransformer.js