fabric 6.0.0-beta4 → 6.0.0-beta5
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.
- package/CHANGELOG.md +4 -0
- package/dist/fabric.d.ts +1 -1
- package/dist/index.js +21 -2
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +1 -1
- package/dist/index.mjs +21 -3
- package/dist/index.mjs.map +1 -1
- package/dist/index.node.cjs +16 -1
- package/dist/index.node.cjs.map +1 -1
- package/dist/index.node.mjs +16 -2
- package/dist/index.node.mjs.map +1 -1
- package/dist/src/env/index.d.ts +13 -0
- package/fabric.ts +1 -1
- package/package.json +1 -1
- package/src/env/index.ts +13 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
## [next]
|
|
4
4
|
|
|
5
|
+
## [6.0.0-beta5]
|
|
6
|
+
|
|
7
|
+
- bundle(): export `setEnv` for JEST interoperability [#8888](https://github.com/fabricjs/fabric.js/pull/8888)
|
|
8
|
+
|
|
5
9
|
## [6.0.0-beta4]
|
|
6
10
|
|
|
7
11
|
- chore(): Code cleanup and reuse of code in svg-parsing code [#8881](https://github.com/fabricjs/fabric.js/pull/8881)
|
package/dist/fabric.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { getEnv, getDocument, getWindow } from './src/env';
|
|
1
|
+
export { getEnv, getDocument, getWindow, setEnv } from './src/env';
|
|
2
2
|
export { cache } from './src/cache';
|
|
3
3
|
export { VERSION as version, iMatrix } from './src/constants';
|
|
4
4
|
export { config } from './src/config';
|
package/dist/index.js
CHANGED
|
@@ -324,7 +324,25 @@
|
|
|
324
324
|
* This is done in order to support isomorphic usage for browser and node applications
|
|
325
325
|
* since window and document aren't defined at time of import in SSR, we can't set env so we avoid it by deferring to the default env.
|
|
326
326
|
*/
|
|
327
|
-
|
|
327
|
+
let env;
|
|
328
|
+
|
|
329
|
+
/**
|
|
330
|
+
* Sets the environment variables used by fabric.\
|
|
331
|
+
* This is exposed for special cases, such as configuring a test environment, and should be used with care.
|
|
332
|
+
*
|
|
333
|
+
* **CAUTION**: Must be called before using the package.
|
|
334
|
+
*
|
|
335
|
+
* @example Testing with jest
|
|
336
|
+
* // jest is commonjs (https://jestjs.io/docs/ecmascript-modules), so by default it imports the node entry point.
|
|
337
|
+
* import { getEnv, setEnv } from 'fabric';
|
|
338
|
+
* // we want fabric to use the `window` and `document` objects exposed by jest.
|
|
339
|
+
* setEnv({ ...getEnv(), window, document });
|
|
340
|
+
* // done with setup, now run tests
|
|
341
|
+
*/
|
|
342
|
+
const setEnv = value => {
|
|
343
|
+
env = value;
|
|
344
|
+
};
|
|
345
|
+
const getEnv = () => env || getEnv$1();
|
|
328
346
|
const getDocument = () => getEnv().document;
|
|
329
347
|
const getWindow = () => getEnv().window;
|
|
330
348
|
|
|
@@ -403,7 +421,7 @@
|
|
|
403
421
|
}
|
|
404
422
|
const cache = new Cache();
|
|
405
423
|
|
|
406
|
-
var version = "6.0.0-
|
|
424
|
+
var version = "6.0.0-beta5";
|
|
407
425
|
|
|
408
426
|
// use this syntax so babel plugin see this import here
|
|
409
427
|
const VERSION = version;
|
|
@@ -27677,6 +27695,7 @@
|
|
|
27677
27695
|
exports.parseStyleAttribute = parseStyleAttribute;
|
|
27678
27696
|
exports.parseTransformAttribute = parseTransformAttribute;
|
|
27679
27697
|
exports.runningAnimations = runningAnimations;
|
|
27698
|
+
exports.setEnv = setEnv;
|
|
27680
27699
|
exports.util = index$1;
|
|
27681
27700
|
exports.version = VERSION;
|
|
27682
27701
|
|