@marko/translator-default 6.0.8 → 6.0.9

Sign up to get free protection for your applications and to get access to all the features.
@@ -8,7 +8,6 @@ var parseExport = _interopRequireWildcard(require("./parse-export"));
8
8
  var parseImport = _interopRequireWildcard(require("./parse-import"));
9
9
  var parseModuleCode = _interopRequireWildcard(require("./parse-module-code"));
10
10
  var parseStatic = _interopRequireWildcard(require("./parse-static"));
11
- var parseStyle = _interopRequireWildcard(require("./parse-style"));
12
11
  var transformStyle = _interopRequireWildcard(require("./transform-style"));
13
12
  var translateAwait = _interopRequireWildcard(require("./translate-await"));
14
13
  var translateBody = _interopRequireWildcard(require("./translate-body"));
@@ -88,7 +87,6 @@ var translateWhile = _interopRequireWildcard(require("./translate-while"));funct
88
87
 
89
88
  },
90
89
  "<style>": {
91
- "node-factory": parseStyle,
92
90
  transformer: transformStyle,
93
91
  "parse-options": {
94
92
  rawOpenTag: true
@@ -1,4 +1,5 @@
1
- "use strict";var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");exports.__esModule = true;exports.default = _default;var _path = _interopRequireDefault(require("path"));
1
+ "use strict";var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");exports.__esModule = true;exports.default = _default;var _babelUtils = require("@marko/babel-utils");
2
+ var _path = _interopRequireDefault(require("path"));
2
3
 
3
4
  var _getComponentFiles = _interopRequireDefault(require("../../util/get-component-files"));
4
5
 
@@ -42,14 +43,21 @@ function _default(tag) {
42
43
  const codeEndOffset = rawValue.lastIndexOf("}");
43
44
  const code = rawValue.slice(codeSartOffset, codeEndOffset);
44
45
  const base = _path.default.basename(hub.file.opts.filename);
45
- const start = node.extra && node.extra.nameStart;
46
+ const start = (0, _babelUtils.getStart)(hub.file, node.name);
47
+ let startPos = undefined;
48
+ let endPos = undefined;
49
+
50
+ if (start !== null) {
51
+ startPos = start + codeSartOffset;
52
+ endPos = start + codeEndOffset;
53
+ }
46
54
 
47
55
  deps.push({
48
56
  type: type.slice(1),
49
57
  code,
50
58
  style: true,
51
- startPos: start + codeSartOffset,
52
- endPos: start + codeEndOffset,
59
+ startPos,
60
+ endPos,
53
61
  path: `./${base}`,
54
62
  virtualPath: `./${base + type}`
55
63
  });
@@ -178,7 +178,7 @@ function addBrowserImports(seenImports, body, file, entryFile) {
178
178
  let map;
179
179
 
180
180
  if (sourceMaps && dep.startPos !== undefined) {
181
- s = s || new _magicString.default(file.code, { source: filename });
181
+ s = s || new _magicString.default(file.code, { filename });
182
182
  map = s.snip(dep.startPos, dep.endPos).generateMap({
183
183
  source: filename,
184
184
  includeContent: true
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@marko/translator-default",
3
- "version": "6.0.8",
3
+ "version": "6.0.9",
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.25.0",
32
- "@marko/babel-utils": "^6.5.3",
32
+ "@marko/babel-utils": "^6.5.4",
33
33
  "magic-string": "^0.30.11",
34
34
  "self-closing-tags": "^1.0.1"
35
35
  },
36
36
  "devDependencies": {
37
- "@marko/compiler": "^5.37.6",
38
- "marko": "^5.35.10"
37
+ "@marko/compiler": "^5.37.7",
38
+ "marko": "^5.35.11"
39
39
  },
40
40
  "peerDependencies": {
41
41
  "@marko/compiler": "^5.16.1",
@@ -1,6 +0,0 @@
1
- "use strict";exports.__esModule = true;exports.default = _default;function _default(path) {
2
- // Tracks parser positions for use in the translator.
3
- const { node } = path;
4
- const extra = node.extra = node.extra || {};
5
- extra.nameStart = node.name.start;
6
- }