@tsrx/rspack-plugin-vue 0.0.22 → 0.0.24
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/package.json +5 -5
- package/src/index.js +12 -1
- package/src/interop-loader.js +9 -0
- package/src/vapor-loader.js +7 -3
- package/types/index.d.ts +0 -1
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"description": "Rspack plugin for @tsrx/vue",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": "Dominic Gannaway",
|
|
6
|
-
"version": "0.0.
|
|
6
|
+
"version": "0.0.24",
|
|
7
7
|
"type": "module",
|
|
8
8
|
"publishConfig": {
|
|
9
9
|
"access": "public"
|
|
@@ -21,18 +21,18 @@
|
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
23
|
"source-map": "^0.7.6",
|
|
24
|
-
"@tsrx/vue": "0.1.
|
|
24
|
+
"@tsrx/vue": "0.1.12"
|
|
25
25
|
},
|
|
26
26
|
"peerDependencies": {
|
|
27
27
|
"@rspack/core": ">=1.0.0",
|
|
28
28
|
"vue": ">=3.5",
|
|
29
|
-
"vue-jsx-vapor": ">=3.2.
|
|
29
|
+
"vue-jsx-vapor": ">=3.2.14"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"@rspack/core": "^1.6.0",
|
|
33
33
|
"typescript": "^5.9.3",
|
|
34
|
-
"vue": "3.6.0-beta.
|
|
35
|
-
"vue-jsx-vapor": "^3.2.
|
|
34
|
+
"vue": "3.6.0-beta.12",
|
|
35
|
+
"vue-jsx-vapor": "^3.2.14"
|
|
36
36
|
},
|
|
37
37
|
"files": [
|
|
38
38
|
"src",
|
package/src/index.js
CHANGED
|
@@ -9,9 +9,11 @@ const __dirname = path.dirname(__filename);
|
|
|
9
9
|
const JS_LOADER = path.join(__dirname, 'js-loader.js');
|
|
10
10
|
const VAPOR_LOADER = path.join(__dirname, 'vapor-loader.js');
|
|
11
11
|
const CSS_LOADER = path.join(__dirname, 'css-loader.js');
|
|
12
|
+
const INTEROP_LOADER = path.join(__dirname, 'interop-loader.js');
|
|
12
13
|
|
|
13
14
|
const TSRX_EXTENSION_PATTERN = /\.tsrx$/;
|
|
14
15
|
const CSS_QUERY_PATTERN = /tsrx-css/;
|
|
16
|
+
const SOURCE_EXTENSION_PATTERN = /\.[cm]?[jt]sx?$/;
|
|
15
17
|
|
|
16
18
|
/**
|
|
17
19
|
* Rspack plugin for `.tsrx` files that compiles them via `@tsrx/vue`, runs the
|
|
@@ -24,7 +26,7 @@ const CSS_QUERY_PATTERN = /tsrx-css/;
|
|
|
24
26
|
*/
|
|
25
27
|
export class TsrxVueRspackPlugin {
|
|
26
28
|
/**
|
|
27
|
-
* @param {{ vapor?: {
|
|
29
|
+
* @param {{ vapor?: { macros?: boolean | object, compiler?: { runtimeModuleName?: string } } }} [options]
|
|
28
30
|
*/
|
|
29
31
|
constructor(options = {}) {
|
|
30
32
|
this.options = {
|
|
@@ -50,6 +52,15 @@ export class TsrxVueRspackPlugin {
|
|
|
50
52
|
}
|
|
51
53
|
|
|
52
54
|
compiler.options.module.rules.unshift(
|
|
55
|
+
{
|
|
56
|
+
test: SOURCE_EXTENSION_PATTERN,
|
|
57
|
+
exclude: /node_modules/,
|
|
58
|
+
use: [
|
|
59
|
+
{
|
|
60
|
+
loader: INTEROP_LOADER,
|
|
61
|
+
},
|
|
62
|
+
],
|
|
63
|
+
},
|
|
53
64
|
{
|
|
54
65
|
test: TSRX_EXTENSION_PATTERN,
|
|
55
66
|
resourceQuery: { not: CSS_QUERY_PATTERN },
|
package/src/vapor-loader.js
CHANGED
|
@@ -66,7 +66,7 @@ async function composeSourceMaps(inputMap, outputMap) {
|
|
|
66
66
|
* Runs the compiled TSX through `vue-jsx-vapor`'s public transform API, then
|
|
67
67
|
* composes its sourcemap with the upstream tsrx compile map when available.
|
|
68
68
|
*
|
|
69
|
-
* @this {LoaderContext<{ vapor?: {
|
|
69
|
+
* @this {LoaderContext<{ vapor?: { macros?: boolean | object, compiler?: { runtimeModuleName?: string } } }>}
|
|
70
70
|
* @param {string} source
|
|
71
71
|
* @param {unknown} inputMap
|
|
72
72
|
* @returns {void}
|
|
@@ -74,12 +74,16 @@ async function composeSourceMaps(inputMap, outputMap) {
|
|
|
74
74
|
export default function vaporLoader(source, inputMap) {
|
|
75
75
|
const callback = this.async();
|
|
76
76
|
const options = this.getOptions?.() ?? {};
|
|
77
|
+
const { interop: _interop, ...vapor_options } =
|
|
78
|
+
/** @type {{ interop?: boolean, macros?: boolean | object, compiler?: { runtimeModuleName?: string } }} */ (
|
|
79
|
+
options.vapor ?? {}
|
|
80
|
+
);
|
|
77
81
|
const vapor = {
|
|
78
82
|
...DEFAULT_VAPOR_OPTIONS,
|
|
79
|
-
...
|
|
83
|
+
...vapor_options,
|
|
80
84
|
compiler: {
|
|
81
85
|
...DEFAULT_VAPOR_OPTIONS.compiler,
|
|
82
|
-
...
|
|
86
|
+
...vapor_options.compiler,
|
|
83
87
|
},
|
|
84
88
|
};
|
|
85
89
|
|