metro-source-map 0.66.0 → 0.68.0

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.
Files changed (37) hide show
  1. package/package.json +5 -5
  2. package/src/B64Builder.js +1 -1
  3. package/src/B64Builder.js.flow +1 -1
  4. package/src/BundleBuilder.js +7 -7
  5. package/src/BundleBuilder.js.flow +5 -4
  6. package/src/Consumer/AbstractConsumer.js +3 -4
  7. package/src/Consumer/AbstractConsumer.js.flow +6 -7
  8. package/src/Consumer/DelegatingConsumer.js +5 -5
  9. package/src/Consumer/DelegatingConsumer.js.flow +11 -12
  10. package/src/Consumer/MappingsConsumer.js +14 -14
  11. package/src/Consumer/MappingsConsumer.js.flow +14 -16
  12. package/src/Consumer/SectionsConsumer.js +11 -8
  13. package/src/Consumer/SectionsConsumer.js.flow +10 -12
  14. package/src/Consumer/constants.js +3 -3
  15. package/src/Consumer/constants.js.flow +3 -3
  16. package/src/Consumer/createConsumer.js +1 -1
  17. package/src/Consumer/createConsumer.js.flow +3 -3
  18. package/src/Consumer/index.js +1 -1
  19. package/src/Consumer/index.js.flow +1 -1
  20. package/src/Consumer/normalizeSourcePath.js +1 -1
  21. package/src/Consumer/normalizeSourcePath.js.flow +1 -1
  22. package/src/Consumer/positionMath.js +6 -6
  23. package/src/Consumer/positionMath.js.flow +3 -3
  24. package/src/Consumer/search.js +2 -2
  25. package/src/Consumer/search.js.flow +1 -1
  26. package/src/Consumer/types.flow.js +1 -1
  27. package/src/Consumer/types.flow.js.flow +1 -1
  28. package/src/Generator.js +7 -7
  29. package/src/Generator.js.flow +4 -4
  30. package/src/composeSourceMaps.js +16 -17
  31. package/src/composeSourceMaps.js.flow +6 -7
  32. package/src/encode.js +6 -65
  33. package/src/encode.js.flow +6 -65
  34. package/src/generateFunctionMap.js +35 -23
  35. package/src/generateFunctionMap.js.flow +64 -36
  36. package/src/source-map.js +17 -18
  37. package/src/source-map.js.flow +30 -15
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "metro-source-map",
3
- "version": "0.66.0",
3
+ "version": "0.68.0",
4
4
  "description": "🚇 Source map generator for Metro.",
5
5
  "main": "src/source-map.js",
6
6
  "repository": {
@@ -12,18 +12,18 @@
12
12
  "cleanup-release": "test ! -e build && mv src build && mv src.real src"
13
13
  },
14
14
  "dependencies": {
15
- "@babel/traverse": "^7.0.0",
15
+ "@babel/traverse": "^7.14.0",
16
16
  "@babel/types": "^7.0.0",
17
17
  "invariant": "^2.2.4",
18
- "metro-symbolicate": "0.66.0",
18
+ "metro-symbolicate": "0.68.0",
19
19
  "nullthrows": "^1.1.1",
20
- "ob1": "0.66.0",
20
+ "ob1": "0.68.0",
21
21
  "source-map": "^0.5.6",
22
22
  "vlq": "^1.0.0"
23
23
  },
24
24
  "license": "MIT",
25
25
  "devDependencies": {
26
- "@babel/parser": "^7.0.0",
26
+ "@babel/parser": "^7.14.0",
27
27
  "uglify-es": "^3.1.9"
28
28
  }
29
29
  }
package/src/B64Builder.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright (c) Facebook, Inc. and its affiliates.
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
3
  *
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright (c) Facebook, Inc. and its affiliates.
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
3
  *
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright (c) Facebook, Inc. and its affiliates.
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
3
  *
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
@@ -13,7 +13,7 @@ const EMPTY_MAP = {
13
13
  version: 3,
14
14
  sources: [],
15
15
  names: [],
16
- mappings: "A"
16
+ mappings: "A",
17
17
  };
