Comparing version 1.0.1 to 1.0.2
@@ -199,2 +199,17 @@ // src/plugins/serve.ts | ||
// src/utils/ensure-arc-plugin-is-first.ts | ||
var arcVitePluginNameReg = /^arc-vite/; | ||
function ensureArcPluginIsFirst(plugins) { | ||
for (let i = plugins.length; i--; ) { | ||
const plugin = plugins[i]; | ||
if (!Array.isArray(plugin)) | ||
continue; | ||
const [firstPlugin] = plugin; | ||
if (firstPlugin && typeof firstPlugin === "object" && "name" in firstPlugin && arcVitePluginNameReg.test(firstPlugin.name)) { | ||
plugins[i] = false; | ||
plugins.unshift(plugin); | ||
} | ||
} | ||
} | ||
// src/plugins/serve.ts | ||
@@ -220,2 +235,3 @@ function pluginServe({ | ||
return; | ||
ensureArcPluginIsFirst(config.plugins); | ||
config.cacheDir = path3.resolve( | ||
@@ -227,3 +243,3 @@ `node_modules/.vite/arc/${flagSet.join(".")}` | ||
config.optimizeDeps.esbuildOptions.plugins ??= []; | ||
config.optimizeDeps.esbuildOptions.plugins.push({ | ||
config.optimizeDeps.esbuildOptions.plugins.unshift({ | ||
name: "arc-vite:serve:esbuild", | ||
@@ -523,3 +539,3 @@ setup(build) { | ||
var arcInitPrefix = `${arcPrefix}init:`; | ||
var arcHTMLChunkReg = /([^/\\]+?)\.arc(?:\.(.+))?\.html$/; | ||
var arcHTMLChunkReg = /(.+)\.arc(?:\.(.+))?\.html$/; | ||
function pluginBuildWeb({ | ||
@@ -544,2 +560,5 @@ runtimeId, | ||
apply, | ||
config(config) { | ||
ensureArcPluginIsFirst(config.plugins); | ||
}, | ||
configResolved(config) { | ||
@@ -673,3 +692,3 @@ basePath = config.base; | ||
] of adaptiveImporters) { | ||
const info = this.getModuleInfo(importer2) || await this.load({ id: importer2 }); | ||
const info = await this.load({ id: importer2 }); | ||
for (const child of info.ast.body) { | ||
@@ -742,3 +761,3 @@ if (child.type === "ImportDeclaration") { | ||
id = decodeArcProxyId(id); | ||
const info = this.getModuleInfo(id); | ||
const info = await this.load({ id }); | ||
if (info) { | ||
@@ -872,3 +891,3 @@ let code = ""; | ||
} | ||
manifestCode += `}return {"head": ["<script>window.${runtimeId}_d?.();window.${runtimeId}_d = true;</script>"]}}; | ||
manifestCode += `}return {"head": ["<script>console.error('Unable to load adaptive arc files, unknown entry was provided when asking for assets.')</script>"]}}; | ||
`; | ||
@@ -967,2 +986,5 @@ await Promise.all( | ||
}, | ||
config(config) { | ||
ensureArcPluginIsFirst(config.plugins); | ||
}, | ||
configResolved(config) { | ||
@@ -994,5 +1016,2 @@ root = config.root; | ||
adaptiveMatchesForId.set(id, matches); | ||
if (!this.getModuleInfo(id)?.ast) { | ||
await this.load(resolved); | ||
} | ||
return { | ||
@@ -1045,3 +1064,3 @@ id: encodeArcProxyId(id) | ||
if (adaptiveMatches) { | ||
const info = this.getModuleInfo(id); | ||
const info = await this.load({ id }); | ||
if (info) { | ||
@@ -1048,0 +1067,0 @@ if (isCssFile(id)) { |
{ | ||
"name": "arc-vite", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "Declaratively bundle and execute code specific to your users ARC and Vite.", | ||
@@ -52,3 +52,4 @@ "keywords": [ | ||
"@changesets/cli": "^2.26.2", | ||
"@marko/compiler": "^5.33.5", | ||
"@marko/compiler": "^5.33.7", | ||
"@marko/vite": "^4.0.0", | ||
"@playwright/test": "^1.39.0", | ||
@@ -67,4 +68,5 @@ "@types/estree": "^1.0.5", | ||
"lint-staged": "^15.0.2", | ||
"marko": "^5.31.17", | ||
"playwright": "^1.39.0", | ||
"prettier": "^3.0.3", | ||
"prettier": "^3.1.0", | ||
"serve-handler": "^6.1.5", | ||
@@ -71,0 +73,0 @@ "sort-package-json": "^2.6.0", |
50057
18
1252
25