Skip to content

Verson 0.9.3 introduced breaking changes #1157

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
willemneal opened this issue Mar 11, 2020 · 2 comments · Fixed by #1158
Closed

Verson 0.9.3 introduced breaking changes #1157

willemneal opened this issue Mar 11, 2020 · 2 comments · Fixed by #1158

Comments

@willemneal
Copy link
Contributor

The interface for the compiler wrapped the util module into an exported namespace.

I'm sure there was a reason to do this, but given the semver semantics breaking changes should increment the middle version number.

Is it bad practices to have the middle number go above 9? If not, then we should consider upgrading to 0.10.0.

For those who might stumble upon this here is how I fixed my custom transformer's dependency on the compiler.

//@ts-ignore
const path = require("path");

//@ts-ignore
let assemblyscriptPath = Object.getOwnPropertyNames(require.cache)
                        .filter(s => s.endsWith("assemblyscript.js"))[0];
let transformerPath;
if (assemblyscriptPath) {
  let splitPath = assemblyscriptPath.split(path.sep).slice(0, -2);
  transformerPath =  splitPath.concat([ "cli", "transform"]).join(path.sep);
} else {
  assemblyscriptPath = require.resolve("assemblyscript");
  transformerPath = require.resolve("assemblyscript/cli/transform");
}
const assemblyscript = require(assemblyscriptPath);

//@ts-ignore
module.exports.Transform = require(transformerPath).Transform;
module.exports = {
                  ...module.exports,
                  ...assemblyscript,
                  // Need to add because newer version adds namespace
                  ...assemblyscript.util 
                };

then an accompanying .d.t.s file:

export * from "assemblyscript";
export * from "assemblyscript/cli/transform";
@dcodeIO
Copy link
Member

dcodeIO commented Mar 11, 2020

Whoops, that was one if the changes I made in #1129. Suggesting to revert this change, slice a 0.9.4, and reapply in a 0.10.0.

@willemneal
Copy link
Contributor Author

Thanks! I'm sure I'm one of the few that this caused an issue for, but it will prevent some downstream from my Near tools.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants