veryfront 0.1.784 → 0.1.785

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/esm/deno.js CHANGED
@@ -1,6 +1,6 @@
1
1
  export default {
2
2
  "name": "veryfront",
3
- "version": "0.1.784",
3
+ "version": "0.1.785",
4
4
  "license": "Apache-2.0",
5
5
  "nodeModulesDir": "auto",
6
6
  "minimumDependencyAge": {
@@ -1 +1 @@
1
- {"version":3,"file":"build-executor.d.ts","sourceRoot":"","sources":["../../../src/src/release-assets/build-executor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAiCH,MAAM,WAAW,sBAAsB;IACrC,yDAAyD;IACzD,gBAAgB,EAAE,MAAM,CAAC;IACzB,oBAAoB;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,oBAAoB;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,iCAAiC;IACjC,cAAc,EAAE,MAAM,CAAC;IACvB,yDAAyD;IACzD,iBAAiB,EAAE,MAAM,CAAC;IAC1B,oCAAoC;IACpC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;;;OAIG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,gDAAgD;IAChD,MAAM,EAAE,uBAAuB,CAAC;IAChC,sDAAsD;IAEtD,OAAO,EAAE,GAAG,CAAC;IACb;;;;OAIG;IACH,SAAS,CAAC,EAAE,qBAAqB,CAAC;CACnC;AAED,MAAM,MAAM,qBAAqB,GAAG,CAClC,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,MAAM,EAClB,UAAU,EAAE,MAAM,EAElB,OAAO,EAAE,GAAG,EACZ,OAAO,EAAE;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,OAAO,CAAC;IAAC,GAAG,EAAE,OAAO,CAAC;IAAC,YAAY,CAAC,EAAE,MAAM,CAAA;CAAE,KAC9E,OAAO,CAAC,MAAM,CAAC,CAAC;AAErB,oEAA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E,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAkCD,2DAA2D;AAC3D,wBAAgB,YAAY,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAM/D;AAgXD;;;GAGG;AACH,wBAAsB,oBAAoB,CACxC,KAAK,EAAE,sBAAsB,EAC7B,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,uBAAuB,CAAC,CA2ClC"}
1
+ {"version":3,"file":"build-executor.d.ts","sourceRoot":"","sources":["../../../src/src/release-assets/build-executor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAkCH,MAAM,WAAW,sBAAsB;IACrC,yDAAyD;IACzD,gBAAgB,EAAE,MAAM,CAAC;IACzB,oBAAoB;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,oBAAoB;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,iCAAiC;IACjC,cAAc,EAAE,MAAM,CAAC;IACvB,yDAAyD;IACzD,iBAAiB,EAAE,MAAM,CAAC;IAC1B,oCAAoC;IACpC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;;;OAIG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,gDAAgD;IAChD,MAAM,EAAE,uBAAuB,CAAC;IAChC,sDAAsD;IAEtD,OAAO,EAAE,GAAG,CAAC;IACb;;;;OAIG;IACH,SAAS,CAAC,EAAE,qBAAqB,CAAC;CACnC;AAED,MAAM,MAAM,qBAAqB,GAAG,CAClC,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,MAAM,EAClB,UAAU,EAAE,MAAM,EAElB,OAAO,EAAE,GAAG,EACZ,OAAO,EAAE;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,OAAO,CAAC;IAAC,GAAG,EAAE,OAAO,CAAC;I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ACtC,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,OAAO,GAAG,QAAQ,CAAC;IAC1B,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAkCD,2DAA2D;AAC3D,wBAAgB,YAAY,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAM/D;AA2aD;;;GAGG;AACH,wBAAsB,oBAAoB,CACxC,KAAK,EAAE,sBAAsB,EAC7B,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,uBAAuB,CAAC,CA2ClC"}
@@ -20,6 +20,7 @@ import { createFileSystem } from "../platform/compat/fs.js";
20
20
  import { dirname, join } from "../platform/compat/path/index.js";
21
21
  import { resolveFrameworkSourcePath } from "../platform/compat/framework-source-resolver.js";
22
22
  import { transformToESM } from "../transforms/esm-transform.js";
23
+ import { parseImports, replaceSpecifiers } from "../transforms/esm/lexer.js";
23
24
  import { PLATFORM_UTILITIES } from "../html/utils.js";
24
25
  import { extractCandidatesFromFiles } from "../html/styles-builder/candidate-extractor.js";
25
26
  import { sha256HexBytes } from "./hash.js";
@@ -122,10 +123,10 @@ function resolveStaticImports(source, moduleLogicalPath, knownPaths) {
122
123
  return results;
123
124
  }
124
125
  function resolveKnownModulePath(path, knownPaths) {
125
- const normalized = path
126
+ const normalized = normalizeLogicalPath(path
126
127
  .replace(/^\/?_vf_modules\//, "")
127
128
  .replace(/^\/+/, "")
128
- .replace(/[?#].*$/, "");
129
+ .replace(/[?#].*$/, ""));
129
130
  if (normalized.startsWith("_veryfront/"))
130
131
  return null;
131
132
  if (knownPaths.has(normalized))
@@ -138,29 +139,75 @@ function resolveKnownModulePath(path, knownPaths) {
138
139
  }
139
140
  return null;
140
141
  }
141
- function collectVfModuleImports(code, knownPaths) {
142
+ function normalizeLogicalPath(path) {
143
+ const parts = [];
144
+ for (const part of path.split("/")) {
145
+ if (!part || part === ".")
146
+ continue;
147
+ if (part === "..") {
148
+ parts.pop();
149
+ continue;
150
+ }
151
+ parts.push(part);
152
+ }
153
+ return parts.join("/");
154
+ }
155
+ function normalizeProjectSpecifier(specifier, logicalPath) {
156
+ if (specifier.startsWith("http://") ||
157
+ specifier.startsWith("https://") ||
158
+ specifier.startsWith("data:") ||
159
+ specifier.startsWith("blob:") ||
160
+ specifier.startsWith("#")) {
161
+ return null;
162
+ }
163
+ if (specifier.startsWith("/_vf_modules/_veryfront/"))
164
+ return null;
165
+ if (specifier.startsWith("/_vf_modules/"))
166
+ return specifier;
167
+ if (specifier.startsWith("_veryfront/"))
168
+ return null;
169
+ if (specifier.startsWith("./") || specifier.startsWith("../")) {
170
+ const dir = logicalPath.includes("/")
171
+ ? logicalPath.slice(0, logicalPath.lastIndexOf("/"))
172
+ : ".";
173
+ return `${dir}/${specifier}`;
174
+ }
175
+ if (specifier.startsWith("/"))
176
+ return specifier;
177
+ if (BROWSER_MODULE_DIRS.some((dir) => specifier.startsWith(dir)))
178
+ return specifier;
179
+ return null;
180
+ }
181
+ function resolveProjectModuleSpecifier(specifier, logicalPath, knownPaths) {
182
+ const normalized = normalizeProjectSpecifier(specifier, logicalPath);
183
+ if (!normalized)
184
+ return null;
185
+ return resolveKnownModulePath(normalized, knownPaths);
186
+ }
187
+ async function collectProjectModuleImports(code, logicalPath, knownPaths) {
142
188
  const imports = new Map();
143
- const re = /(["'])(\/_vf_modules\/[^"']+)\1/g;
144
- let match;
145
- while ((match = re.exec(code)) !== null) {
146
- const specifier = match[2];
147
- const logicalPath = resolveKnownModulePath(specifier, knownPaths);
148
- if (logicalPath)
149
- imports.set(specifier, logicalPath);
189
+ for (const imp of await parseImports(code)) {
190
+ if (!imp.n)
191
+ continue;
192
+ const specifier = imp.n;
193
+ const importedPath = resolveProjectModuleSpecifier(specifier, logicalPath, knownPaths);
194
+ if (importedPath)
195
+ imports.set(specifier, importedPath);
150
196
  }
151
197
  return imports;
152
198
  }
153
- function rewriteVfModuleImports(code, moduleAssets, knownPaths, dependencyUrls) {
154
- return code.replace(/(["'])(\/_vf_modules\/[^"']+)\1/g, (full, quote, specifier) => {
155
- const dependencyUrl = dependencyUrls.get(specifier.replace(/[?#].*$/, ""));
156
- if (dependencyUrl)
157
- return `${quote}${dependencyUrl}${quote}`;
158
- const logicalPath = resolveKnownModulePath(specifier, knownPaths);
159
- const asset = logicalPath ? moduleAssets.get(logicalPath) : undefined;
160
- if (!asset)
161
- return full;
162
- return `${quote}${releaseAssetUrl(asset.contentHash, "js")}${quote}`;
163
- });
199
+ async function rewriteProjectModuleImports(code, logicalPath, moduleAssets, knownPaths, dependencyUrls) {
200
+ function rewriteSpecifier(specifier) {
201
+ if (specifier.startsWith("/_vf_modules/")) {
202
+ const dependencyUrl = dependencyUrls.get(specifier.replace(/[?#].*$/, ""));
203
+ if (dependencyUrl)
204
+ return dependencyUrl;
205
+ }
206
+ const importedPath = resolveProjectModuleSpecifier(specifier, logicalPath, knownPaths);
207
+ const asset = importedPath ? moduleAssets.get(importedPath) : undefined;
208
+ return asset ? releaseAssetUrl(asset.contentHash, "js") : null;
209
+ }
210
+ return await replaceSpecifiers(code, (specifier) => rewriteSpecifier(specifier));
164
211
  }
165
212
  function buildDependencyUrlMap(_dependencies) {
166
213
  // Framework barrels can contain their own relative import closure. Keep those
@@ -171,7 +218,7 @@ function buildDependencyUrlMap(_dependencies) {
171
218
  async function finalizeProjectModules(transformedModules, knownPaths, dependencyUrls, uploadQueue, pendingBytes, gaps) {
172
219
  const finalized = new Map();
173
220
  const unresolvedCycles = new Set();
174
- const cyclicModules = collectCyclicProjectModules(transformedModules, knownPaths, gaps);
221
+ const cyclicModules = await collectCyclicProjectModules(transformedModules, knownPaths, gaps);
175
222
  const skippedModules = new Set(cyclicModules);
176
223
  async function finalize(logicalPath, stack) {
177
224
  const existing = finalized.get(logicalPath);
@@ -192,11 +239,11 @@ async function finalizeProjectModules(transformedModules, knownPaths, dependency
192
239
  if (!transformed)
193
240
  return null;
194
241
  const nextStack = [...stack, logicalPath];
195
- const imports = collectVfModuleImports(transformed.code, knownPaths);
242
+ const imports = await collectProjectModuleImports(transformed.code, logicalPath, knownPaths);
196
243
  for (const importedPath of imports.values()) {
197
244
  await finalize(importedPath, nextStack);
198
245
  }
199
- const rewritten = rewriteVfModuleImports(transformed.code, finalized, knownPaths, dependencyUrls);
246
+ const rewritten = await rewriteProjectModuleImports(transformed.code, logicalPath, finalized, knownPaths, dependencyUrls);
200
247
  const entry = await addPreparedJavaScriptAsset(logicalPath, rewritten, uploadQueue, pendingBytes);
201
248
  if (!entry)
202
249
  return null;
@@ -216,13 +263,13 @@ async function finalizeProjectModules(transformedModules, knownPaths, dependency
216
263
  }
217
264
  return { modules: Object.fromEntries(finalized), skippedModules };
218
265
  }
219
- function collectCyclicProjectModules(transformedModules, knownPaths, gaps) {
266
+ async function collectCyclicProjectModules(transformedModules, knownPaths, gaps) {
220
267
  const cyclic = new Set();
221
268
  const visiting = new Set();
222
269
  const visited = new Set();
223
270
  const stack = [];
224
271
  const recordedCycles = new Set();
225
- function visit(logicalPath) {
272
+ async function visit(logicalPath) {
226
273
  if (visited.has(logicalPath))
227
274
  return;
228
275
  if (visiting.has(logicalPath)) {
@@ -244,17 +291,17 @@ function collectCyclicProjectModules(transformedModules, knownPaths, gaps) {
244
291
  return;
245
292
  visiting.add(logicalPath);
246
293
  stack.push(logicalPath);
247
- const imports = collectVfModuleImports(transformed.code, knownPaths);
294
+ const imports = await collectProjectModuleImports(transformed.code, logicalPath, knownPaths);
248
295
  for (const importedPath of imports.values()) {
249
296
  if (transformedModules.has(importedPath))
250
- visit(importedPath);
297
+ await visit(importedPath);
251
298
  }
252
299
  stack.pop();
253
300
  visiting.delete(logicalPath);
254
301
  visited.add(logicalPath);
255
302
  }
256
303
  for (const logicalPath of transformedModules.keys())
257
- visit(logicalPath);
304
+ await visit(logicalPath);
258
305
  return cyclic;
259
306
  }
260
307
  async function addPreparedJavaScriptAsset(logicalPath, code, uploadQueue, pendingBytes) {
@@ -1,3 +1,3 @@
1
1
  /** Shared version value. */
2
- export declare const VERSION = "0.1.784";
2
+ export declare const VERSION = "0.1.785";
3
3
  //# sourceMappingURL=version-constant.d.ts.map
@@ -1,4 +1,4 @@
1
1
  // Keep in sync with deno.json version.
2
2
  // scripts/release.ts updates this constant during releases.
3
3
  /** Shared version value. */
4
- export const VERSION = "0.1.784";
4
+ export const VERSION = "0.1.785";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "veryfront",
3
- "version": "0.1.784",
3
+ "version": "0.1.785",
4
4
  "description": "The simplest way to build AI-powered apps",
5
5
  "keywords": [
6
6
  "react",