@atlaskit/media-file-preview 1.0.1 → 1.1.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.
package/AGENTS.md CHANGED
@@ -26,11 +26,13 @@
26
26
  > codebase and the docs after any code change. Use the `generate` subcommand to bootstrap the index
27
27
  > in a new repository.
28
28
 
29
- **Entry point:** `.agents/knowledge-index/INDEX.md`
30
- **Unit doc:** `.agents/knowledge-index/domains/media/units/atlaskit-media-file-preview.md`
31
- **Standards page:** `.agents/knowledge-index/domains/media/units/atlaskit-media-file-preview/standards-and-patterns.md`
32
- **CLI:** `python3 .agents/skills/knowledge-index/scripts/kg.py {find,read,edit,investigate,validate,init,explore,generate} …`
33
- **Refresh protocol:** never silently bump `Last verified` — always re-read the listed `Sources` first, edit, then `kg.py edit <path> --message "<reason>"`.
29
+ **Entry point:** `.agents/knowledge-index/INDEX.md` **Unit doc:**
30
+ `.agents/knowledge-index/domains/media/units/atlaskit-media-file-preview.md` **Standards page:**
31
+ `.agents/knowledge-index/domains/media/units/atlaskit-media-file-preview/standards-and-patterns.md`
32
+ **CLI:**
33
+ `python3 .agents/skills/knowledge-index/scripts/kg.py {find,read,edit,investigate,validate,init,explore,generate} …`
34
+ **Refresh protocol:** never silently bump `Last verified` — always re-read the listed `Sources`
35
+ first, edit, then `kg.py edit <path> --message "<reason>"`.
34
36
 
35
37
  ## Key source files
36
38
 
package/CHANGELOG.md CHANGED
@@ -1,11 +1,39 @@
1
1
  # @atlaskit/media-file-preview
2
2
 
3
+ ## 1.1.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`cd097a2111788`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/cd097a2111788) -
8
+ Republish packages depending on `@atlaskit/react-compiler-gating` so their published dependency
9
+ reference is updated to the renamed `@atlaskit/react-compiler-gating` scope.
10
+
11
+ The earlier rename of `@atlassian/react-compiler-gating` to `@atlaskit/react-compiler-gating` only
12
+ bumped the renamed package itself, so dependent packages were never republished and their
13
+ published versions still referenced the old `@atlassian/react-compiler-gating` name, which is not
14
+ available in the public npm registry. This minor bump republishes all affected packages with the
15
+ corrected dependency.
16
+
17
+ ### Patch Changes
18
+
19
+ - Updated dependencies
20
+
21
+ ## 1.0.2
22
+
23
+ ### Patch Changes
24
+
25
+ - [`43ca343e5b9c6`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/43ca343e5b9c6) -
26
+ Cleanup feature gate platform_media_safe_blob_url_eviction. The object URL cache now always
27
+ protects in-use entries from eviction and strips the cache-busting fragment before revoking blob
28
+ URLs.
29
+ - Updated dependencies
30
+
3
31
  ## 1.0.1
4
32
 
5
33
  ### Patch Changes
6
34
 
7
35
  - [`ee28cf33718b0`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/ee28cf33718b0) -
8
- Add @atlassian/react-compiler-gating as a runtime dependency to enable React Compiler platform
36
+ Add @atlaskit/react-compiler-gating as a runtime dependency to enable React Compiler platform
9
37
  gating.
10
38
  - Updated dependencies
11
39
 
@@ -13,7 +13,6 @@ var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/ge
13
13
  var _get2 = _interopRequireDefault(require("@babel/runtime/helpers/get"));
14
14
  var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
15
15
  var _lru_map = require("lru_map");
16
- var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
17
16
  function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2.default)(o), (0, _possibleConstructorReturn2.default)(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2.default)(t).constructor) : o.apply(t, e)); }
18
17
  function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
19
18
  function _superPropGet(t, o, e, r) { var p = (0, _get2.default)((0, _getPrototypeOf2.default)(1 & r ? t.prototype : t), o, e); return 2 & r && "function" == typeof p ? function (t) { return p.apply(e, t); } : p; }