18
18
  /**
19
19
  * Builds a source-mapped bundle by concatenating strings and their
@@ -45,8 +45,8 @@ class BundleBuilder {
45
45
  map,
46
46
  offset: {
47
47
  column: this._column,
48
- line: this._line
49
- }
48
+ line: this._line,
49
+ },
50
50
  });
51
51
  }
52
52
 
@@ -112,7 +112,7 @@ function measureString(str) {
112
112
  const lastLineColumns = str.length - lastLineStart;
113
113
  return {
114
114
  lineBreaks,
115
- lastLineColumns
115
+ lastLineColumns,
116
116
  };
117
117
  }
118
118
 
@@ -120,11 +120,11 @@ function createIndexMap(file, sections) {
120
120
  return {
121
121
  version: 3,
122
122
  file,
123
- sections
123
+ sections,
124
124
  };
125
125
  }
126
126
 
127
127
  module.exports = {
128
128
  BundleBuilder,
129
- createIndexMap
129
+ createIndexMap,
130
130
  };
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright (c) Facebook, Inc. and its affiliates.
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
3
  *
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
@@ -98,9 +98,10 @@ class BundleBuilder {
98
98
 
99
99
  const reLineBreak = /\r\n|\r|\n/g;
100
100
 
101
- function measureString(
102
- str: string,
103
- ): {|lineBreaks: number, lastLineColumns: number|} {
101
+ function measureString(str: string): {|
102
+ lineBreaks: number,
103
+ lastLineColumns: number,
104
+ |} {
104
105
  let lineBreaks = 0;
105
106
  let match;
106
107
  let lastLineStart = 0;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright (c) Facebook, Inc. and its affiliates.
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
3
  *
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
@@ -9,11 +9,10 @@
9
9
  */
10
10
  "use strict";
11
11
 
12
- const invariant = require("invariant");
13
-
14
12
  const { GENERATED_ORDER, iterationOrderToString } = require("./constants");
15
13
 
