vite-plugin-shopify-theme-islands 0.6.0 → 0.6.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/index.js +6 -2
- package/dist/runtime.js +4 -1
- package/package.json +6 -2
package/dist/index.js
CHANGED
|
@@ -9,6 +9,7 @@ var runtimePath = fileURLToPath(new URL("./runtime.js", import.meta.url));
|
|
|
9
9
|
var islandPath = fileURLToPath(new URL("./island.js", import.meta.url));
|
|
10
10
|
var ISLAND_IMPORT_RE = /from\s+['"]vite-plugin-shopify-theme-islands\/island['"]/;
|
|
11
11
|
var TS_JS_RE = /\.(ts|js)$/;
|
|
12
|
+
var SKIP_DIRS = new Set(["node_modules", "dist", "build", "public", "assets", ".cache"]);
|
|
12
13
|
var defaults = {
|
|
13
14
|
directories: ["/frontend/js/islands/"],
|
|
14
15
|
directives: {
|
|
@@ -41,7 +42,7 @@ function collectTagNames(dir, names) {
|
|
|
41
42
|
return;
|
|
42
43
|
}
|
|
43
44
|
for (const entry of entries) {
|
|
44
|
-
if (entry.name.startsWith(".") || entry.name
|
|
45
|
+
if (entry.name.startsWith(".") || SKIP_DIRS.has(entry.name))
|
|
45
46
|
continue;
|
|
46
47
|
if (entry.isDirectory()) {
|
|
47
48
|
collectTagNames(join(dir, entry.name), names);
|
|
@@ -58,7 +59,7 @@ function scanForIslandFiles(dir, found) {
|
|
|
58
59
|
return;
|
|
59
60
|
}
|
|
60
61
|
for (const entry of entries) {
|
|
61
|
-
if (entry.name.startsWith(".") || entry.name
|
|
62
|
+
if (entry.name.startsWith(".") || SKIP_DIRS.has(entry.name))
|
|
62
63
|
continue;
|
|
63
64
|
const full = join(dir, entry.name);
|
|
64
65
|
if (entry.isDirectory()) {
|
|
@@ -101,11 +102,14 @@ function shopifyThemeIslands(options = {}) {
|
|
|
101
102
|
if (scanned)
|
|
102
103
|
return;
|
|
103
104
|
scanned = true;
|
|
105
|
+
const t0 = performance.now();
|
|
104
106
|
scanForIslandFiles(root, islandFiles);
|
|
107
|
+
const scanMs = (performance.now() - t0).toFixed(1);
|
|
105
108
|
for (const f of islandFiles)
|
|
106
109
|
if (inDirectory(f))
|
|
107
110
|
islandFiles.delete(f);
|
|
108
111
|
if (debug) {
|
|
112
|
+
log(`Scanned in ${scanMs}ms`);
|
|
109
113
|
log("Scanning directories:", resolvedDirs.map((d) => d + "**/*.{ts,js}").join(", "));
|
|
110
114
|
const dirNames = [];
|
|
111
115
|
for (const dir of absDirs)
|
package/dist/runtime.js
CHANGED
|
@@ -113,7 +113,10 @@ function revive(islands, options, customDirectives) {
|
|
|
113
113
|
flush("aborted (element removed)");
|
|
114
114
|
return;
|
|
115
115
|
}
|
|
116
|
-
const run = () => loader().catch((err) =>
|
|
116
|
+
const run = () => loader().catch((err) => {
|
|
117
|
+
console.error(`[islands] Failed to load <${tagName}>:`, err);
|
|
118
|
+
queued.delete(tagName);
|
|
119
|
+
});
|
|
117
120
|
if (customDirectives?.size) {
|
|
118
121
|
const matched = [];
|
|
119
122
|
for (const [attrName, directiveFn] of customDirectives) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vite-plugin-shopify-theme-islands",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.1",
|
|
4
4
|
"description": "Vite plugin for island architecture in Shopify themes",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"packageManager": "bun@1.3.10",
|
|
@@ -58,7 +58,9 @@
|
|
|
58
58
|
"test:plugin": "bun test src/__tests__/plugin.test.ts",
|
|
59
59
|
"test:runtime": "bun test ./src/__tests__/runtime.test.ts",
|
|
60
60
|
"test": "bun test",
|
|
61
|
-
"test:watch": "bun test --watch"
|
|
61
|
+
"test:watch": "bun test --watch",
|
|
62
|
+
"lint": "oxlint src/",
|
|
63
|
+
"format": "oxfmt src/"
|
|
62
64
|
},
|
|
63
65
|
"peerDependencies": {
|
|
64
66
|
"vite": ">=6"
|
|
@@ -67,6 +69,8 @@
|
|
|
67
69
|
"@happy-dom/global-registrator": "^20.8.3",
|
|
68
70
|
"@types/bun": "latest",
|
|
69
71
|
"@types/node": "^25.3.3",
|
|
72
|
+
"oxfmt": "^0.38.0",
|
|
73
|
+
"oxlint": "^1.53.0",
|
|
70
74
|
"typescript": "^5.0.0",
|
|
71
75
|
"vite": "^6.0.0"
|
|
72
76
|
}
|