@marko/translator-default 6.0.24 → 6.0.26

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.
@@ -14,9 +14,8 @@ const kEntryState = Symbol();var _default =
14
14
  const programNode = program.node;
15
15
 
16
16
  if (!isHydrate) {
17
- const imports = new Set();
18
17
  const body = [];
19
- addBrowserImports(imports, body, entryFile, entryFile);
18
+ addBrowserImports(new Set(), undefined, body, entryFile, entryFile);
20
19
  if (body.length) {
21
20
  programNode.body = body.concat(programNode.body);
22
21
  }
@@ -54,6 +53,10 @@ const entryBuilder = exports.entryBuilder = {
54
53
  const entryMarkoMeta = entryFile.metadata.marko;
55
54
  const { body } = state;
56
55
  entryMarkoMeta.watchFiles = Array.from(state.watchFiles);
56
+ entryMarkoMeta.deps = Array.from(
57
+ state.lassoDeps,
58
+ (dep) => `package: ${dep}`
59
+ );
57
60
 
58
61
  if (state.hasComponents) {
59
62
  const initId = _compiler.types.identifier("init");
@@ -92,12 +95,13 @@ const entryBuilder = exports.entryBuilder = {
92
95
  shouldIncludeImport: toTestFn(file.markoOpts.hydrateIncludeImports),
93
96
  watchFiles: new Set(),
94
97
  imports: new Set(),
98
+ lassoDeps: new Set(),
95
99
  hasComponents: false,
96
100
  splitComponentIndex: 0,
97
101
  body: []
98
102
  };
99
103
 
100
- const { watchFiles, imports, body } = state;
104
+ const { watchFiles, imports, lassoDeps, body } = state;
101
105
 
102
106
  if (fileMeta.component) {
103
107
  state.hasComponents = true;
@@ -115,7 +119,7 @@ const entryBuilder = exports.entryBuilder = {
115
119
  watchFiles.add(watchFile);
116
120
  }
117
121
 
118
- addBrowserImports(imports, body, file, entryFile);
122
+ addBrowserImports(imports, lassoDeps, body, file, entryFile);
119
123
 
120
124
  for (const child of file.path.node.body) {
121
125
  if (_compiler.types.isImportDeclaration(child)) {
@@ -167,7 +171,7 @@ const entryBuilder = exports.entryBuilder = {
167
171
  }
168
172
  };
169
173
 
170
- function addBrowserImports(seenImports, body, file, entryFile) {
174
+ function addBrowserImports(seenImports, lassoDeps, body, file, entryFile) {
171
175
  const { filename, sourceMaps } = file.opts;
172
176
  let s;
173
177
 
@@ -204,7 +208,12 @@ function addBrowserImports(seenImports, body, file, entryFile) {
204
208
  if (!dep) {
205
209
  continue;
206
210
  }
207
- } else if (dep.startsWith("package:")) {
211
+ } else if (isLassoDep(dep)) {
212
+ if (lassoDeps) {
213
+ lassoDeps.add(
214
+ resolveRelativeToEntry(entryFile, file, lassoManifestDepToPath(dep))
215
+ );
216
+ }
208
217
  continue;
209
218
  }
210
219
 
@@ -293,4 +302,12 @@ function toTestFn(val) {
293
302
  }
294
303
 
295
304
  return val.test.bind(val);
305
+ }
306
+
307
+ function isLassoDep(dep) {
308
+ return dep.startsWith("package: ");
309
+ }
310
+
311
+ function lassoManifestDepToPath(dep) {
312
+ return dep.slice(9);
296
313
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@marko/translator-default",
3
- "version": "6.0.24",
3
+ "version": "6.0.26",
4
4
  "description": "Translates Marko templates to the default Marko runtime.",
5
5
  "keywords": [
6
6
  "babel",
@@ -29,13 +29,13 @@
29
29
  },
30
30
  "dependencies": {
31
31
  "@babel/runtime": "^7.26.0",
32
- "@marko/babel-utils": "^6.5.12",
32
+ "@marko/babel-utils": "^6.5.13",
33
33
  "magic-string": "^0.30.12",
34
34
  "self-closing-tags": "^1.0.1"
35
35
  },
36
36
  "devDependencies": {
37
- "@marko/compiler": "^5.37.24",
38
- "marko": "^5.35.33"
37
+ "@marko/compiler": "^5.37.26",
38
+ "marko": "^5.35.35"
39
39
  },
40
40
  "peerDependencies": {
41
41
  "@marko/compiler": "^5.16.1",