@ripple-ts/vite-plugin 0.3.11 → 0.3.13
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.
- package/CHANGELOG.md +24 -0
- package/package.json +3 -3
- package/src/index.js +22 -12
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,29 @@
|
|
|
1
1
|
# @ripple-ts/vite-plugin
|
|
2
2
|
|
|
3
|
+
## 0.3.13
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`6e11177`](https://github.com/Ripple-TS/ripple/commit/6e111778cae4e7d9876e51e293520f0859eb5890)
|
|
8
|
+
Thanks [@trueadm](https://github.com/trueadm)! - Add `.rsrx` support across
|
|
9
|
+
Ripple tooling and rename the repository's tracked `.ripple` modules to `.rsrx`.
|
|
10
|
+
- Updated dependencies []:
|
|
11
|
+
- @ripple-ts/adapter@0.3.13
|
|
12
|
+
|
|
13
|
+
## 0.3.12
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- [#859](https://github.com/Ripple-TS/ripple/pull/859)
|
|
18
|
+
[`cdd31ba`](https://github.com/Ripple-TS/ripple/commit/cdd31ba4c07ce504b01d56533e19a6ba37879f5a)
|
|
19
|
+
Thanks [@trueadm](https://github.com/trueadm)! - Add first-phase `.tsrx` support
|
|
20
|
+
across the core Ripple tooling so Vite, Rollup, TypeScript, the language server,
|
|
21
|
+
Prettier, ESLint, and editor integrations accept both `.ripple` and `.tsrx`
|
|
22
|
+
files.
|
|
23
|
+
|
|
24
|
+
- Updated dependencies []:
|
|
25
|
+
- @ripple-ts/adapter@0.3.12
|
|
26
|
+
|
|
3
27
|
## 0.3.11
|
|
4
28
|
|
|
5
29
|
### Patch Changes
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"description": "Vite plugin for Ripple",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": "Dominic Gannaway",
|
|
6
|
-
"version": "0.3.
|
|
6
|
+
"version": "0.3.13",
|
|
7
7
|
"type": "module",
|
|
8
8
|
"module": "src/index.js",
|
|
9
9
|
"main": "src/index.js",
|
|
@@ -32,13 +32,13 @@
|
|
|
32
32
|
"url": "https://github.com/Ripple-TS/ripple/issues"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@ripple-ts/adapter": "0.3.
|
|
35
|
+
"@ripple-ts/adapter": "0.3.13"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"@types/node": "^24.3.0",
|
|
39
39
|
"type-fest": "^5.4.4",
|
|
40
40
|
"vite": "^8.0.0",
|
|
41
|
-
"ripple": "0.3.
|
|
41
|
+
"ripple": "0.3.13"
|
|
42
42
|
},
|
|
43
43
|
"publishConfig": {
|
|
44
44
|
"access": "public"
|
package/src/index.js
CHANGED
|
@@ -40,6 +40,16 @@ const VIRTUAL_HYDRATE_ID = 'virtual:ripple-hydrate';
|
|
|
40
40
|
const RESOLVED_VIRTUAL_HYDRATE_ID = '\0virtual:ripple-hydrate';
|
|
41
41
|
const VIRTUAL_COMPAT_ID = 'virtual:ripple-compat';
|
|
42
42
|
const RESOLVED_VIRTUAL_COMPAT_ID = '\0virtual:ripple-compat';
|
|
43
|
+
const RIPPLE_EXTENSIONS = ['.ripple', '.rsrx', '.tsrx'];
|
|
44
|
+
const RIPPLE_EXTENSION_PATTERN = /\.(?:ripple|rsrx|tsrx)$/;
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* @param {string} file_name
|
|
48
|
+
* @returns {boolean}
|
|
49
|
+
*/
|
|
50
|
+
function is_ripple_module_path(file_name) {
|
|
51
|
+
return RIPPLE_EXTENSIONS.some((extension) => file_name.endsWith(extension));
|
|
52
|
+
}
|
|
43
53
|
|
|
44
54
|
// Dev server always runs in Node — use node:async_hooks as default runtime
|
|
45
55
|
// If the user provides adapter.runtime in their config, that will be used instead.
|
|
@@ -176,9 +186,9 @@ function hasRippleSource(packageJsonPath, subpath = '.') {
|
|
|
176
186
|
/** @type {PackageJson} */
|
|
177
187
|
const pkgJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf-8'));
|
|
178
188
|
|
|
179
|
-
// Check if main/module/exports point to
|
|
189
|
+
// Check if main/module/exports point to Ripple source files
|
|
180
190
|
/** @param {string | undefined} p */
|
|
181
|
-
const checkPath = (p) => p && typeof p === 'string' && p
|
|
191
|
+
const checkPath = (p) => p && typeof p === 'string' && is_ripple_module_path(p);
|
|
182
192
|
|
|
183
193
|
// Handle exports field (modern)
|
|
184
194
|
if (pkgJson.exports) {
|
|
@@ -232,7 +242,7 @@ function hasRippleSource(packageJsonPath, subpath = '.') {
|
|
|
232
242
|
}
|
|
233
243
|
}
|
|
234
244
|
|
|
235
|
-
// Last resort: scan the package directory for
|
|
245
|
+
// Last resort: scan the package directory for Ripple source files
|
|
236
246
|
const packageDir = packageJsonPath.replace('/package.json', '');
|
|
237
247
|
return hasRippleFilesInDirectory(packageDir);
|
|
238
248
|
} catch (e) {
|
|
@@ -241,7 +251,7 @@ function hasRippleSource(packageJsonPath, subpath = '.') {
|
|
|
241
251
|
}
|
|
242
252
|
|
|
243
253
|
/**
|
|
244
|
-
* Recursively check if a directory contains any
|
|
254
|
+
* Recursively check if a directory contains any Ripple source files
|
|
245
255
|
* @param {string} dir
|
|
246
256
|
* @param {number} [maxDepth=3]
|
|
247
257
|
* @returns {boolean}
|
|
@@ -258,7 +268,7 @@ function hasRippleFilesInDirectory(dir, maxDepth = 3) {
|
|
|
258
268
|
continue;
|
|
259
269
|
}
|
|
260
270
|
|
|
261
|
-
if (entry.isFile() && entry.name
|
|
271
|
+
if (entry.isFile() && is_ripple_module_path(entry.name)) {
|
|
262
272
|
return true;
|
|
263
273
|
}
|
|
264
274
|
|
|
@@ -699,18 +709,18 @@ export function ripple(inlineOptions = {}) {
|
|
|
699
709
|
},
|
|
700
710
|
|
|
701
711
|
/**
|
|
702
|
-
* Handle HMR for
|
|
712
|
+
* Handle HMR for Ripple source files.
|
|
703
713
|
*
|
|
704
714
|
* Inspired by vite-plugin-svelte's approach: instead of manually
|
|
705
715
|
* re-compiling in hotUpdate, we use `transformRequest` to run the
|
|
706
716
|
* full Vite pipeline (load → transform). This updates cssCache
|
|
707
717
|
* via the existing transform hook and avoids double-compilation.
|
|
708
718
|
*
|
|
709
|
-
* After the
|
|
719
|
+
* After the source file is re-transformed, we invalidate and
|
|
710
720
|
* include the virtual CSS module in the HMR update so the browser
|
|
711
721
|
* receives fresh CSS in sync with the re-rendered component.
|
|
712
722
|
*
|
|
713
|
-
* For non
|
|
723
|
+
* For non-Ripple files that don't self-accept, we invalidate
|
|
714
724
|
* SSR modules and trigger a full reload.
|
|
715
725
|
*/
|
|
716
726
|
hotUpdate: {
|
|
@@ -720,7 +730,7 @@ export function ripple(inlineOptions = {}) {
|
|
|
720
730
|
|
|
721
731
|
let updated_modules = modules;
|
|
722
732
|
|
|
723
|
-
if (file
|
|
733
|
+
if (is_ripple_module_path(file)) {
|
|
724
734
|
const filename = file.replace(root, '');
|
|
725
735
|
const cssId = createVirtualImportId(filename, root, 'style');
|
|
726
736
|
|
|
@@ -729,7 +739,7 @@ export function ripple(inlineOptions = {}) {
|
|
|
729
739
|
|
|
730
740
|
// Use transformRequest to run the standard Vite pipeline.
|
|
731
741
|
// This triggers our transform hook which re-compiles the
|
|
732
|
-
//
|
|
742
|
+
// source file and updates cssCache as a side-effect.
|
|
733
743
|
try {
|
|
734
744
|
await this.environment.transformRequest(filename);
|
|
735
745
|
} catch {
|
|
@@ -750,7 +760,7 @@ export function ripple(inlineOptions = {}) {
|
|
|
750
760
|
}
|
|
751
761
|
}
|
|
752
762
|
|
|
753
|
-
// Non
|
|
763
|
+
// Non-Ripple files: if all modules self-accept, let Vite
|
|
754
764
|
// handle. Otherwise invalidate SSR and full-reload.
|
|
755
765
|
if (modules.length > 0 && modules.every((m) => m.isSelfAccepting)) {
|
|
756
766
|
return updated_modules === modules ? undefined : updated_modules;
|
|
@@ -1149,7 +1159,7 @@ import { hydrate, mount } from 'ripple';
|
|
|
1149
1159
|
},
|
|
1150
1160
|
|
|
1151
1161
|
transform: {
|
|
1152
|
-
filter: { id:
|
|
1162
|
+
filter: { id: RIPPLE_EXTENSION_PATTERN },
|
|
1153
1163
|
|
|
1154
1164
|
async handler(code, id, opts) {
|
|
1155
1165
|
const filename = id.replace(root, '');
|