Skip to content

Commit 09af175

Browse files
committed
refactor: load T-Ruby library from npm CDN instead of static files
- Switch from static/t-ruby-lib/ to @t-ruby/wasm@0.0.8 via jsDelivr CDN - Remove all static T-Ruby library files (62 files) - Update ruby-wasm.ts to use CDN URL for library files
1 parent bf6c262 commit 09af175

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+9
-16611
lines changed

src/lib/ruby-wasm.ts

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,12 @@ function generateRequestId(): string {
4545
return `req_${++requestIdCounter}_${Date.now()}`;
4646
}
4747

48+
// T-Ruby WASM package version - update this when publishing new version
49+
const T_RUBY_WASM_VERSION = '0.0.8';
50+
51+
// T-Ruby library CDN base URL
52+
const T_RUBY_CDN_BASE = `https://cdn.jsdelivr.net/npm/@t-ruby/wasm@${T_RUBY_WASM_VERSION}/dist/lib/`;
53+
4854
// T-Ruby library files in dependency order (only core compilation files)
4955
// Excluded: lsp_server, watcher, cli, cache, package_manager, bundler_integration, benchmark, doc_generator
5056
// These require external gems (listen, etc.) not available in WASM
@@ -80,8 +86,8 @@ const RUBY_WASM_CDN = 'https://cdn.jsdelivr.net/npm/@ruby/wasm-wasi@2.7.1/dist/b
8086
// Use Ruby 3.4 WASM binary (more stable)
8187
const RUBY_WASM_BINARY = 'https://cdn.jsdelivr.net/npm/@ruby/3.4-wasm-wasi@2.7.1/dist/ruby+stdlib.wasm';
8288
83-
// T-Ruby library base URL (will be set from main thread)
84-
let T_RUBY_LIB_BASE = '';
89+
// T-Ruby library CDN base URL
90+
const T_RUBY_LIB_BASE = '${T_RUBY_CDN_BASE}';
8591
8692
// T-Ruby library files in dependency order
8793
const T_RUBY_FILES = ${JSON.stringify(T_RUBY_FILES)};
@@ -263,8 +269,6 @@ self.addEventListener('message', (event) => {
263269
264270
switch (type) {
265271
case 'init':
266-
// Set base URL from main thread
267-
T_RUBY_LIB_BASE = data.origin + '/t-ruby-lib/';
268272
initialize();
269273
break;
270274
case 'compile':
@@ -335,7 +339,7 @@ async function doLoadCompiler(
335339
switch (type) {
336340
case 'loaded':
337341
console.log('[T-Ruby] Worker loaded, sending init command...');
338-
worker.postMessage({ type: 'init', data: { origin: window.location.origin } });
342+
worker.postMessage({ type: 'init' });
339343
break;
340344

341345
case 'progress':

static/t-ruby-lib/gem_types/rails/action_controller.d.trb

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

0 commit comments

Comments
 (0)