|
| 1 | +/* Copyright 2022 The TensorFlow Authors. All Rights Reserved. |
| 2 | +
|
| 3 | +Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | +you may not use this file except in compliance with the License. |
| 5 | +You may obtain a copy of the License at |
| 6 | +
|
| 7 | + http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | +
|
| 9 | +Unless required by applicable law or agreed to in writing, software |
| 10 | +distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | +See the License for the specific language governing permissions and |
| 13 | +limitations under the License. |
| 14 | +==============================================================================*/ |
| 15 | +import numeric from 'numeric'; |
| 16 | + |
| 17 | +// The numeric library requires that the symbol 'numeric' is available in the |
| 18 | +// global scope when its operations are executed by other modules. See, for |
| 19 | +// example, how the definition of some of its operations refer to the string |
| 20 | +// 'numeric' in the Function definition, unmodifiable by the |
| 21 | +// bundler/minification code: |
| 22 | +// |
| 23 | +// https://github.com/sloisel/numeric/blob/656fa1254be540f428710738ca9c1539625777f1/src/numeric.js#L696 |
| 24 | +// |
| 25 | +// The esbuild bundler does not keep 'numeric' in global scope and instead |
| 26 | +// renames it as part of bundling/minification. We work around this by manually |
| 27 | +// adding it to global scope here. |
| 28 | +window['numeric'] = window['numeric'] ?? numeric; |
| 29 | + |
| 30 | +// Reexport the numeric library. All imports of numeric should be done through |
| 31 | +// this file to ensure 'numeric' is available in the global scope. |
| 32 | +export {numeric}; |
0 commit comments