16
- // Implementation details shared between MappingsConsumer and SectionsConsumer
14
+ const invariant = require("invariant"); // Implementation details shared between MappingsConsumer and SectionsConsumer
15
+
17
16
  class AbstractConsumer {
18
17
  constructor(sourceMap) {
19
18
  this._sourceMap = sourceMap;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright (c) Facebook, Inc. and its affiliates.
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
3
  *
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
@@ -10,18 +10,17 @@
10
10
 
11
11
  'use strict';
12
12
 
13
- const invariant = require('invariant');
14
-
15
- const {GENERATED_ORDER, iterationOrderToString} = require('./constants');
16
-
17
13
  import type {
18
- SourcePosition,
19
14
  GeneratedPositionLookup,
20
- Mapping,
21
15
  IConsumer,
22
16
  IterationOrder,
17
+ Mapping,
18
+ SourcePosition,
23
19
  } from './types.flow';
24
20
 
21
+ const {GENERATED_ORDER, iterationOrderToString} = require('./constants');
22
+ const invariant = require('invariant');
23
+
25
24
  // Implementation details shared between MappingsConsumer and SectionsConsumer
26
25
  class AbstractConsumer implements IConsumer {
27
26
  _sourceMap: {+file?: string, ...};
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright (c) Facebook, Inc. and its affiliates.
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
3
  *
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
@@ -9,20 +9,20 @@
9
9
  */
10
10
  "use strict";
11
11
 
12
- const createConsumer = require("./createConsumer");
13
-
14
12
  const {
15
13
  GENERATED_ORDER,
16
- ORIGINAL_ORDER,
17
14
  GREATEST_LOWER_BOUND,
18
- LEAST_UPPER_BOUND
15
+ LEAST_UPPER_BOUND,
16
+ ORIGINAL_ORDER,
19
17
  } = require("./constants");
20
18
 
19
+ const createConsumer = require("./createConsumer");
21
20
  /**
22
21
  * A source map consumer that supports both "basic" and "indexed" source maps.
23
22
  * Uses `MappingsConsumer` and `SectionsConsumer` under the hood (via
24
23
  * `createConsumer`).
25
24
  */
25
+
26
26
  class DelegatingConsumer {
27
27
  static GENERATED_ORDER = GENERATED_ORDER;
28
28
  static ORIGINAL_ORDER = ORIGINAL_ORDER;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright (c) Facebook, Inc. and its affiliates.
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
3
  *
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
@@ -9,25 +9,24 @@
9
9
  */
10
10
 
11
11
  'use strict';
12
- const createConsumer = require('./createConsumer');
13
-
14
- const {
15
- GENERATED_ORDER,
16
- ORIGINAL_ORDER,
17
- GREATEST_LOWER_BOUND,
18
- LEAST_UPPER_BOUND,
19
- } = require('./constants');
20
-
21
12
  import type {MixedSourceMap} from '../source-map';
22
13
  import type {LookupBias} from './constants.js';
23
14
  import type {
24
- SourcePosition,
25
15
  GeneratedPositionLookup,
26
- Mapping,
27
16
  IConsumer,
28
17
  IterationOrder,
18
+ Mapping,
19
+ SourcePosition,
29
20
  } from './types.flow';
30
21
 
22
+ const {
23
+ GENERATED_ORDER,
24
+ GREATEST_LOWER_BOUND,
25
+ LEAST_UPPER_BOUND,
26
+ ORIGINAL_ORDER,
27
+ } = require('./constants');
28
+ const createConsumer = require('./createConsumer');
29
+
31
30
  /**
32
31
  * A source map consumer that supports both "basic" and "indexed" source maps.
33
32
  * Uses `MappingsConsumer` and `SectionsConsumer` under the hood (via
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright (c) Facebook, Inc. and its affiliates.
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
3
  *
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
@@ -11,28 +11,28 @@
11
11
 
12
12
  const AbstractConsumer = require("./AbstractConsumer");
13
13
 
14
- const invariant = require("invariant");
15
-
16
- const normalizeSourcePath = require("./normalizeSourcePath");
17
-
18
14
  const {
15
+ EMPTY_POSITION,
19
16
  FIRST_COLUMN,
20
17
  FIRST_LINE,
21
18
  GREATEST_LOWER_BOUND,
22
- EMPTY_POSITION,
23
- lookupBiasToString
19
+ lookupBiasToString,
24
20
  } = require("./constants");
25
21
 
22
+ const normalizeSourcePath = require("./normalizeSourcePath");
23
+
26
24
  const { greatestLowerBound } = require("./search");
27
25
 
28
- const { add, get0, add0, sub, inc } = require("ob1");
26
+ const invariant = require("invariant");
27
+
28
+ const { add, add0, get0, inc, sub } = require("ob1");
29
29
 
30
30
  const { decode: decodeVlq } = require("vlq");
31
-
32
31
  /**
33
32
  * A source map consumer that supports "basic" source maps (that have a
34
33
  * `mappings` field and no sections).
35
34
  */
35
+
36
36
  class MappingsConsumer extends AbstractConsumer {
37
37
  constructor(sourceMap) {
38
38
  super(sourceMap);
@@ -63,7 +63,7 @@ class MappingsConsumer extends AbstractConsumer {
63
63
  mappings,
64
64
  {
65
65
  line,
66
- column
66
+ column,
67
67
  },
68
68
  (position, mapping) => {
69
69
  if (position.line === mapping.generatedLine) {
@@ -83,7 +83,7 @@ class MappingsConsumer extends AbstractConsumer {
83
83
  source: mapping.source,
84
84
  name: mapping.name,
85
85
  line: mapping.originalLine,
86
- column: mapping.originalColumn
86
+ column: mapping.originalColumn,
87
87
  };
88
88
  }
89
89
 
@@ -143,7 +143,7 @@ class MappingsConsumer extends AbstractConsumer {
143
143
  sourceIndexDelta,
144
144
  originalLineDelta,
145
145
  originalColumnDelta,
146
- nameIndexDelta
146
+ nameIndexDelta,
147
147
  ] = decodedVlqValues;
148
148
  decodeVlq(mappingRaw);
149
149
  invariant(generatedColumnDelta != null, "Invalid generated column delta");
@@ -154,7 +154,7 @@ class MappingsConsumer extends AbstractConsumer {
154
154
  source: null,
155
155
  name: null,
156
156
  originalLine: null,
157
- originalColumn: null
157
+ originalColumn: null,
158
158
  };
159
159
 
160
160
  if (sourceIndexDelta != null) {
@@ -179,7 +179,7 @@ class MappingsConsumer extends AbstractConsumer {
179
179
 
180
180
  _normalizeAndCacheSources() {
181
181
  if (!this._normalizedSources) {
182
- this._normalizedSources = this._sourceMap.sources.map(source =>
182
+ this._normalizedSources = this._sourceMap.sources.map((source) =>
183
183
  normalizeSourcePath(source, this._sourceMap)
184
184
  );
185
185
  }
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright (c) Facebook, Inc. and its affiliates.
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
3
  *
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
@@ -10,31 +10,29 @@
10
10
 
11
11
  'use strict';
12
12
 
13
- const AbstractConsumer = require('./AbstractConsumer');
14
-
15
- const invariant = require('invariant');
16
- const normalizeSourcePath = require('./normalizeSourcePath');
13
+ import type {BasicSourceMap} from '../source-map';
14
+ import type {
15
+ GeneratedPositionLookup,
16
+ IConsumer,
17
+ Mapping,
18
+ SourcePosition,
19
+ } from './types.flow';
20
+ import type {Number0} from 'ob1';
17
21
 
22
+ const AbstractConsumer = require('./AbstractConsumer');
18
23
  const {
24
+ EMPTY_POSITION,
19
25
  FIRST_COLUMN,
20
26
  FIRST_LINE,
21
27
  GREATEST_LOWER_BOUND,
22
- EMPTY_POSITION,
23
28
  lookupBiasToString,
24
29
  } = require('./constants');
30
+ const normalizeSourcePath = require('./normalizeSourcePath');
25
31
  const {greatestLowerBound} = require('./search');
26
- const {add, get0, add0, sub, inc} = require('ob1');
32
+ const invariant = require('invariant');
33
+ const {add, add0, get0, inc, sub} = require('ob1');
27
34
  const {decode: decodeVlq} = require('vlq');
28
35
 
29
- import type {BasicSourceMap} from '../source-map';
30
- import type {
31
- SourcePosition,
32
- GeneratedPositionLookup,
33
- Mapping,
34
- IConsumer,
35
- } from './types.flow';
36
- import type {Number0} from 'ob1';
37
-
38
36
  /**
39
37
  * A source map consumer that supports "basic" source maps (that have a
40
38
  * `mappings` field and no sections).
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright (c) Facebook, Inc. and its affiliates.
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
3
  *
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
@@ -11,27 +11,27 @@
11
11
 
12
12
  const AbstractConsumer = require("./AbstractConsumer");
13
13
 
14
- const createConsumer = require("./createConsumer");
14
+ const { EMPTY_POSITION, FIRST_COLUMN, FIRST_LINE } = require("./constants");
15
15
 
16
- const { FIRST_COLUMN, FIRST_LINE, EMPTY_POSITION } = require("./constants");
16
+ const createConsumer = require("./createConsumer");
17
17
 
18
18
  const { subtractOffsetFromPosition } = require("./positionMath");
19
19
 
20
20
  const { greatestLowerBound } = require("./search");
21
21
 
22
- const { add, get0, get1, add0, sub1, sub } = require("ob1");
23
-
22
+ const { add, add0, get0, get1, sub, sub1 } = require("ob1");
24
23
  /**
25
24
  * A source map consumer that supports "indexed" source maps (that have a
26
25
  * `sections` field and no top-level mappings).
27
26
  */
27
+
28
28
  class SectionsConsumer extends AbstractConsumer {
29
29
  constructor(sourceMap) {
30
30
  super(sourceMap);
31
31
  this._consumers = sourceMap.sections.map((section, index) => {
32
32
  const generatedOffset = {
33
33
  lines: add0(section.offset.line),
34
- columns: add0(section.offset.column)
34
+ columns: add0(section.offset.column),
35
35
  };
36
36
  const consumer = createConsumer(section.map);
37
37
  return [generatedOffset, consumer];
@@ -66,7 +66,7 @@ class SectionsConsumer extends AbstractConsumer {
66
66
  source: null,
67
67
  name: null,
68
68
  originalLine: null,
69
- originalColumn: null
69
+ originalColumn: null,
70
70
  };
71
71
  }
72
72
 
@@ -74,7 +74,10 @@ class SectionsConsumer extends AbstractConsumer {
74
74
  yield {
75
75
  ...mapping,
76
76
  generatedLine: add(mapping.generatedLine, generatedOffset.lines),
77
- generatedColumn: add(mapping.generatedColumn, generatedOffset.columns)
77
+ generatedColumn: add(
78
+ mapping.generatedColumn,
79
+ generatedOffset.columns
80
+ ),
78
81
  };
79
82
  }
80
83
  }
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright (c) Facebook, Inc. and its affiliates.
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
3
  *
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
@@ -10,24 +10,22 @@
10
10
 
11
11
  'use strict';
12
12
 
13
- const AbstractConsumer = require('./AbstractConsumer');
14
-
15
- const createConsumer = require('./createConsumer');
16
-
17
- const {FIRST_COLUMN, FIRST_LINE, EMPTY_POSITION} = require('./constants');
18
- const {subtractOffsetFromPosition} = require('./positionMath');
19
- const {greatestLowerBound} = require('./search');
20
- const {add, get0, get1, add0, sub1, sub} = require('ob1');
21
-
22
13
  import type {IndexMap} from '../source-map';
23
14
  import type {
24
15
  GeneratedOffset,
25
- SourcePosition,
26
16
  GeneratedPositionLookup,
27
- Mapping,
28
17
  IConsumer,
18
+ Mapping,
19
+ SourcePosition,
29
20
  } from './types.flow';
30
21
 
22
+ const AbstractConsumer = require('./AbstractConsumer');
23
+ const {EMPTY_POSITION, FIRST_COLUMN, FIRST_LINE} = require('./constants');
24
+ const createConsumer = require('./createConsumer');
25
+ const {subtractOffsetFromPosition} = require('./positionMath');
26
+ const {greatestLowerBound} = require('./search');
27
+ const {add, add0, get0, get1, sub, sub1} = require('ob1');
28
+
31
29
  /**
32
30
  * A source map consumer that supports "indexed" source maps (that have a
33
31
  * `sections` field and no top-level mappings).
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright (c) Facebook, Inc. and its affiliates.
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
3
  *
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
@@ -21,7 +21,7 @@ const EMPTY_POSITION = Object.freeze({
21
21
  source: null,
22
22
  name: null,
23
23
  line: null,
24
- column: null
24
+ column: null,
25
25
  });
26
26
 
27
27
  function iterationOrderToString(x) {
@@ -41,5 +41,5 @@ module.exports = {
41
41
  LEAST_UPPER_BOUND,
42
42
  EMPTY_POSITION,
43
43
  iterationOrderToString,
44
- lookupBiasToString
44
+ lookupBiasToString,
45
45
  };
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright (c) Facebook, Inc. and its affiliates.
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
3
  *
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
@@ -10,9 +10,9 @@
10
10
 
11
11
  'use strict';
12
12
 
13
- const {add0, add1} = require('ob1');
14
-
15
13
  import type {Number0, Number1} from 'ob1';
14
+
15
+ const {add0, add1} = require('ob1');
16
16
  const FIRST_COLUMN: Number0 = add0(0);
17
17
  const FIRST_LINE: Number1 = add1(0);
18
18
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright (c) Facebook, Inc. and its affiliates.
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
3
  *
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright (c) Facebook, Inc. and its affiliates.
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
3
  *
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
@@ -10,11 +10,11 @@
10
10
 
11
11
  'use strict';
12
12
 
13
- const invariant = require('invariant');
14
-
15
13
  import type {MixedSourceMap} from '../source-map';
16
14
  import type {IConsumer} from './types.flow';
17
15
 
16
+ const invariant = require('invariant');
17
+
18
18
  function createConsumer(sourceMap: MixedSourceMap): IConsumer {
19
19
  invariant(
20
20
  (sourceMap.version: mixed) === '3' || sourceMap.version === 3,
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright (c) Facebook, Inc. and its affiliates.
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
3
  *
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright (c) Facebook, Inc. and its affiliates.
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
3
  *
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright (c) Facebook, Inc. and its affiliates.
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
3
  *
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright (c) Facebook, Inc. and its affiliates.
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
3
  *
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright (c) Facebook, Inc. and its affiliates.
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
3
  *
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
@@ -9,13 +9,13 @@
9
9
  */
10
10
  "use strict";
11
11
 
12
- const { add, neg, add0, add1 } = require("ob1");
12
+ const { add, add0, add1, neg } = require("ob1");
13
13
 
14
14
  function shiftPositionByOffset(pos, offset) {
15
15
  return {
16
16
  ...pos,
17
17
  line: pos.line != null ? add(pos.line, offset.lines) : null,
18
- column: pos.column != null ? add(pos.column, offset.columns) : null
18
+ column: pos.column != null ? add(pos.column, offset.columns) : null,
19
19
  };
20
20
  }
21
21
 
@@ -23,17 +23,17 @@ function subtractOffsetFromPosition(pos, offset) {
23
23
  if (pos.line === add1(offset.lines)) {
24
24
  return shiftPositionByOffset(pos, {
25
25
  lines: neg(offset.lines),
26
- columns: neg(offset.columns)
26
+ columns: neg(offset.columns),
27
27
  });
28
28
  }
29
29
 
30
30
  return shiftPositionByOffset(pos, {
31
31
  lines: neg(offset.lines),
32
- columns: add0(0)
32
+ columns: add0(0),
33
33
  });
34
34
  }
35
35
 
36
36
  module.exports = {
37
37
  shiftPositionByOffset,
38
- subtractOffsetFromPosition
38
+ subtractOffsetFromPosition,
39
39
  };
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright (c) Facebook, Inc. and its affiliates.
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
3
  *
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
@@ -10,11 +10,11 @@
10
10
 
11
11
  'use strict';
12
12
 
13
- const {add, neg, add0, add1} = require('ob1');
14
-
15
13
  import type {GeneratedOffset} from './types.flow';
16
14
  import type {Number0, Number1} from 'ob1';
17
15
 
16
+ const {add, add0, add1, neg} = require('ob1');
17
+
18
18
  function shiftPositionByOffset<
19
19
  T: {
20
20
  +line: ?Number1,
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright (c) Facebook, Inc. and its affiliates.
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
3
  *
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
@@ -32,5 +32,5 @@ function greatestLowerBound(elements, target, comparator) {
32
32
  }
33
33
 
34
34
  module.exports = {
35
- greatestLowerBound
35
+ greatestLowerBound,
36
36
  };