unplugin-raw 0.6.4 → 0.7.0
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/README.md +1 -2
- package/dist/api.d.mts +3 -3
- package/dist/api.mjs +2 -3
- package/dist/esbuild.d.mts +0 -2
- package/dist/esbuild.mjs +3 -7
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +4 -7
- package/dist/rolldown.d.mts +0 -2
- package/dist/rolldown.mjs +3 -7
- package/dist/rollup.d.mts +0 -2
- package/dist/rollup.mjs +3 -7
- package/dist/rspack.d.mts +0 -2
- package/dist/rspack.mjs +3 -7
- package/dist/{transform-DF3vB7QY.mjs → transform-DF-Ud2tE.mjs} +1 -4
- package/dist/vite.d.mts +0 -2
- package/dist/vite.mjs +3 -7
- package/dist/webpack.d.mts +0 -2
- package/dist/webpack.mjs +3 -7
- package/package.json +18 -26
- /package/dist/{options-DSAzFv_P.d.mts → options-C2J_Ngzl.d.mts} +0 -0
package/README.md
CHANGED
|
@@ -100,8 +100,7 @@ import text from './js.js?raw'
|
|
|
100
100
|
import text2 from './jsx.jsx?raw'
|
|
101
101
|
import bytes from './png.png?bytes'
|
|
102
102
|
import text3 from './ts.ts?raw'
|
|
103
|
-
|
|
104
|
-
// Import attributes (Rolldown doesn't support this syntax)
|
|
103
|
+
// Import attributes (Rolldown and Vite 8+ doesn't support this syntax)
|
|
105
104
|
import text4 from './with.js' with { type: 'text' }
|
|
106
105
|
import bytes2 from './with.png' with { type: 'bytes' }
|
|
107
106
|
```
|
package/dist/api.d.mts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { i as resolveOptions, n as OptionsResolved, r as TransformOptions, t as Options } from "./options-
|
|
2
|
-
import * as
|
|
1
|
+
import { i as resolveOptions, n as OptionsResolved, r as TransformOptions, t as Options } from "./options-C2J_Ngzl.mjs";
|
|
2
|
+
import * as _$esbuild from "esbuild";
|
|
3
3
|
import { TransformOptions as TransformOptions$1 } from "esbuild";
|
|
4
4
|
import { Buffer } from "node:buffer";
|
|
5
5
|
|
|
6
6
|
//#region src/core/transform.d.ts
|
|
7
|
-
declare function transformRaw(file: string, type: "text" | "bytes", transform?: typeof
|
|
7
|
+
declare function transformRaw(file: string, type: "text" | "bytes", transform?: typeof _$esbuild.transform, transformFilter?: (id: string | unknown) => boolean, options?: TransformOptions$1): Promise<string | Buffer>;
|
|
8
8
|
//#endregion
|
|
9
9
|
export { type Options, type OptionsResolved, type TransformOptions, resolveOptions, transformRaw };
|
package/dist/api.mjs
CHANGED
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
import { n as resolveOptions, t as transformRaw } from "./transform-
|
|
2
|
-
|
|
3
|
-
export { resolveOptions, transformRaw };
|
|
1
|
+
import { n as resolveOptions, t as transformRaw } from "./transform-DF-Ud2tE.mjs";
|
|
2
|
+
export { resolveOptions, transformRaw };
|
package/dist/esbuild.d.mts
CHANGED
package/dist/esbuild.mjs
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import "./
|
|
2
|
-
import src_default from "./index.mjs";
|
|
3
|
-
|
|
1
|
+
import unplugin from "./index.mjs";
|
|
4
2
|
//#region src/esbuild.ts
|
|
5
3
|
/**
|
|
6
4
|
* This entry file is for esbuild plugin. Requires esbuild >= 0.15
|
|
@@ -20,8 +18,6 @@ import src_default from "./index.mjs";
|
|
|
20
18
|
* })
|
|
21
19
|
* ```
|
|
22
20
|
*/
|
|
23
|
-
const esbuild =
|
|
24
|
-
var esbuild_default = esbuild;
|
|
25
|
-
|
|
21
|
+
const esbuild = unplugin.esbuild;
|
|
26
22
|
//#endregion
|
|
27
|
-
export {
|
|
23
|
+
export { esbuild as default, esbuild as "module.exports" };
|
package/dist/index.d.mts
CHANGED
package/dist/index.mjs
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { n as resolveOptions, t as transformRaw } from "./transform-
|
|
1
|
+
import { n as resolveOptions, t as transformRaw } from "./transform-DF-Ud2tE.mjs";
|
|
2
2
|
import { createUnplugin } from "unplugin";
|
|
3
3
|
import { createFilter } from "unplugin-utils";
|
|
4
|
-
|
|
5
4
|
//#region src/index.ts
|
|
6
5
|
const rawRE = /[&?]raw(?:&|$)/;
|
|
7
6
|
const bytesRE = /[&?]bytes(?:&|$)/;
|
|
@@ -19,8 +18,8 @@ const unplugin = createUnplugin((rawOptions = {}, meta) => {
|
|
|
19
18
|
"rollup",
|
|
20
19
|
"rolldown",
|
|
21
20
|
"vite"
|
|
22
|
-
].includes(meta.framework) ? async function(id, importer, options
|
|
23
|
-
const attributeType = options
|
|
21
|
+
].includes(meta.framework) ? async function(id, importer, options) {
|
|
22
|
+
const attributeType = options?.attributes?.type;
|
|
24
23
|
if (attributeType === "text") id += `${id.includes("?") ? "&" : "?"}raw`;
|
|
25
24
|
else if (attributeType === "bytes") id += `${id.includes("?") ? "&" : "?"}bytes`;
|
|
26
25
|
else if (!rawRE.test(id) && !bytesRE.test(id)) return;
|
|
@@ -54,7 +53,5 @@ const unplugin = createUnplugin((rawOptions = {}, meta) => {
|
|
|
54
53
|
} }
|
|
55
54
|
};
|
|
56
55
|
});
|
|
57
|
-
var src_default = unplugin;
|
|
58
|
-
|
|
59
56
|
//#endregion
|
|
60
|
-
export {
|
|
57
|
+
export { unplugin as default };
|
package/dist/rolldown.d.mts
CHANGED
package/dist/rolldown.mjs
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import "./
|
|
2
|
-
import src_default from "./index.mjs";
|
|
3
|
-
|
|
1
|
+
import unplugin from "./index.mjs";
|
|
4
2
|
//#region src/rolldown.ts
|
|
5
3
|
/**
|
|
6
4
|
* This entry file is for Rolldown plugin.
|
|
@@ -20,8 +18,6 @@ import src_default from "./index.mjs";
|
|
|
20
18
|
* }
|
|
21
19
|
* ```
|
|
22
20
|
*/
|
|
23
|
-
const rolldown =
|
|
24
|
-
var rolldown_default = rolldown;
|
|
25
|
-
|
|
21
|
+
const rolldown = unplugin.rolldown;
|
|
26
22
|
//#endregion
|
|
27
|
-
export {
|
|
23
|
+
export { rolldown as default, rolldown as "module.exports" };
|
package/dist/rollup.d.mts
CHANGED
package/dist/rollup.mjs
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import "./
|
|
2
|
-
import src_default from "./index.mjs";
|
|
3
|
-
|
|
1
|
+
import unplugin from "./index.mjs";
|
|
4
2
|
//#region src/rollup.ts
|
|
5
3
|
/**
|
|
6
4
|
* This entry file is for Rollup plugin.
|
|
@@ -20,8 +18,6 @@ import src_default from "./index.mjs";
|
|
|
20
18
|
* }
|
|
21
19
|
* ```
|
|
22
20
|
*/
|
|
23
|
-
const rollup =
|
|
24
|
-
var rollup_default = rollup;
|
|
25
|
-
|
|
21
|
+
const rollup = unplugin.rollup;
|
|
26
22
|
//#endregion
|
|
27
|
-
export {
|
|
23
|
+
export { rollup as default, rollup as "module.exports" };
|
package/dist/rspack.d.mts
CHANGED
package/dist/rspack.mjs
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import "./
|
|
2
|
-
import src_default from "./index.mjs";
|
|
3
|
-
|
|
1
|
+
import unplugin from "./index.mjs";
|
|
4
2
|
//#region src/rspack.ts
|
|
5
3
|
/**
|
|
6
4
|
* This entry file is for rspack plugin.
|
|
@@ -18,8 +16,6 @@ import src_default from "./index.mjs";
|
|
|
18
16
|
* }
|
|
19
17
|
* ```
|
|
20
18
|
*/
|
|
21
|
-
const rspack =
|
|
22
|
-
var rspack_default = rspack;
|
|
23
|
-
|
|
19
|
+
const rspack = unplugin.rspack;
|
|
24
20
|
//#endregion
|
|
25
|
-
export {
|
|
21
|
+
export { rspack as default, rspack as "module.exports" };
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { readFile } from "node:fs/promises";
|
|
2
2
|
import path from "node:path";
|
|
3
|
-
|
|
4
3
|
//#region src/core/options.ts
|
|
5
4
|
function resolveOptions(options) {
|
|
6
5
|
let { transform = false } = options;
|
|
@@ -16,7 +15,6 @@ function resolveOptions(options) {
|
|
|
16
15
|
} : false
|
|
17
16
|
};
|
|
18
17
|
}
|
|
19
|
-
|
|
20
18
|
//#endregion
|
|
21
19
|
//#region src/core/transform.ts
|
|
22
20
|
async function transformRaw(file, type, transform, transformFilter, options) {
|
|
@@ -50,6 +48,5 @@ const ExtToLoader = {
|
|
|
50
48
|
function guessLoader(id) {
|
|
51
49
|
return ExtToLoader[path.extname(id).toLowerCase()] || "js";
|
|
52
50
|
}
|
|
53
|
-
|
|
54
51
|
//#endregion
|
|
55
|
-
export { resolveOptions as n, transformRaw as t };
|
|
52
|
+
export { resolveOptions as n, transformRaw as t };
|
package/dist/vite.d.mts
CHANGED
package/dist/vite.mjs
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import "./
|
|
2
|
-
import src_default from "./index.mjs";
|
|
3
|
-
|
|
1
|
+
import unplugin from "./index.mjs";
|
|
4
2
|
//#region src/vite.ts
|
|
5
3
|
/**
|
|
6
4
|
* This entry file is for Vite plugin.
|
|
@@ -20,8 +18,6 @@ import src_default from "./index.mjs";
|
|
|
20
18
|
* })
|
|
21
19
|
* ```
|
|
22
20
|
*/
|
|
23
|
-
const vite =
|
|
24
|
-
var vite_default = vite;
|
|
25
|
-
|
|
21
|
+
const vite = unplugin.vite;
|
|
26
22
|
//#endregion
|
|
27
|
-
export {
|
|
23
|
+
export { vite as default, vite as "module.exports" };
|
package/dist/webpack.d.mts
CHANGED
package/dist/webpack.mjs
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import "./
|
|
2
|
-
import src_default from "./index.mjs";
|
|
3
|
-
|
|
1
|
+
import unplugin from "./index.mjs";
|
|
4
2
|
//#region src/webpack.ts
|
|
5
3
|
/**
|
|
6
4
|
* This entry file is for webpack plugin.
|
|
@@ -18,8 +16,6 @@ import src_default from "./index.mjs";
|
|
|
18
16
|
* }
|
|
19
17
|
* ```
|
|
20
18
|
*/
|
|
21
|
-
const webpack =
|
|
22
|
-
var webpack_default = webpack;
|
|
23
|
-
|
|
19
|
+
const webpack = unplugin.webpack;
|
|
24
20
|
//#endregion
|
|
25
|
-
export {
|
|
21
|
+
export { webpack as default, webpack as "module.exports" };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "unplugin-raw",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.7.0",
|
|
5
5
|
"description": "Transform file to a default-export string.",
|
|
6
6
|
"author": "Kevin Deng <sxzz@sxzz.moe>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -32,15 +32,6 @@
|
|
|
32
32
|
"./webpack": "./dist/webpack.mjs",
|
|
33
33
|
"./package.json": "./package.json"
|
|
34
34
|
},
|
|
35
|
-
"types": "./dist/index.d.mts",
|
|
36
|
-
"typesVersions": {
|
|
37
|
-
"*": {
|
|
38
|
-
"*": [
|
|
39
|
-
"./dist/*.d.mts",
|
|
40
|
-
"./*"
|
|
41
|
-
]
|
|
42
|
-
}
|
|
43
|
-
},
|
|
44
35
|
"files": [
|
|
45
36
|
"dist"
|
|
46
37
|
],
|
|
@@ -59,24 +50,25 @@
|
|
|
59
50
|
}
|
|
60
51
|
},
|
|
61
52
|
"dependencies": {
|
|
62
|
-
"unplugin": "^
|
|
53
|
+
"unplugin": "^3.0.0",
|
|
63
54
|
"unplugin-utils": "^0.3.1"
|
|
64
55
|
},
|
|
65
56
|
"devDependencies": {
|
|
66
|
-
"@sxzz/eslint-config": "^7.
|
|
67
|
-
"@sxzz/prettier-config": "^2.
|
|
68
|
-
"@types/node": "^25.0
|
|
69
|
-
"
|
|
70
|
-
"
|
|
71
|
-
"
|
|
72
|
-
"
|
|
73
|
-
"
|
|
74
|
-
"
|
|
75
|
-
"
|
|
76
|
-
"tsdown
|
|
77
|
-
"
|
|
78
|
-
"
|
|
79
|
-
"
|
|
57
|
+
"@sxzz/eslint-config": "^7.8.4",
|
|
58
|
+
"@sxzz/prettier-config": "^2.3.1",
|
|
59
|
+
"@types/node": "^25.5.0",
|
|
60
|
+
"@typescript/native-preview": "7.0.0-dev.20260328.1",
|
|
61
|
+
"bumpp": "^11.0.1",
|
|
62
|
+
"esbuild": "^0.27.4",
|
|
63
|
+
"eslint": "^10.1.0",
|
|
64
|
+
"prettier": "^3.8.1",
|
|
65
|
+
"rolldown": "^1.0.0-rc.12",
|
|
66
|
+
"rollup": "^4.60.0",
|
|
67
|
+
"tsdown": "^0.21.7",
|
|
68
|
+
"tsdown-preset-sxzz": "^0.5.0",
|
|
69
|
+
"typescript": "^6.0.2",
|
|
70
|
+
"vite": "^8.0.3",
|
|
71
|
+
"vitest": "^4.1.2"
|
|
80
72
|
},
|
|
81
73
|
"prettier": "@sxzz/prettier-config",
|
|
82
74
|
"scripts": {
|
|
@@ -85,7 +77,7 @@
|
|
|
85
77
|
"build": "tsdown",
|
|
86
78
|
"dev": "tsdown --watch",
|
|
87
79
|
"test": "vitest",
|
|
88
|
-
"typecheck": "
|
|
80
|
+
"typecheck": "tsgo --noEmit",
|
|
89
81
|
"release": "bumpp"
|
|
90
82
|
}
|
|
91
83
|
}
|
|
File without changes
|