vite-plugin-zephyr 0.1.5-next.4 → 0.1.6-next.1
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/lib/internal/extract/load_public_dir.d.ts +1 -1
- package/dist/lib/internal/extract/load_public_dir.js +23 -32
- package/dist/lib/internal/extract/load_public_dir.js.map +1 -1
- package/dist/lib/internal/extract/load_static_assets.js +32 -16
- package/dist/lib/internal/extract/load_static_assets.js.map +1 -1
- package/dist/lib/internal/extract/load_static_entries.js +18 -28
- package/dist/lib/internal/extract/load_static_entries.js.map +1 -1
- package/dist/package.json +1 -1
- package/package.json +2 -2
|
@@ -3,5 +3,5 @@ interface LoadPublicDirOptions {
|
|
|
3
3
|
outDir: string;
|
|
4
4
|
publicDir: string;
|
|
5
5
|
}
|
|
6
|
-
export declare function load_public_dir(
|
|
6
|
+
export declare function load_public_dir({ publicDir, outDir, }: LoadPublicDirOptions): Promise<OutputAsset[]>;
|
|
7
7
|
export {};
|
|
@@ -1,39 +1,30 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.load_public_dir = load_public_dir;
|
|
4
|
-
const node_fs_1 = require("node:fs");
|
|
5
4
|
const node_path_1 = require("node:path");
|
|
6
5
|
const vite_1 = require("vite");
|
|
7
|
-
const
|
|
8
|
-
async function load_public_dir(
|
|
9
|
-
const
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
originalFileName: (0, node_path_1.basename)(file),
|
|
31
|
-
originalFileNames: [(0, node_path_1.basename)(file)],
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
};
|
|
36
|
-
await loadDir(publicDir, outDir);
|
|
37
|
-
return publicAssets;
|
|
6
|
+
const zephyr_agent_1 = require("zephyr-agent");
|
|
7
|
+
async function load_public_dir({ publicDir, outDir, }) {
|
|
8
|
+
const files = await (0, zephyr_agent_1.readDirRecursiveWithContents)(publicDir);
|
|
9
|
+
const normalizedOutDir = (0, node_path_1.resolve)(outDir);
|
|
10
|
+
return files
|
|
11
|
+
.filter((file) =>
|
|
12
|
+
// Skip outDir and its contents to avoid including build outputs as public assets
|
|
13
|
+
// (e.g., when publicDir = '/project' and outDir = '/project/dist')
|
|
14
|
+
file.fullPath !== normalizedOutDir &&
|
|
15
|
+
!file.fullPath.startsWith(normalizedOutDir + '/'))
|
|
16
|
+
.map((file) => {
|
|
17
|
+
const fileName = (0, node_path_1.basename)(file.fullPath);
|
|
18
|
+
return {
|
|
19
|
+
name: fileName,
|
|
20
|
+
names: [fileName],
|
|
21
|
+
needsCodeReference: false,
|
|
22
|
+
source: file.content,
|
|
23
|
+
type: 'asset',
|
|
24
|
+
fileName: (0, vite_1.normalizePath)(file.relativePath),
|
|
25
|
+
originalFileName: fileName,
|
|
26
|
+
originalFileNames: [fileName],
|
|
27
|
+
};
|
|
28
|
+
});
|
|
38
29
|
}
|
|
39
30
|
//# sourceMappingURL=load_public_dir.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"load_public_dir.js","sourceRoot":"","sources":["../../../../src/lib/internal/extract/load_public_dir.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"load_public_dir.js","sourceRoot":"","sources":["../../../../src/lib/internal/extract/load_public_dir.ts"],"names":[],"mappings":";;AAUA,0CA6BC;AAvCD,yCAA8C;AAE9C,+BAAqC;AACrC,+CAA4D;AAOrD,KAAK,UAAU,eAAe,CAAC,EACpC,SAAS,EACT,MAAM,GACe;IACrB,MAAM,KAAK,GAAG,MAAM,IAAA,2CAA4B,EAAC,SAAS,CAAC,CAAC;IAC5D,MAAM,gBAAgB,GAAG,IAAA,mBAAO,EAAC,MAAM,CAAC,CAAC;IAEzC,OAAO,KAAK;SACT,MAAM,CACL,CAAC,IAAI,EAAE,EAAE;IACP,iFAAiF;IACjF,mEAAmE;IACnE,IAAI,CAAC,QAAQ,KAAK,gBAAgB;QAClC,CAAC,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,gBAAgB,GAAG,GAAG,CAAC,CACpD;SACA,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;QACZ,MAAM,QAAQ,GAAG,IAAA,oBAAQ,EAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAEzC,OAAO;YACL,IAAI,EAAE,QAAQ;YACd,KAAK,EAAE,CAAC,QAAQ,CAAC;YACjB,kBAAkB,EAAE,KAAK;YACzB,MAAM,EAAE,IAAI,CAAC,OAAO;YACpB,IAAI,EAAE,OAAgB;YACtB,QAAQ,EAAE,IAAA,oBAAa,EAAC,IAAI,CAAC,YAAY,CAAC;YAC1C,gBAAgB,EAAE,QAAQ;YAC1B,iBAAiB,EAAE,CAAC,QAAQ,CAAC;SAC9B,CAAC;IACJ,CAAC,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -1,25 +1,41 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.loadStaticAssets = loadStaticAssets;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
4
5
|
const load_public_dir_1 = require("./load_public_dir");
|
|
5
6
|
const load_static_entries_1 = require("./load_static_entries");
|
|
6
7
|
async function loadStaticAssets(vite_internal_options) {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
8
|
+
var _a, e_1, _b, _c;
|
|
9
|
+
const bundle = {};
|
|
10
|
+
try {
|
|
11
|
+
for (var _d = true, _e = tslib_1.__asyncValues([
|
|
12
|
+
(0, load_static_entries_1.load_static_entries)({
|
|
13
|
+
root: vite_internal_options.root,
|
|
14
|
+
outDir: vite_internal_options.outDir,
|
|
15
|
+
}),
|
|
16
|
+
// Only load if specified
|
|
17
|
+
vite_internal_options.publicDir
|
|
18
|
+
? (0, load_public_dir_1.load_public_dir)({
|
|
19
|
+
outDir: vite_internal_options.outDir,
|
|
20
|
+
publicDir: vite_internal_options.publicDir,
|
|
21
|
+
})
|
|
22
|
+
: [],
|
|
23
|
+
]), _f; _f = await _e.next(), _a = _f.done, !_a; _d = true) {
|
|
24
|
+
_c = _f.value;
|
|
25
|
+
_d = false;
|
|
26
|
+
const assets = _c;
|
|
27
|
+
for (const asset of assets) {
|
|
28
|
+
bundle[asset.fileName] = asset;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
14
31
|
}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
}, {});
|
|
32
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
33
|
+
finally {
|
|
34
|
+
try {
|
|
35
|
+
if (!_d && !_a && (_b = _e.return)) await _b.call(_e);
|
|
36
|
+
}
|
|
37
|
+
finally { if (e_1) throw e_1.error; }
|
|
38
|
+
}
|
|
39
|
+
return bundle;
|
|
24
40
|
}
|
|
25
41
|
//# sourceMappingURL=load_static_assets.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"load_static_assets.js","sourceRoot":"","sources":["../../../../src/lib/internal/extract/load_static_assets.ts"],"names":[],"mappings":";;AAKA,
|
|
1
|
+
{"version":3,"file":"load_static_assets.js","sourceRoot":"","sources":["../../../../src/lib/internal/extract/load_static_assets.ts"],"names":[],"mappings":";;AAKA,4CAyBC;;AA5BD,uDAAoD;AACpD,+DAA4D;AAErD,KAAK,UAAU,gBAAgB,CACpC,qBAA4C;;IAE5C,MAAM,MAAM,GAAiB,EAAE,CAAC;;QAEhC,KAA2B,eAAA,KAAA,sBAAA;YACzB,IAAA,yCAAmB,EAAC;gBAClB,IAAI,EAAE,qBAAqB,CAAC,IAAI;gBAChC,MAAM,EAAE,qBAAqB,CAAC,MAAM;aACrC,CAAC;YAEF,yBAAyB;YACzB,qBAAqB,CAAC,SAAS;gBAC7B,CAAC,CAAC,IAAA,iCAAe,EAAC;oBACd,MAAM,EAAE,qBAAqB,CAAC,MAAM;oBACpC,SAAS,EAAE,qBAAqB,CAAC,SAAS;iBAC3C,CAAC;gBACJ,CAAC,CAAC,EAAE;SACP,CAAA,IAAA,sDAAE,CAAC;YAbuB,cAa1B;YAb0B,WAa1B;YAbU,MAAM,MAAM,KAAA,CAAA;YAcrB,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;gBAC3B,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,GAAG,KAAK,CAAC;YACjC,CAAC;QACH,CAAC;;;;;;;;;IAED,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -2,35 +2,25 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.load_static_entries = load_static_entries;
|
|
4
4
|
const node_path_1 = require("node:path");
|
|
5
|
-
const node_fs_1 = require("node:fs");
|
|
6
5
|
const vite_1 = require("vite");
|
|
7
|
-
const
|
|
6
|
+
const zephyr_agent_1 = require("zephyr-agent");
|
|
8
7
|
async function load_static_entries(props) {
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
source: await (0, node_util_1.promisify)(node_fs_1.readFile)(destFile),
|
|
27
|
-
type: 'asset',
|
|
28
|
-
originalFileName: file,
|
|
29
|
-
originalFileNames: [file],
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
};
|
|
33
|
-
await loadDir(root_dist_dir);
|
|
34
|
-
return publicAssets;
|
|
8
|
+
const root_dist_dir = (0, node_path_1.resolve)(props.root, props.outDir);
|
|
9
|
+
// Load all files from the output directory - no filtering needed since
|
|
10
|
+
// we're intentionally reading build outputs, not public assets
|
|
11
|
+
const files = await (0, zephyr_agent_1.readDirRecursiveWithContents)(root_dist_dir);
|
|
12
|
+
return files.map((file) => {
|
|
13
|
+
const fileName = (0, node_path_1.basename)(file.fullPath);
|
|
14
|
+
return {
|
|
15
|
+
fileName: (0, vite_1.normalizePath)(file.relativePath),
|
|
16
|
+
name: fileName,
|
|
17
|
+
names: [fileName],
|
|
18
|
+
needsCodeReference: false,
|
|
19
|
+
source: file.content,
|
|
20
|
+
type: 'asset',
|
|
21
|
+
originalFileName: fileName,
|
|
22
|
+
originalFileNames: [fileName],
|
|
23
|
+
};
|
|
24
|
+
});
|
|
35
25
|
}
|
|
36
26
|
//# sourceMappingURL=load_static_entries.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"load_static_entries.js","sourceRoot":"","sources":["../../../../src/lib/internal/extract/load_static_entries.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"load_static_entries.js","sourceRoot":"","sources":["../../../../src/lib/internal/extract/load_static_entries.ts"],"names":[],"mappings":";;AAUA,kDAsBC;AA/BD,yCAA8C;AAC9C,+BAAqC;AACrC,+CAA4D;AAOrD,KAAK,UAAU,mBAAmB,CACvC,KAA+B;IAE/B,MAAM,aAAa,GAAG,IAAA,mBAAO,EAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IACxD,uEAAuE;IACvE,+DAA+D;IAC/D,MAAM,KAAK,GAAG,MAAM,IAAA,2CAA4B,EAAC,aAAa,CAAC,CAAC;IAEhE,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;QACxB,MAAM,QAAQ,GAAG,IAAA,oBAAQ,EAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAEzC,OAAO;YACL,QAAQ,EAAE,IAAA,oBAAa,EAAC,IAAI,CAAC,YAAY,CAAC;YAC1C,IAAI,EAAE,QAAQ;YACd,KAAK,EAAE,CAAC,QAAQ,CAAC;YACjB,kBAAkB,EAAE,KAAK;YACzB,MAAM,EAAE,IAAI,CAAC,OAAO;YACpB,IAAI,EAAE,OAAgB;YACtB,gBAAgB,EAAE,QAAQ;YAC1B,iBAAiB,EAAE,CAAC,QAAQ,CAAC;SAC9B,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC"}
|
package/dist/package.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vite-plugin-zephyr",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.6-next.1",
|
|
4
4
|
"description": "Vite plugin for Zephyr",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"acorn-walk": "^8.3.4",
|
|
23
23
|
"magic-string": "0.30.17",
|
|
24
24
|
"tslib": "^2.8.1",
|
|
25
|
-
"zephyr-agent": "0.1.
|
|
25
|
+
"zephyr-agent": "0.1.6-next.1"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"@types/jest": "29.5.14",
|