@peerbit/vite 1.0.1 → 1.0.2-171d517
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/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +8 -7
- package/dist/src/index.js.map +1 -1
- package/package.json +73 -73
- package/src/index.ts +9 -7
package/dist/src/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,MAAM,CAAC;mCA4E/B;IACR,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,MAAM,CAAC,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;CACzC,KACC,YAAY,EAAE;AALjB,wBA0BE"}
|
package/dist/src/index.js
CHANGED
|
@@ -28,7 +28,7 @@ function copyToPublicPlugin(options = {}) {
|
|
|
28
28
|
options.assets.forEach(({ src, dest }) => {
|
|
29
29
|
const sourcePath = path.resolve(src);
|
|
30
30
|
const destinationPath = path.resolve(process.cwd(), "public", dest);
|
|
31
|
-
copyAssets(sourcePath, destinationPath);
|
|
31
|
+
copyAssets(sourcePath, destinationPath, "/");
|
|
32
32
|
});
|
|
33
33
|
}
|
|
34
34
|
},
|
|
@@ -36,6 +36,7 @@ function copyToPublicPlugin(options = {}) {
|
|
|
36
36
|
}
|
|
37
37
|
const findLibraryInNodeModules = (library) => {
|
|
38
38
|
// scan upwards until we find the node_modules folder
|
|
39
|
+
let maxSearchDepth = 10;
|
|
39
40
|
let currentDir = process.cwd();
|
|
40
41
|
let nodeModulesDir = path.join(currentDir, "node_modules");
|
|
41
42
|
while (!fs.existsSync(path.join(nodeModulesDir, library))) {
|
|
@@ -46,6 +47,10 @@ const findLibraryInNodeModules = (library) => {
|
|
|
46
47
|
if (fs.existsSync(path.join(currentDir, ".git"))) {
|
|
47
48
|
break;
|
|
48
49
|
}
|
|
50
|
+
maxSearchDepth--;
|
|
51
|
+
if (maxSearchDepth <= 0) {
|
|
52
|
+
throw new Error(`Could not find ${library} node_modules folder`);
|
|
53
|
+
}
|
|
49
54
|
}
|
|
50
55
|
const libraryPath = path.join(nodeModulesDir, library);
|
|
51
56
|
if (!fs.existsSync(libraryPath)) {
|
|
@@ -79,24 +84,20 @@ export default (options = {}) => {
|
|
|
79
84
|
}),
|
|
80
85
|
];
|
|
81
86
|
};
|
|
82
|
-
function copyAssets(srcPath, destPath) {
|
|
87
|
+
function copyAssets(srcPath, destPath, base) {
|
|
83
88
|
if (!fs.existsSync(srcPath)) {
|
|
84
89
|
throw new Error(`File ${srcPath} does not exist`);
|
|
85
90
|
}
|
|
86
91
|
if (fs.statSync(srcPath).isDirectory()) {
|
|
87
|
-
// Ensure the directory exists in the public folder
|
|
88
92
|
fs.mkdirSync(destPath, { recursive: true });
|
|
89
|
-
// Copy each file/directory inside the current directory
|
|
90
93
|
fs.readdirSync(srcPath).forEach((file) => {
|
|
91
94
|
const srcFilePath = path.join(srcPath, file);
|
|
92
95
|
const destFilePath = path.join(destPath, file);
|
|
93
|
-
copyAssets(srcFilePath, destFilePath);
|
|
96
|
+
copyAssets(srcFilePath, destFilePath, base);
|
|
94
97
|
});
|
|
95
98
|
}
|
|
96
99
|
else {
|
|
97
|
-
// Ensure the destination directory exists
|
|
98
100
|
fs.mkdirSync(path.dirname(destPath), { recursive: true });
|
|
99
|
-
// Copy the file
|
|
100
101
|
fs.copyFileSync(srcPath, destPath);
|
|
101
102
|
}
|
|
102
103
|
}
|
package/dist/src/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","source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73
|
-
|
|
74
|
-
|
|
2
|
+
"name": "@peerbit/vite",
|
|
3
|
+
"version": "1.0.2-171d517",
|
|
4
|
+
"description": "Plugin for Vite to use Peerbit",
|
|
5
|
+
"sideEffects": false,
|
|
6
|
+
"type": "module",
|
|
7
|
+
"types": "./dist/src/index.d.ts",
|
|
8
|
+
"typesVersions": {
|
|
9
|
+
"*": {
|
|
10
|
+
"*": [
|
|
11
|
+
"*",
|
|
12
|
+
"dist/*",
|
|
13
|
+
"dist/src/*",
|
|
14
|
+
"dist/src/*/index"
|
|
15
|
+
],
|
|
16
|
+
"src/*": [
|
|
17
|
+
"*",
|
|
18
|
+
"dist/*",
|
|
19
|
+
"dist/src/*",
|
|
20
|
+
"dist/src/*/index"
|
|
21
|
+
]
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"files": [
|
|
25
|
+
"src",
|
|
26
|
+
"dist",
|
|
27
|
+
"!dist/e2e",
|
|
28
|
+
"!dist/test",
|
|
29
|
+
"!**/*.tsbuildinfo"
|
|
30
|
+
],
|
|
31
|
+
"exports": {
|
|
32
|
+
".": {
|
|
33
|
+
"types": "./dist/src/index.d.ts",
|
|
34
|
+
"import": "./dist/src/index.js"
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
"eslintConfig": {
|
|
38
|
+
"extends": "peerbit",
|
|
39
|
+
"parserOptions": {
|
|
40
|
+
"project": true,
|
|
41
|
+
"sourceType": "module"
|
|
42
|
+
},
|
|
43
|
+
"ignorePatterns": [
|
|
44
|
+
"!.aegir.js",
|
|
45
|
+
"test/ts-use",
|
|
46
|
+
"*.d.ts"
|
|
47
|
+
]
|
|
48
|
+
},
|
|
49
|
+
"publishConfig": {
|
|
50
|
+
"access": "public"
|
|
51
|
+
},
|
|
52
|
+
"scripts": {
|
|
53
|
+
"clean": "aegir clean",
|
|
54
|
+
"build": "aegir build --no-bundle",
|
|
55
|
+
"test": "",
|
|
56
|
+
"lint": "aegir lint"
|
|
57
|
+
},
|
|
58
|
+
"repository": {
|
|
59
|
+
"type": "git",
|
|
60
|
+
"url": "https://github.com/dao-xyz/peerbit"
|
|
61
|
+
},
|
|
62
|
+
"engines": {
|
|
63
|
+
"node": ">=16.15.1"
|
|
64
|
+
},
|
|
65
|
+
"author": "dao.xyz",
|
|
66
|
+
"license": "MIT",
|
|
67
|
+
"dependencies": {
|
|
68
|
+
"vite-plugin-static-copy": "^1.0.0",
|
|
69
|
+
"vite": "^5.0.10"
|
|
70
|
+
},
|
|
71
|
+
"devDependencies": {},
|
|
72
|
+
"localMaintainers": [
|
|
73
|
+
"dao.xyz"
|
|
74
|
+
]
|
|
75
75
|
}
|
package/src/index.ts
CHANGED
|
@@ -35,7 +35,7 @@ function copyToPublicPlugin(
|
|
|
35
35
|
const sourcePath = path.resolve(src);
|
|
36
36
|
const destinationPath = path.resolve(process.cwd(), "public", dest);
|
|
37
37
|
|
|
38
|
-
copyAssets(sourcePath, destinationPath);
|
|
38
|
+
copyAssets(sourcePath, destinationPath, "/");
|
|
39
39
|
});
|
|
40
40
|
}
|
|
41
41
|
},
|
|
@@ -44,6 +44,7 @@ function copyToPublicPlugin(
|
|
|
44
44
|
|
|
45
45
|
const findLibraryInNodeModules = (library: string) => {
|
|
46
46
|
// scan upwards until we find the node_modules folder
|
|
47
|
+
let maxSearchDepth = 10;
|
|
47
48
|
let currentDir = process.cwd();
|
|
48
49
|
let nodeModulesDir = path.join(currentDir, "node_modules");
|
|
49
50
|
|
|
@@ -56,6 +57,11 @@ const findLibraryInNodeModules = (library: string) => {
|
|
|
56
57
|
if (fs.existsSync(path.join(currentDir, ".git"))) {
|
|
57
58
|
break;
|
|
58
59
|
}
|
|
60
|
+
|
|
61
|
+
maxSearchDepth--;
|
|
62
|
+
if (maxSearchDepth <= 0) {
|
|
63
|
+
throw new Error(`Could not find ${library} node_modules folder`);
|
|
64
|
+
}
|
|
59
65
|
}
|
|
60
66
|
const libraryPath = path.join(nodeModulesDir, library);
|
|
61
67
|
if (!fs.existsSync(libraryPath)) {
|
|
@@ -97,27 +103,23 @@ export default (
|
|
|
97
103
|
];
|
|
98
104
|
};
|
|
99
105
|
|
|
100
|
-
function copyAssets(srcPath: string, destPath: string) {
|
|
106
|
+
function copyAssets(srcPath: string, destPath: string, base: string) {
|
|
101
107
|
if (!fs.existsSync(srcPath)) {
|
|
102
108
|
throw new Error(`File ${srcPath} does not exist`);
|
|
103
109
|
}
|
|
104
110
|
|
|
105
111
|
if (fs.statSync(srcPath).isDirectory()) {
|
|
106
|
-
// Ensure the directory exists in the public folder
|
|
107
112
|
fs.mkdirSync(destPath, { recursive: true });
|
|
108
113
|
|
|
109
|
-
// Copy each file/directory inside the current directory
|
|
110
114
|
fs.readdirSync(srcPath).forEach((file) => {
|
|
111
115
|
const srcFilePath = path.join(srcPath, file);
|
|
112
116
|
const destFilePath = path.join(destPath, file);
|
|
113
117
|
|
|
114
|
-
copyAssets(srcFilePath, destFilePath);
|
|
118
|
+
copyAssets(srcFilePath, destFilePath, base);
|
|
115
119
|
});
|
|
116
120
|
} else {
|
|
117
|
-
// Ensure the destination directory exists
|
|
118
121
|
fs.mkdirSync(path.dirname(destPath), { recursive: true });
|
|
119
122
|
|
|
120
|
-
// Copy the file
|
|
121
123
|
fs.copyFileSync(srcPath, destPath);
|
|
122
124
|
}
|
|
123
125
|
}
|