@geajs/vite-plugin 1.3.0 → 1.3.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.mjs +16 -9
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -6066,7 +6066,8 @@ function transformStaticRootMount(source, filePath, resolveImportPath) {
|
|
|
6066
6066
|
compact: false,
|
|
6067
6067
|
jsescOption: { minimal: true }
|
|
6068
6068
|
}).code,
|
|
6069
|
-
changed: true
|
|
6069
|
+
changed: true,
|
|
6070
|
+
watchFiles: [resolved, ...factory.watchFiles]
|
|
6070
6071
|
};
|
|
6071
6072
|
}
|
|
6072
6073
|
function collectDefaultImports(ast) {
|
|
@@ -6162,6 +6163,7 @@ function createStaticTemplateFactory(componentPath, tplName, mountFilePath, reso
|
|
|
6162
6163
|
const jsx = templateMethod ? extractTemplateJsx(templateMethod) : null;
|
|
6163
6164
|
if (!jsx || !isBuiltinElementRoot(jsx)) return null;
|
|
6164
6165
|
const ctx = createEmitContext();
|
|
6166
|
+
const watchFiles = /* @__PURE__ */ new Set();
|
|
6165
6167
|
ctx.directFnComponents = collectDirectFnComponents(ast);
|
|
6166
6168
|
ctx.directFnComponentParams = collectDirectFnComponentParams(ast, ctx.directFnComponents);
|
|
6167
6169
|
ctx.directFnNoDisposer = /* @__PURE__ */ new Set();
|
|
@@ -6169,7 +6171,7 @@ function createStaticTemplateFactory(componentPath, tplName, mountFilePath, reso
|
|
|
6169
6171
|
ctx.directClassComponents = /* @__PURE__ */ new Set();
|
|
6170
6172
|
ctx.directFactoryComponents = /* @__PURE__ */ new Set();
|
|
6171
6173
|
const importedFns = [];
|
|
6172
|
-
if (!collectImportedStaticFunctionComponents(ast, componentPath, resolveImportPath, ctx, importedFns)) return null;
|
|
6174
|
+
if (!collectImportedStaticFunctionComponents(ast, componentPath, resolveImportPath, ctx, importedFns, watchFiles)) return null;
|
|
6173
6175
|
ctx.directFnStringProps = collectDirectFnStringProps(ast, ctx.directFnComponents);
|
|
6174
6176
|
if (nodeContainsAnyIdentifier(jsx, collectRootModuleBindings(ast, classDecl, ctx.directFnComponents))) return null;
|
|
6175
6177
|
const importedFnDecls = [];
|
|
@@ -6217,7 +6219,8 @@ function createStaticTemplateFactory(componentPath, tplName, mountFilePath, reso
|
|
|
6217
6219
|
factoryDecl
|
|
6218
6220
|
],
|
|
6219
6221
|
mountExpression: t.callExpression(t.identifier(tplName + "_create"), disposerArg),
|
|
6220
|
-
importsNeeded: ctx.importsNeeded
|
|
6222
|
+
importsNeeded: ctx.importsNeeded,
|
|
6223
|
+
watchFiles: [...watchFiles]
|
|
6221
6224
|
};
|
|
6222
6225
|
}
|
|
6223
6226
|
function collectCopiedImports(ast, componentPath, mountFilePath, resolveImportPath, compiledImportNames) {
|
|
@@ -6246,7 +6249,7 @@ function toRelativeImportSource(fromFile, targetFile) {
|
|
|
6246
6249
|
if (!source.startsWith(".")) source = "./" + source;
|
|
6247
6250
|
return source;
|
|
6248
6251
|
}
|
|
6249
|
-
function collectImportedStaticFunctionComponents(ast, importerPath, resolveImportPath, ctx, importedFns) {
|
|
6252
|
+
function collectImportedStaticFunctionComponents(ast, importerPath, resolveImportPath, ctx, importedFns, watchFiles) {
|
|
6250
6253
|
for (const stmt of ast.program.body) {
|
|
6251
6254
|
if (!t.isImportDeclaration(stmt)) continue;
|
|
6252
6255
|
if (stmt.source.value === "@geajs/core") continue;
|
|
@@ -6256,6 +6259,7 @@ function collectImportedStaticFunctionComponents(ast, importerPath, resolveImpor
|
|
|
6256
6259
|
if (componentSpecs.length === 0) continue;
|
|
6257
6260
|
const resolved = resolveImportPath(importerPath, stmt.source.value);
|
|
6258
6261
|
if (!resolved) return false;
|
|
6262
|
+
watchFiles.add(resolved);
|
|
6259
6263
|
const imported = readImportModule(resolved);
|
|
6260
6264
|
if (!imported) return false;
|
|
6261
6265
|
for (const spec of componentSpecs) {
|
|
@@ -6989,7 +6993,7 @@ function geaPlugin() {
|
|
|
6989
6993
|
}
|
|
6990
6994
|
}
|
|
6991
6995
|
if (/\bclass\s+Component\s+extends\s+Store\b/.test(code)) return null;
|
|
6992
|
-
if (!
|
|
6996
|
+
if (!isSSR) {
|
|
6993
6997
|
const observeResult = transformDottedObserveCalls(transformedCode);
|
|
6994
6998
|
if (observeResult?.changed) {
|
|
6995
6999
|
transformedCode = observeResult.code;
|
|
@@ -7001,10 +7005,13 @@ function geaPlugin() {
|
|
|
7001
7005
|
map: null
|
|
7002
7006
|
};
|
|
7003
7007
|
const rootMountResult = transformStaticRootMount(transformedCode, cleanId, resolveImportPath);
|
|
7004
|
-
if (rootMountResult?.changed)
|
|
7005
|
-
|
|
7006
|
-
|
|
7007
|
-
|
|
7008
|
+
if (rootMountResult?.changed) {
|
|
7009
|
+
for (const file of rootMountResult.watchFiles ?? []) this.addWatchFile?.(file);
|
|
7010
|
+
return {
|
|
7011
|
+
code: rootMountResult.code,
|
|
7012
|
+
map: null
|
|
7013
|
+
};
|
|
7014
|
+
}
|
|
7008
7015
|
}
|
|
7009
7016
|
const result = transform({
|
|
7010
7017
|
sourceFile: cleanId,
|