vite-plugin-sinwan 0.2.4 → 0.2.5
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/__tests__/plugin.test.ts +2 -0
- package/bun.lock +2 -2
- package/dist/index.d.ts +9 -0
- package/dist/index.js +7 -0
- package/package.json +2 -2
- package/src/index.ts +12 -0
package/__tests__/plugin.test.ts
CHANGED
|
@@ -6,7 +6,9 @@ describe("sinwan vite plugin", () => {
|
|
|
6
6
|
const plugin = sinwan({ cache: true });
|
|
7
7
|
expect(plugin.name).toBe("sinwan");
|
|
8
8
|
expect(typeof plugin.configResolved).toBe("function");
|
|
9
|
+
expect(typeof plugin.config).toBe("function");
|
|
9
10
|
expect(typeof plugin.transform).toBe("function");
|
|
11
|
+
expect(plugin.config()).toEqual({ resolve: { dedupe: ["sinwan"] } });
|
|
10
12
|
});
|
|
11
13
|
|
|
12
14
|
it("can be created with a custom cache root", () => {
|
package/bun.lock
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"": {
|
|
6
6
|
"name": "vite-plugin-sinwan",
|
|
7
7
|
"dependencies": {
|
|
8
|
-
"sinwan-compiler": "^0.2.
|
|
8
|
+
"sinwan-compiler": "^0.2.5",
|
|
9
9
|
},
|
|
10
10
|
"devDependencies": {
|
|
11
11
|
"@types/bun": "latest",
|
|
@@ -206,7 +206,7 @@
|
|
|
206
206
|
|
|
207
207
|
"semver": ["semver@6.3.1", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA=="],
|
|
208
208
|
|
|
209
|
-
"sinwan-compiler": ["sinwan-compiler@0.2.
|
|
209
|
+
"sinwan-compiler": ["sinwan-compiler@0.2.5", "", { "dependencies": { "@babel/core": "^7.24.0", "@babel/generator": "^7.24.0", "@babel/parser": "^7.24.0", "@babel/traverse": "^7.24.0", "@babel/types": "^7.24.0" }, "peerDependencies": { "typescript": "^5" }, "bin": { "sinwan": "dist/cli.js" } }, "sha512-km53R0sJvmypaPKIWu5QA067XCbhluhp1A3ilxA5Bi3+8gkMz/bMSdyehxvXfcLlcxC+m4Owi+3uXNRfQEBwFA=="],
|
|
210
210
|
|
|
211
211
|
"source-map-js": ["source-map-js@1.2.1", "", {}, "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA=="],
|
|
212
212
|
|
package/dist/index.d.ts
CHANGED
|
@@ -46,6 +46,15 @@ export interface SinwanOptions {
|
|
|
46
46
|
export declare function sinwan(options?: SinwanOptions): {
|
|
47
47
|
name: string;
|
|
48
48
|
enforce: string;
|
|
49
|
+
/**
|
|
50
|
+
* Same role as Vite's `resolve.dedupe` for React: linked `file:` / `link:`
|
|
51
|
+
* packages that depend on `sinwan` must share the app's runtime.
|
|
52
|
+
*/
|
|
53
|
+
config(): {
|
|
54
|
+
resolve: {
|
|
55
|
+
dedupe: string[];
|
|
56
|
+
};
|
|
57
|
+
};
|
|
49
58
|
configResolved(config: any): void;
|
|
50
59
|
transform(code: string, id: string): {
|
|
51
60
|
code: string;
|
package/dist/index.js
CHANGED
|
@@ -45,6 +45,13 @@ function sinwan(options = {}) {
|
|
|
45
45
|
return {
|
|
46
46
|
name: "sinwan",
|
|
47
47
|
enforce: "pre",
|
|
48
|
+
config() {
|
|
49
|
+
return {
|
|
50
|
+
resolve: {
|
|
51
|
+
dedupe: ["sinwan"]
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
},
|
|
48
55
|
configResolved(config) {
|
|
49
56
|
isServe = config?.command === "serve";
|
|
50
57
|
projectRoot = config?.root;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vite-plugin-sinwan",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.5",
|
|
4
4
|
"description": "Vite plugin for sinwan",
|
|
5
5
|
"author": "Mohammed Ben Cheikh",
|
|
6
6
|
"license": "MIT",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"typescript": "^5"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"sinwan-compiler": "^0.2.
|
|
39
|
+
"sinwan-compiler": "^0.2.5"
|
|
40
40
|
},
|
|
41
41
|
"peerDependencies": {
|
|
42
42
|
"typescript": "^5",
|
package/src/index.ts
CHANGED
|
@@ -79,6 +79,18 @@ export function sinwan(options: SinwanOptions = {}) {
|
|
|
79
79
|
name: "sinwan",
|
|
80
80
|
enforce: "pre",
|
|
81
81
|
|
|
82
|
+
/**
|
|
83
|
+
* Same role as Vite's `resolve.dedupe` for React: linked `file:` / `link:`
|
|
84
|
+
* packages that depend on `sinwan` must share the app's runtime.
|
|
85
|
+
*/
|
|
86
|
+
config() {
|
|
87
|
+
return {
|
|
88
|
+
resolve: {
|
|
89
|
+
dedupe: ["sinwan"],
|
|
90
|
+
},
|
|
91
|
+
};
|
|
92
|
+
},
|
|
93
|
+
|
|
82
94
|
configResolved(config: any) {
|
|
83
95
|
isServe = config?.command === "serve";
|
|
84
96
|
projectRoot = config?.root;
|