@@ -22,9 +21,7 @@ var PREVIEW_CACHE_LRU_SIZE = exports.PREVIEW_CACHE_LRU_SIZE = 50;
22
21
  * LRU cache that checks whether the oldest entry should be evicted
23
22
  * this means that the cache can grow past the softLimit if `shouldEvict` returns false.
24
23
  *
25
- * When `platform_media_safe_blob_url_eviction` is ON the oldest
26
- * entry is kept if `shouldEvict` returns false.
27
- * When the flag is OFF the oldest entry is always evicted.
24
+ * The oldest entry is kept if `shouldEvict` returns false.
28
25
  */
29
26
  var EvictionLRUCache = /*#__PURE__*/function (_LRUMap) {
30
27
  function EvictionLRUCache(softLimit, options) {
@@ -39,11 +36,9 @@ var EvictionLRUCache = /*#__PURE__*/function (_LRUMap) {
39
36
  return (0, _createClass2.default)(EvictionLRUCache, [{
40
37
  key: "shift",
41
38
  value: function shift() {
42
- if ((0, _platformFeatureFlags.fg)('platform_media_safe_blob_url_eviction')) {
43
- var oldest = this.oldest;
44
- if (oldest && this.shouldEvict && !this.shouldEvict([oldest.key, oldest.value])) {
45
- return undefined;
46
- }
39
+ var oldest = this.oldest;
40
+ if (oldest && this.shouldEvict && !this.shouldEvict([oldest.key, oldest.value])) {
41
+ return undefined;
47
42
  }
48
43
  var entry = _superPropGet(EvictionLRUCache, "shift", this, 3)([]);
49
44
  if (entry && this.onEvict) {
@@ -64,7 +59,7 @@ var ObjectURLCache = exports.ObjectURLCache = /*#__PURE__*/function () {
64
59
  },
65
60
  onEvict: function onEvict(entry) {
66
61
  if (entry[1].dataURI) {
67
- var dataURI = (0, _platformFeatureFlags.fg)('platform_media_safe_blob_url_eviction') ? entry[1].dataURI.split('#')[0] : entry[1].dataURI;
62
+ var dataURI = entry[1].dataURI.split('#')[0];
68
63
  if (dataURI) {
69
64
  URL.revokeObjectURL(dataURI);
70
65
  }
@@ -121,7 +116,7 @@ var ObjectURLCache = exports.ObjectURLCache = /*#__PURE__*/function () {
121
116
  value: function remove(key) {
122
117
  var removed = this.cache.delete(key);
123
118
  this.activeRefs.delete(key);
124
- var dataURI = (0, _platformFeatureFlags.fg)('platform_media_safe_blob_url_eviction') ? removed === null || removed === void 0 ? void 0 : removed.dataURI.split('#')[0] : removed === null || removed === void 0 ? void 0 : removed.dataURI;
119
+ var dataURI = removed === null || removed === void 0 ? void 0 : removed.dataURI.split('#')[0];
125
120
  dataURI && URL.revokeObjectURL(dataURI);
126
121
  }
127
122
  }, {
@@ -1,14 +1,11 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  import { LRUMap } from 'lru_map';
3
- import { fg } from '@atlaskit/platform-feature-flags';
4
3
  export const PREVIEW_CACHE_LRU_SIZE = 50;
5
4
  /**
6
5
  * LRU cache that checks whether the oldest entry should be evicted
7
6
  * this means that the cache can grow past the softLimit if `shouldEvict` returns false.
8
7
  *
9
- * When `platform_media_safe_blob_url_eviction` is ON the oldest
10
- * entry is kept if `shouldEvict` returns false.
11
- * When the flag is OFF the oldest entry is always evicted.
8
+ * The oldest entry is kept if `shouldEvict` returns false.
12
9
  */
13
10
  class EvictionLRUCache extends LRUMap {
14
11
  constructor(softLimit, options) {
@@ -17,11 +14,9 @@ class EvictionLRUCache extends LRUMap {
17
14
  this.onEvict = options === null || options === void 0 ? void 0 : options.onEvict;
18
15
  }
19
16
  shift() {
20
- if (fg('platform_media_safe_blob_url_eviction')) {
21
- const oldest = this.oldest;
22
- if (oldest && this.shouldEvict && !this.shouldEvict([oldest.key, oldest.value])) {
23
- return undefined;
24
- }
17
+ const oldest = this.oldest;
18
+ if (oldest && this.shouldEvict && !this.shouldEvict([oldest.key, oldest.value])) {
19
+ return undefined;
25
20
  }
26
21
  const entry = super.shift();
27
22
  if (entry && this.onEvict) {
@@ -37,7 +32,7 @@ export class ObjectURLCache {
37
32
  shouldEvict: entry => !this.isInUse(entry[0]),
38
33
  onEvict: entry => {
39
34
  if (entry[1].dataURI) {
40
- const dataURI = fg('platform_media_safe_blob_url_eviction') ? entry[1].dataURI.split('#')[0] : entry[1].dataURI;
35
+ const dataURI = entry[1].dataURI.split('#')[0];
41
36
  if (dataURI) {
42
37
  URL.revokeObjectURL(dataURI);
43
38
  }
@@ -80,7 +75,7 @@ export class ObjectURLCache {
80
75
  remove(key) {
81
76
  const removed = this.cache.delete(key);
82
77
  this.activeRefs.delete(key);
83
- const dataURI = fg('platform_media_safe_blob_url_eviction') ? removed === null || removed === void 0 ? void 0 : removed.dataURI.split('#')[0] : removed === null || removed === void 0 ? void 0 : removed.dataURI;
78
+ const dataURI = removed === null || removed === void 0 ? void 0 : removed.dataURI.split('#')[0];
84
79
  dataURI && URL.revokeObjectURL(dataURI);
85
80
  }
86
81
  clear() {
@@ -9,15 +9,12 @@ function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstruct
9
9
  function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
10
10
  function _superPropGet(t, o, e, r) { var p = _get(_getPrototypeOf(1 & r ? t.prototype : t), o, e); return 2 & r && "function" == typeof p ? function (t) { return p.apply(e, t); } : p; }
11
11
  import { LRUMap } from 'lru_map';
12
- import { fg } from '@atlaskit/platform-feature-flags';
13
12
  export var PREVIEW_CACHE_LRU_SIZE = 50;
14
13
  /**
15
14
  * LRU cache that checks whether the oldest entry should be evicted
16
15
  * this means that the cache can grow past the softLimit if `shouldEvict` returns false.
17
16
  *
18
- * When `platform_media_safe_blob_url_eviction` is ON the oldest
19
- * entry is kept if `shouldEvict` returns false.
20
- * When the flag is OFF the oldest entry is always evicted.
17
+ * The oldest entry is kept if `shouldEvict` returns false.
21
18
  */
22
19
  var EvictionLRUCache = /*#__PURE__*/function (_LRUMap) {
23
20
  function EvictionLRUCache(softLimit, options) {
@@ -32,11 +29,9 @@ var EvictionLRUCache = /*#__PURE__*/function (_LRUMap) {
32
29
  return _createClass(EvictionLRUCache, [{
33
30
  key: "shift",
34
31
  value: function shift() {
35
- if (fg('platform_media_safe_blob_url_eviction')) {
36
- var oldest = this.oldest;
37
- if (oldest && this.shouldEvict && !this.shouldEvict([oldest.key, oldest.value])) {
38
- return undefined;
39
- }
32
+ var oldest = this.oldest;
33
+ if (oldest && this.shouldEvict && !this.shouldEvict([oldest.key, oldest.value])) {
34
+ return undefined;
40
35
  }
41
36
  var entry = _superPropGet(EvictionLRUCache, "shift", this, 3)([]);
42
37
  if (entry && this.onEvict) {
@@ -57,7 +52,7 @@ export var ObjectURLCache = /*#__PURE__*/function () {
57
52
  },
58
53
  onEvict: function onEvict(entry) {
59
54
  if (entry[1].dataURI) {
60
- var dataURI = fg('platform_media_safe_blob_url_eviction') ? entry[1].dataURI.split('#')[0] : entry[1].dataURI;
55
+ var dataURI = entry[1].dataURI.split('#')[0];
61
56
  if (dataURI) {
62
57
  URL.revokeObjectURL(dataURI);
63
58
  }
@@ -114,7 +109,7 @@ export var ObjectURLCache = /*#__PURE__*/function () {
114
109
  value: function remove(key) {
115
110
  var removed = this.cache.delete(key);
116
111
  this.activeRefs.delete(key);
117
- var dataURI = fg('platform_media_safe_blob_url_eviction') ? removed === null || removed === void 0 ? void 0 : removed.dataURI.split('#')[0] : removed === null || removed === void 0 ? void 0 : removed.dataURI;
112
+ var dataURI = removed === null || removed === void 0 ? void 0 : removed.dataURI.split('#')[0];
118
113
  dataURI && URL.revokeObjectURL(dataURI);
119
114
  }
120
115
  }, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/media-file-preview",
3
- "version": "1.0.1",
3
+ "version": "1.1.0",
4
4
  "description": "A React Hook to fetch and render file previews. It's overloaded with fancy features like SSR, lazy loading, memory cache and local preview.",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -11,7 +11,7 @@
11
11
  "react-compiler": {
12
12
  "enabled": true,
13
13
  "gating": {
14
- "source": "@atlassian/react-compiler-gating",
14
+ "source": "@atlaskit/react-compiler-gating",
15
15
  "importSpecifierName": "isReactCompilerActivePlatform"
16
16
  }
17
17
  },
@@ -30,12 +30,12 @@
30
30
  "atlaskit:src": "src/index.ts",
31
31
  "dependencies": {
32
32
  "@atlaskit/media-client": "^37.1.0",
33
- "@atlaskit/media-client-react": "^6.0.0",
34
- "@atlaskit/media-common": "^14.1.0",
35
- "@atlaskit/media-ui": "^30.3.0",
33
+ "@atlaskit/media-client-react": "^6.1.0",
34
+ "@atlaskit/media-common": "^14.2.0",
35
+ "@atlaskit/media-ui": "^30.5.0",
36
36
  "@atlaskit/platform-feature-flags": "^2.0.0",
37
- "@atlaskit/react-ufo": "^7.1.0",
38
- "@atlassian/react-compiler-gating": "^0.2.0",
37
+ "@atlaskit/react-compiler-gating": "^0.2.0",
38
+ "@atlaskit/react-ufo": "^7.3.0",
39
39
  "@babel/runtime": "^7.0.0",
40
40
  "lru_map": "^0.4.1"
41
41
  },
@@ -48,11 +48,11 @@
48
48
  "@af/visual-regression": "workspace:^",
49
49
  "@atlaskit/media-state": "^3.0.0",
50
50
  "@atlaskit/media-test-data": "^4.0.0",
51
- "@atlaskit/section-message": "^9.1.0",
51
+ "@atlaskit/section-message": "^9.2.0",
52
52
  "@atlaskit/ssr": "workspace:^",
53
- "@atlassian/a11y-jest-testing": "^0.12.0",
53
+ "@atlassian/a11y-jest-testing": "^0.13.0",
54
54
  "@atlassian/feature-flags-test-utils": "^1.1.0",
55
- "@atlassian/testing-library": "^0.6.0",
55
+ "@atlassian/testing-library": "^0.7.0",
56
56
  "@testing-library/react": "^16.3.0",
57
57
  "react": "^18.2.0",
58
58
  "react-dom": "^18.2.0",
@@ -106,9 +106,6 @@
106
106
  "platform_media_cross_client_copy_with_auth": {
107
107
  "type": "boolean"
108
108
  },
109
- "platform_media_safe_blob_url_eviction": {
110
- "type": "boolean"
111
- },
112
109
  "platform_media_ssr_data_seed": {
113
110
  "type": "boolean"
114
111
  }