ruby_wasm_ui 0.8.2 → 0.8.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/examples/Gemfile.lock +1 -1
- data/lib/ruby_wasm_ui/version.rb +1 -1
- data/packages/npm-packages/runtime/package-lock.json +2 -2
- data/packages/npm-packages/runtime/package.json +3 -3
- data/packages/npm-packages/runtime/rollup.config.mjs +67 -9
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b322433e65bc63155825e97695c798bce90602a54e52797cd040aea67b909751
|
|
4
|
+
data.tar.gz: 1655781e0e93952e5f2ecc2e450d5a9286718979f3201f0169ae35dc94979872
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 97e3cf3322340377c5cb75d74796bd20096d604d9ef1efe87ed9598d8394ae76ad6d7b481c43c3e721b683208489083164b6c7730b09106f4dceefdb8647a52c
|
|
7
|
+
data.tar.gz: 7d04075d81325a78375ffbd9d711e82af3a48531acc9eec340f6d71df76501741d4573bae368eca7ae14c752c1f4fb8c894ee028007c028df39cab2595ef10a1
|
data/README.md
CHANGED
|
@@ -21,7 +21,7 @@ Create an HTML file:
|
|
|
21
21
|
<!DOCTYPE html>
|
|
22
22
|
<html>
|
|
23
23
|
<head>
|
|
24
|
-
<script src="https://unpkg.com/ruby-wasm-ui@0.8.
|
|
24
|
+
<script src="https://unpkg.com/ruby-wasm-ui@0.8.3"></script>
|
|
25
25
|
<script defer type="text/ruby" src="app.rb"></script>
|
|
26
26
|
</head>
|
|
27
27
|
<body>
|
data/examples/Gemfile.lock
CHANGED
data/lib/ruby_wasm_ui/version.rb
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ruby-wasm-ui",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.3",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "ruby-wasm-ui",
|
|
9
|
-
"version": "0.8.
|
|
9
|
+
"version": "0.8.3",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"devDependencies": {
|
|
12
12
|
"@rollup/plugin-replace": "^6.0.2",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ruby-wasm-ui",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.3",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/ruby-wasm-ui.js",
|
|
6
6
|
"files": [
|
|
@@ -10,8 +10,8 @@
|
|
|
10
10
|
],
|
|
11
11
|
"scripts": {
|
|
12
12
|
"prepack": "npm run build",
|
|
13
|
-
"build": "
|
|
14
|
-
"build:dev": "
|
|
13
|
+
"build": "NODE_ENV=production rollup -c",
|
|
14
|
+
"build:dev": "NODE_ENV=development rollup -c",
|
|
15
15
|
"lint": "eslint src",
|
|
16
16
|
"lint:fix": "eslint src --fix",
|
|
17
17
|
"test": "vitest",
|
|
@@ -4,7 +4,13 @@ import filesize from "rollup-plugin-filesize";
|
|
|
4
4
|
import replace from "@rollup/plugin-replace";
|
|
5
5
|
import { glob } from "glob";
|
|
6
6
|
import process from "process";
|
|
7
|
-
import {
|
|
7
|
+
import {
|
|
8
|
+
readFileSync,
|
|
9
|
+
writeFileSync,
|
|
10
|
+
lstatSync,
|
|
11
|
+
unlinkSync,
|
|
12
|
+
realpathSync,
|
|
13
|
+
} from "fs";
|
|
8
14
|
import { join, dirname } from "path";
|
|
9
15
|
import { fileURLToPath } from "url";
|
|
10
16
|
|
|
@@ -28,22 +34,68 @@ const rubyFiles = glob
|
|
|
28
34
|
// Determine environment based on NODE_ENV
|
|
29
35
|
const isDevelopment = process.env.NODE_ENV === "development";
|
|
30
36
|
|
|
37
|
+
// Plugin to clean up existing symlinks in dist directory before copy
|
|
38
|
+
const cleanupSymlinks = () => {
|
|
39
|
+
return {
|
|
40
|
+
name: "cleanup-symlinks",
|
|
41
|
+
buildStart() {
|
|
42
|
+
const distRubyFilePath = join(__dirname, "dist/ruby_wasm_ui.rb");
|
|
43
|
+
try {
|
|
44
|
+
const stats = lstatSync(distRubyFilePath);
|
|
45
|
+
if (stats.isSymbolicLink() || stats.isFile()) {
|
|
46
|
+
// Remove existing file/symlink before copy plugin runs
|
|
47
|
+
unlinkSync(distRubyFilePath);
|
|
48
|
+
}
|
|
49
|
+
} catch (e) {
|
|
50
|
+
// Ignore errors (file might not exist)
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
|
|
31
56
|
// Plugin to remove require_relative lines from Ruby files
|
|
32
57
|
const removeRequireRelative = () => {
|
|
33
58
|
return {
|
|
34
59
|
name: "remove-require-relative",
|
|
35
60
|
writeBundle() {
|
|
36
|
-
// Process all Ruby files in dist directory
|
|
37
|
-
|
|
61
|
+
// Process all Ruby files in dist directory (including dist/ruby_wasm_ui.rb)
|
|
62
|
+
// Ensure we only process files in dist/ directory, not lib/ or other source directories
|
|
63
|
+
const distDir = join(__dirname, "dist");
|
|
64
|
+
const distRubyFiles = glob.sync("dist/**/*.rb", {
|
|
65
|
+
cwd: __dirname,
|
|
66
|
+
absolute: false,
|
|
67
|
+
});
|
|
38
68
|
|
|
39
69
|
distRubyFiles.forEach((file) => {
|
|
40
70
|
const filePath = join(__dirname, file);
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
71
|
+
try {
|
|
72
|
+
const stats = lstatSync(filePath);
|
|
73
|
+
let content;
|
|
74
|
+
// If it's a symlink to lib/, read from lib but write to dist
|
|
75
|
+
if (stats.isSymbolicLink()) {
|
|
76
|
+
const resolvedPath = realpathSync(filePath);
|
|
77
|
+
const distDirResolved = realpathSync(distDir);
|
|
78
|
+
if (!resolvedPath.startsWith(distDirResolved)) {
|
|
79
|
+
// Read from lib, but write to dist (replacing the symlink)
|
|
80
|
+
content = readFileSync(resolvedPath, "utf-8");
|
|
81
|
+
unlinkSync(filePath);
|
|
82
|
+
} else {
|
|
83
|
+
// Symlink resolves within dist, read resolved path
|
|
84
|
+
content = readFileSync(resolvedPath, "utf-8");
|
|
85
|
+
}
|
|
86
|
+
} else {
|
|
87
|
+
// Regular file, read directly
|
|
88
|
+
content = readFileSync(filePath, "utf-8");
|
|
89
|
+
}
|
|
90
|
+
// Remove lines that start with require_relative (with optional whitespace)
|
|
91
|
+
content = content.replace(/^\s*require_relative\s+.*$/gm, "");
|
|
92
|
+
// Remove multiple consecutive empty lines
|
|
93
|
+
content = content.replace(/\n{3,}/g, "\n\n");
|
|
94
|
+
writeFileSync(filePath, content, "utf-8");
|
|
95
|
+
} catch (e) {
|
|
96
|
+
// If read/write fails, skip this file
|
|
97
|
+
console.warn(`Could not process file ${filePath}: ${e.message}`);
|
|
98
|
+
}
|
|
47
99
|
});
|
|
48
100
|
},
|
|
49
101
|
};
|
|
@@ -66,6 +118,7 @@ export default {
|
|
|
66
118
|
"window.RUBY_WASM_UI_FILES": JSON.stringify(rubyFiles),
|
|
67
119
|
},
|
|
68
120
|
}),
|
|
121
|
+
cleanupSymlinks(),
|
|
69
122
|
copy({
|
|
70
123
|
targets: [
|
|
71
124
|
{
|
|
@@ -78,6 +131,11 @@ export default {
|
|
|
78
131
|
dest: "dist",
|
|
79
132
|
},
|
|
80
133
|
],
|
|
134
|
+
// Resolve symbolic links when copying to ensure dist files are regular files
|
|
135
|
+
// This allows us to process dist/ruby_wasm_ui.rb without affecting lib/ruby_wasm_ui.rb
|
|
136
|
+
copySyncOptions: {
|
|
137
|
+
dereference: true,
|
|
138
|
+
},
|
|
81
139
|
}),
|
|
82
140
|
cleanup({
|
|
83
141
|
comments: "none",
|