Skip to content
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

JS-380 Bundle bridge using esbuild #4901

Merged
merged 18 commits into from
Nov 14, 2024
Merged

JS-380 Bundle bridge using esbuild #4901

merged 18 commits into from
Nov 14, 2024

Conversation

zglicz
Copy link
Contributor

@zglicz zglicz commented Nov 12, 2024

@vdiez vdiez force-pushed the bundle-esbuild branch 2 times, most recently from 407d8c8 to 02e2a0c Compare November 12, 2024 11:48
@@ -0,0 +1 @@
declare module 'postcss-syntax';
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sad-panda-sitting-vector-illustation_952832-137127

include: /lib[\/\\]jsts[\/\\]src[\/\\]parsers[\/\\]ast\.js$/,
pattern: [['path.dirname(fileURLToPath(import.meta.url))', '__dirname']],
}),
// Simplify the loader function in babel. At the end it's just importing Babel parser
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you think it would be worth to point a specific line in a github repo? Perhaps this way, if something changes, it would be a good starting point to investigate.

Also, it would be great, if we could assert that these replacements actually happened. If we could make the bundling fail if any of the replacements didn't occur....

document sources where bundler is replacing sourcecode
Copy link
Contributor Author

@zglicz zglicz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Commenting with a bit more details, as I'm the author it seems :)

@@ -20,9 +20,6 @@ exports.rules = [
],
},
create(context) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For posteriority, the lines below were removed because typescript isn't installed and available

@@ -29,13 +29,10 @@ describe('createStylelintConfig', () => {
{ key: 'bar', configurations: [42] },
];
const config = createStylelintConfig(rules);
expect(config).toEqual({
customSyntax: 'postcss-syntax',
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we now pass the imported module and we can't really compare it

@@ -70,7 +70,7 @@ export function buildSourceCode(input: JsTsAnalysisInput, language: JsTsLanguage
return parseForESLint(
input.fileContent,
parser.parse,
buildParserOptions({ parser: vueFile ? parsers.javascript.parser : undefined }, true),
buildParserOptions({ parser: vueFile ? parsers.javascript : undefined }, true),
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again, we want to pass in a resolved module. parsers.javascript.parser was the library name @babel/eslint-parser and it would get invoked dynamically and esbuild wouldn't be able to resolve it.

server
.start(Number.parseInt(port), host, createWorker(new URL(import.meta.url), getContext()))
.catch(() => {});
server.start(Number.parseInt(port), host, createWorker(new URL(import.meta.url), getContext()));
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consciously we remove the catch. There doesn't seem to be a benefit of silently swallowing the error.

@@ -37,7 +37,7 @@ public class BundleImpl implements Bundle {

// this archive is created in the bridge module
private static final String BUNDLE_LOCATION = "/sonarjs-1.0.0.tgz";
private static final String DEFAULT_STARTUP_SCRIPT = "package/bin/server.mjs";
private static final String DEFAULT_STARTUP_SCRIPT = "package/bin/server.cjs";
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One step forward, two steps back ...

sad-panda-sitting-vector-illustation_952832-137127

@@ -46,7 +46,7 @@ public class NodeCommandBuilderImpl implements NodeCommandBuilder {

public static final String NODE_EXECUTABLE_DEFAULT = "node";
private static final String NODE_EXECUTABLE_DEFAULT_MACOS =
"package/node_modules/run-node/run-node";
"package/bin/run-node";
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

run-node is now a part of our project, we don't need to expect it to be in the node_modules

@zglicz zglicz requested a review from a team November 14, 2024 12:57
@kebetsi kebetsi changed the title JS-380 Bundle esbuild JS-380 Bundle bridge using esbuild Nov 14, 2024
@zglicz zglicz merged commit 673773e into master Nov 14, 2024
19 of 21 checks passed
@zglicz zglicz deleted the bundle-esbuild branch November 14, 2024 15:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants