summaryrefslogtreecommitdiff
path: root/node_modules/source-map/lib/wasm.js
diff options
context:
space:
mode:
authorlittleblack111 <littleblack11111@gmail.com>2024-10-13 10:37:19 +0800
committerlittleblack111 <littleblack11111@gmail.com>2024-10-13 10:37:19 +0800
commite29b244aeab08ea36fb385c7beb2ad0560217039 (patch)
treec66b744dc29573f1acc871862937a23f1b80e6bf /node_modules/source-map/lib/wasm.js
parent62c2881629e6413a8fec6d3dd092e4568e2a81dc (diff)
bump: @babel/cli 7.25.6 → 7.25.7, @babel/core 7.25.2 → 7.25.8, @babel/preset-env 7.25.4 → 7.25.8, postcss 8.4.41 → 8.4.47, swup 4.7.0 → 4.8.1
Diffstat (limited to 'node_modules/source-map/lib/wasm.js')
-rw-r--r--node_modules/source-map/lib/wasm.js107
1 files changed, 0 insertions, 107 deletions
diff --git a/node_modules/source-map/lib/wasm.js b/node_modules/source-map/lib/wasm.js
deleted file mode 100644
index 88b18bea..00000000
--- a/node_modules/source-map/lib/wasm.js
+++ /dev/null
@@ -1,107 +0,0 @@
-const readWasm = require("../lib/read-wasm");
-
-/**
- * Provide the JIT with a nice shape / hidden class.
- */
-function Mapping() {
- this.generatedLine = 0;
- this.generatedColumn = 0;
- this.lastGeneratedColumn = null;
- this.source = null;
- this.originalLine = null;
- this.originalColumn = null;
- this.name = null;
-}
-
-let cachedWasm = null;
-
-module.exports = function wasm() {
- if (cachedWasm) {
- return cachedWasm;
- }
-
- const callbackStack = [];
-
- cachedWasm = readWasm().then(buffer => {
- return WebAssembly.instantiate(buffer, {
- env: {
- mapping_callback(
- generatedLine,
- generatedColumn,
-
- hasLastGeneratedColumn,
- lastGeneratedColumn,
-
- hasOriginal,
- source,
- originalLine,
- originalColumn,
-
- hasName,
- name
- ) {
- const mapping = new Mapping();
- // JS uses 1-based line numbers, wasm uses 0-based.
- mapping.generatedLine = generatedLine + 1;
- mapping.generatedColumn = generatedColumn;
-
- if (hasLastGeneratedColumn) {
- // JS uses inclusive last generated column, wasm uses exclusive.
- mapping.lastGeneratedColumn = lastGeneratedColumn - 1;
- }
-
- if (hasOriginal) {
- mapping.source = source;
- // JS uses 1-based line numbers, wasm uses 0-based.
- mapping.originalLine = originalLine + 1;
- mapping.originalColumn = originalColumn;
-
- if (hasName) {
- mapping.name = name;
- }
- }
-
- callbackStack[callbackStack.length - 1](mapping);
- },
-
- start_all_generated_locations_for() { console.time("all_generated_locations_for"); },
- end_all_generated_locations_for() { console.timeEnd("all_generated_locations_for"); },
-
- start_compute_column_spans() { console.time("compute_column_spans"); },
- end_compute_column_spans() { console.timeEnd("compute_column_spans"); },
-
- start_generated_location_for() { console.time("generated_location_for"); },
- end_generated_location_for() { console.timeEnd("generated_location_for"); },
-
- start_original_location_for() { console.time("original_location_for"); },
- end_original_location_for() { console.timeEnd("original_location_for"); },
-
- start_parse_mappings() { console.time("parse_mappings"); },
- end_parse_mappings() { console.timeEnd("parse_mappings"); },
-
- start_sort_by_generated_location() { console.time("sort_by_generated_location"); },
- end_sort_by_generated_location() { console.timeEnd("sort_by_generated_location"); },
-
- start_sort_by_original_location() { console.time("sort_by_original_location"); },
- end_sort_by_original_location() { console.timeEnd("sort_by_original_location"); },
- }
- });
- }).then(Wasm => {
- return {
- exports: Wasm.instance.exports,
- withMappingCallback: (mappingCallback, f) => {
- callbackStack.push(mappingCallback);
- try {
- f();
- } finally {
- callbackStack.pop();
- }
- }
- };
- }).then(null, e => {
- cachedWasm = null;
- throw e;
- });
-
- return cachedWasm;
-};