Skip to content

Commit 0b115fb

Browse files
author
jingjing2222
committed
chore: annotation
1 parent af300b5 commit 0b115fb

File tree

12 files changed

+209
-395
lines changed

12 files changed

+209
-395
lines changed

packages/plugin-radon/CHANGELOG.md

Lines changed: 0 additions & 86 deletions
This file was deleted.

packages/plugin-radon/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@granite-js/plugin-radon",
33
"type": "module",
4-
"version": "0.1.0",
4+
"version": "0.1.20",
55
"description": "Radon compilation plugin for Granite",
66
"scripts": {
77
"prepack": "yarn build",

packages/plugin-radon/src/babel.js

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,6 @@ module.exports = function (api, options = {}) {
3737
return require(resolvedPath);
3838
};
3939

40-
// --- Helper Functions ---
41-
4240
// Function to generate paths for bundled renderer files
4341
const createRendererPath = (rendererFileName, version) => {
4442
try {
@@ -116,8 +114,6 @@ module.exports = function (api, options = {}) {
116114

117115
let injected = false;
118116

119-
// This MUST be the first check.
120-
121117
if (
122118
isTransforming('react-native/Libraries/Renderer/implementations/ReactFabric-dev.js') ||
123119
isTransforming('react-native/Libraries/Renderer/implementations/ReactNativeRenderer-dev.js')
@@ -130,7 +126,6 @@ module.exports = function (api, options = {}) {
130126
if (rendererPath && fs.existsSync(rendererPath)) {
131127
try {
132128
const rendererCode = fs.readFileSync(rendererPath, 'utf8');
133-
// Add a fingerprint to verify the custom renderer is loaded.
134129
const fingerprint = `globalThis.__RADON_RENDERER_LOADED__ = '${path.basename(rendererPath)}';`;
135130
const finalRendererCode = `${fingerprint}\n${rendererCode}`;
136131

@@ -168,8 +163,6 @@ module.exports = function (api, options = {}) {
168163

169164
const finalCodeToInject = `${portInjectionCode}\n${runtimeCode}`;
170165

171-
// By appending the code to the end of the file and wrapping in setImmediate,
172-
// we ensure all polyfills are ready before our code runs.
173166
const finalSafeCode = `setImmediate(() => { try { \n${finalCodeToInject}\n } catch (e) { console.error('Radon runtime error:', e); } });`;
174167

175168
injectCode(programPath, finalSafeCode, false); // Append to the end
@@ -179,7 +172,6 @@ module.exports = function (api, options = {}) {
179172
console.error('🔥 RADON BABEL PLUGIN: 🚨 FAILED TO READ RUNTIME BUNDLE.', e);
180173
throw e;
181174
}
182-
// Once handled, we are done with this file.
183175
return;
184176
}
185177

@@ -196,7 +188,6 @@ module.exports = function (api, options = {}) {
196188
}
197189
}
198190

199-
// Process page files for navigation auto-registration
200191
processPageFile(filename, programPath, parse, t, state);
201192
},
202193
},

packages/plugin-radon/src/index.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
1-
// Integrated plugin (default)
21
export { radon } from './radonPlugin';
32

4-
// Individual plugins (optional use)
53
export { radonCore } from './radonCorePlugin';
64
export { radonPolyfill } from './radonPolyfillPlugin';
75

8-
// Types
96
export type { RadonCorePluginOptions } from './radonCorePlugin';
10-
export type { RadonPolyfillPluginOptions } from './radonPolyfillPlugin';
7+
export type { RadonPolyfillPluginOptions } from './radonPolyfillPlugin';

packages/plugin-radon/src/lib/granite_router/global_injector.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
1-
// Granite Router global variable injection utilities
2-
31
/**
42
* Generate code to inject Granite Router detection and routes into global scope
53
* @param {Array} routes - Array of route objects from parseRouterGenFile
64
* @returns {string} - Code string to inject
75
*/
86
const generateGraniteInjectionCode = (routes) => {
97
const routesJson = JSON.stringify(routes, null, 2);
10-
8+
119
return `
1210
// Mark that Granite Router is being used
1311
globalThis.__GRANITE_ROUTER_DETECTED__ = true;
@@ -36,5 +34,5 @@ const injectGraniteGlobals = (injectCode, programPath, routes) => {
3634

3735
module.exports = {
3836
generateGraniteInjectionCode,
39-
injectGraniteGlobals
40-
};
37+
injectGraniteGlobals,
38+
};

0 commit comments

Comments
 (0)