Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions compiler/apps/playground/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1249,14 +1249,14 @@ camelcase-css@^2.0.1:
integrity sha512-QOSvevhslijgYwRx6Rv7zKdMF8lbRmx+uQGx2+vDc+KI/eBnsy9kit5aj23AgGu3pa4t9AgwbnXWqS+iOY+2aA==

caniuse-lite@^1.0.30001579:
version "1.0.30001669"
resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001669.tgz#fda8f1d29a8bfdc42de0c170d7f34a9cf19ed7a3"
integrity sha512-DlWzFDJqstqtIVx1zeSpIMLjunf5SmwOw0N2Ck/QSQdS8PLS4+9HrLaYei4w8BIAL7IB/UEDu889d8vhCTPA0w==
version "1.0.30001715"
resolved "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001715.tgz"
integrity sha512-7ptkFGMm2OAOgvZpwgA4yjQ5SQbrNVGdRjzH0pBdy1Fasvcr+KAeECmbCAECzTuDuoX0FCY8KzUxjf9+9kfZEw==

caniuse-lite@^1.0.30001646, caniuse-lite@^1.0.30001663:
version "1.0.30001664"
resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001664.tgz#d588d75c9682d3301956b05a3749652a80677df4"
integrity sha512-AmE7k4dXiNKQipgn7a2xg558IRqPN3jMQY/rOsbxDhrd0tyChwbITBfiwtnqz8bi2M5mIWbxAYBvk7W7QBUS2g==
version "1.0.30001715"
resolved "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001715.tgz"
integrity sha512-7ptkFGMm2OAOgvZpwgA4yjQ5SQbrNVGdRjzH0pBdy1Fasvcr+KAeECmbCAECzTuDuoX0FCY8KzUxjf9+9kfZEw==

chalk@^2.4.2:
version "2.4.2"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -469,6 +469,23 @@ export function compileProgram(
}
}

/**
* Otherwise if 'use no forget/memo' is present, we still run the code through the compiler
* for validation but we don't mutate the babel AST. This allows us to flag if there is an
* unused 'use no forget/memo' directive.
*/
if (pass.opts.ignoreUseNoForget === false && optOutDirectives.length > 0) {
for (const directive of optOutDirectives) {
pass.opts.logger?.logEvent(pass.filename, {
kind: 'CompileSkip',
fnLoc: fn.node.body.loc ?? null,
reason: `Skipped due to '${directive.value.value}' directive.`,
loc: directive.loc ?? null,
});
}
return null;
}

pass.opts.logger?.logEvent(pass.filename, {
kind: 'CompileSuccess',
fnLoc: fn.node.loc ?? null,
Expand All @@ -492,23 +509,6 @@ export function compileProgram(
return null;
}

/**
* Otherwise if 'use no forget/memo' is present, we still run the code through the compiler
* for validation but we don't mutate the babel AST. This allows us to flag if there is an
* unused 'use no forget/memo' directive.
*/
if (pass.opts.ignoreUseNoForget === false && optOutDirectives.length > 0) {
for (const directive of optOutDirectives) {
pass.opts.logger?.logEvent(pass.filename, {
kind: 'CompileSkip',
fnLoc: fn.node.body.loc ?? null,
reason: `Skipped due to '${directive.value.value}' directive.`,
loc: directive.loc ?? null,
});
}
return null;
}

if (!pass.opts.noEmit) {
return compileResult.compiledFn;
}
Expand Down
4 changes: 4 additions & 0 deletions compiler/packages/react-forgive/server/src/compiler/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ export async function compile({
plugins: ['typescript', 'jsx'],
},
sourceType: 'module',
configFile: false,
babelrc: false,
});
if (ast == null) {
return null;
Expand All @@ -48,6 +50,8 @@ export async function compile({
plugins,
sourceType: 'module',
sourceFileName: file,
configFile: false,
babelrc: false,
});
if (result?.code == null) {
throw new Error(
Expand Down
9 changes: 6 additions & 3 deletions compiler/packages/react-forgive/server/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ connection.onInitialized(() => {
});

documents.onDidChangeContent(async event => {
connection.console.info(`Changed: ${event.document.uri}`);
connection.console.info(`Compiling: ${event.document.uri}`);
resetState();
if (SUPPORTED_LANGUAGE_IDS.has(event.document.languageId)) {
const text = event.document.getText();
Expand All @@ -143,8 +143,11 @@ documents.onDidChangeContent(async event => {
options: compilerOptions,
});
} catch (err) {
connection.console.error('Failed to compile');
if (err instanceof Error) {
connection.console.error(err.stack ?? '');
connection.console.error(err.stack ?? err.message);
} else {
connection.console.error(JSON.stringify(err, null, 2));
}
}
}
Expand Down Expand Up @@ -192,7 +195,6 @@ connection.onCodeLensResolve(lens => {
});

connection.onCodeAction(params => {
connection.console.log('onCodeAction');
const codeActions: Array<CodeAction> = [];
for (const codeActionEvent of codeActionEvents) {
if (
Expand Down Expand Up @@ -242,6 +244,7 @@ connection.onRequest(AutoDepsDecorationsRequest.type, async params => {
});

function resetState() {
connection.console.debug('Clearing state');
compiledFns.clear();
autoDepsDecorations = [];
codeActionEvents = [];
Expand Down
13 changes: 4 additions & 9 deletions compiler/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4341,15 +4341,10 @@ camelcase@^6.0.0, camelcase@^6.2.0:
resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-6.3.0.tgz#5685b95eb209ac9c0c177467778c9c84df58ba9a"
integrity sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==

caniuse-lite@^1.0.30001489:
version "1.0.30001581"
resolved "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001581.tgz"
integrity sha512-whlTkwhqV2tUmP3oYhtNfaWGYHDdS3JYFQBKXxcUR9qqPWsRhFHhoISO2Xnl/g0xyKzht9mI1LZpiNWfMzHixQ==

caniuse-lite@^1.0.30001688:
version "1.0.30001690"
resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001690.tgz#f2d15e3aaf8e18f76b2b8c1481abde063b8104c8"
integrity sha512-5ExiE3qQN6oF8Clf8ifIDcMRCRE/dMGcETG/XGMD8/XiXm6HXQgQTh1yZYLXXpSOsEUlJm1Xr7kGULZTuGtP/w==
caniuse-lite@^1.0.30001489, caniuse-lite@^1.0.30001688:
version "1.0.30001715"
resolved "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001715.tgz"
integrity sha512-7ptkFGMm2OAOgvZpwgA4yjQ5SQbrNVGdRjzH0pBdy1Fasvcr+KAeECmbCAECzTuDuoX0FCY8KzUxjf9+9kfZEw==

[email protected], chalk@^2.0.0, chalk@^2.4.2:
version "2.4.2"
Expand Down
Loading