@tsrx/rspack-plugin-solid 0.0.71 → 0.0.72
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 +2 -2
- package/src/css-loader.js +4 -2
- package/src/index.js +9 -1
- package/src/js-loader.js +4 -2
- package/types/index.d.ts +5 -1
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"description": "Rspack plugin for @tsrx/solid",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": "Dominic Gannaway",
|
|
6
|
-
"version": "0.0.
|
|
6
|
+
"version": "0.0.72",
|
|
7
7
|
"type": "module",
|
|
8
8
|
"publishConfig": {
|
|
9
9
|
"access": "public"
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"babel-loader": "^10.1.1",
|
|
26
26
|
"babel-preset-solid": "2.0.0-beta.15",
|
|
27
27
|
"solid-refresh": "0.8.0-next.7",
|
|
28
|
-
"@tsrx/solid": "0.1.
|
|
28
|
+
"@tsrx/solid": "0.1.59"
|
|
29
29
|
},
|
|
30
30
|
"peerDependencies": {
|
|
31
31
|
"@rspack/core": ">=1.6.0"
|
package/src/css-loader.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
/** @import { LoaderContext } from '@rspack/core' */
|
|
2
2
|
|
|
3
|
+
/** @import { RuntimeImportMode } from '@tsrx/solid' */
|
|
4
|
+
|
|
3
5
|
import { compile } from '@tsrx/solid';
|
|
4
6
|
|
|
5
7
|
/**
|
|
@@ -7,7 +9,7 @@ import { compile } from '@tsrx/solid';
|
|
|
7
9
|
* the scoped CSS emitted by its `<style>` block. Invoked when rspack resolves
|
|
8
10
|
* the sibling `?tsrx-css&lang.css` import prepended by the JS loader.
|
|
9
11
|
*
|
|
10
|
-
* @this {LoaderContext<
|
|
12
|
+
* @this {LoaderContext<{ runtimeImports?: RuntimeImportMode }>}
|
|
11
13
|
* @param {string} source
|
|
12
14
|
* @returns {void}
|
|
13
15
|
*/
|
|
@@ -16,7 +18,7 @@ export default function cssLoader(source) {
|
|
|
16
18
|
const resourcePath = this.resourcePath;
|
|
17
19
|
|
|
18
20
|
try {
|
|
19
|
-
const { css } = compile(source, resourcePath);
|
|
21
|
+
const { css } = compile(source, resourcePath, this.getOptions?.());
|
|
20
22
|
callback(null, css);
|
|
21
23
|
} catch (/** @type {any} */ err) {
|
|
22
24
|
callback(err);
|
package/src/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/** @import { Compiler, RspackPluginInstance } from '@rspack/core' */
|
|
2
|
+
/** @import { RuntimeImportMode } from '@tsrx/solid' */
|
|
2
3
|
|
|
3
4
|
import { createRequire } from 'node:module';
|
|
4
5
|
import path from 'node:path';
|
|
@@ -29,11 +30,12 @@ const CSS_QUERY_PATTERN = /tsrx-css/;
|
|
|
29
30
|
*/
|
|
30
31
|
export class TsrxSolidRspackPlugin {
|
|
31
32
|
/**
|
|
32
|
-
* @param {{ hot?: boolean }} [options]
|
|
33
|
+
* @param {{ hot?: boolean, runtimeImports?: RuntimeImportMode }} [options]
|
|
33
34
|
*/
|
|
34
35
|
constructor(options = {}) {
|
|
35
36
|
this.options = {
|
|
36
37
|
hot: options.hot,
|
|
38
|
+
runtimeImports: options.runtimeImports ?? 'compiler',
|
|
37
39
|
};
|
|
38
40
|
}
|
|
39
41
|
|
|
@@ -92,6 +94,9 @@ export class TsrxSolidRspackPlugin {
|
|
|
92
94
|
},
|
|
93
95
|
{
|
|
94
96
|
loader: JS_LOADER,
|
|
97
|
+
options: {
|
|
98
|
+
runtimeImports: this.options.runtimeImports,
|
|
99
|
+
},
|
|
95
100
|
},
|
|
96
101
|
],
|
|
97
102
|
},
|
|
@@ -102,6 +107,9 @@ export class TsrxSolidRspackPlugin {
|
|
|
102
107
|
use: [
|
|
103
108
|
{
|
|
104
109
|
loader: CSS_LOADER,
|
|
110
|
+
options: {
|
|
111
|
+
runtimeImports: this.options.runtimeImports,
|
|
112
|
+
},
|
|
105
113
|
},
|
|
106
114
|
],
|
|
107
115
|
},
|
package/src/js-loader.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
/** @import { LoaderContext } from '@rspack/core' */
|
|
2
2
|
|
|
3
|
+
/** @import { RuntimeImportMode } from '@tsrx/solid' */
|
|
4
|
+
|
|
3
5
|
import { compile } from '@tsrx/solid';
|
|
4
6
|
|
|
5
7
|
/**
|
|
@@ -7,7 +9,7 @@ import { compile } from '@tsrx/solid';
|
|
|
7
9
|
* prepends an `import` to the sibling virtual CSS module so rspack can
|
|
8
10
|
* include the styles in the asset graph.
|
|
9
11
|
*
|
|
10
|
-
* @this {LoaderContext<
|
|
12
|
+
* @this {LoaderContext<{ runtimeImports?: RuntimeImportMode }>}
|
|
11
13
|
* @param {string} source
|
|
12
14
|
* @returns {void}
|
|
13
15
|
*/
|
|
@@ -16,7 +18,7 @@ export default function jsLoader(source) {
|
|
|
16
18
|
const resourcePath = this.resourcePath;
|
|
17
19
|
|
|
18
20
|
try {
|
|
19
|
-
const { code, map, css } = compile(source, resourcePath);
|
|
21
|
+
const { code, map, css } = compile(source, resourcePath, this.getOptions?.());
|
|
20
22
|
|
|
21
23
|
let output = code;
|
|
22
24
|
/** @type {typeof map | null} */
|
package/types/index.d.ts
CHANGED
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
import type { Compiler, RspackPluginInstance } from '@rspack/core';
|
|
2
|
+
import type { RuntimeImportMode } from '@tsrx/solid';
|
|
2
3
|
|
|
3
4
|
export interface TsrxSolidRspackPluginOptions {
|
|
4
5
|
hot?: boolean;
|
|
6
|
+
/** Direct mode requires `@tsrx/solid-runtime` as a direct production dependency. */
|
|
7
|
+
runtimeImports?: RuntimeImportMode;
|
|
5
8
|
}
|
|
6
9
|
|
|
7
10
|
export declare class TsrxSolidRspackPlugin implements RspackPluginInstance {
|
|
8
11
|
constructor(options?: TsrxSolidRspackPluginOptions);
|
|
9
|
-
options: TsrxSolidRspackPluginOptions
|
|
12
|
+
options: Pick<TsrxSolidRspackPluginOptions, 'hot'> &
|
|
13
|
+
Required<Pick<TsrxSolidRspackPluginOptions, 'runtimeImports'>>;
|
|
10
14
|
apply(compiler: Compiler): void;
|
|
11
15
|
}
|
|
12
16
|
|