@atlaspack/transformer-react-refresh-wrap 2.14.5-canary.138 → 2.14.5-canary.139

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.
@@ -0,0 +1,3 @@
1
+ import { Transformer } from '@atlaspack/plugin';
2
+ declare const _default: Transformer<unknown>;
3
+ export default _default;
@@ -26,8 +26,11 @@ function _featureFlags() {
26
26
  return data;
27
27
  }
28
28
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
29
+ // @ts-expect-error TS2304
29
30
  function shouldExclude(asset, options) {
30
- return !asset.isSource || !options.hmrOptions || !asset.env.isBrowser() || asset.env.isLibrary || asset.env.isWorker() || asset.env.isWorklet() || options.mode !== 'development' || !asset.getDependencies().find(v => v.specifier === 'react' || v.specifier === 'react/jsx-runtime' || v.specifier === 'react/jsx-dev-runtime' || v.specifier === '@emotion/react' || v.specifier === '@emotion/react/jsx-runtime' || v.specifier === '@emotion/react/jsx-dev-runtime');
31
+ return !asset.isSource || !options.hmrOptions || !asset.env.isBrowser() || asset.env.isLibrary || asset.env.isWorker() || asset.env.isWorklet() || options.mode !== 'development' || !asset.getDependencies().find(
32
+ // @ts-expect-error TS7006
33
+ v => v.specifier === 'react' || v.specifier === 'react/jsx-runtime' || v.specifier === 'react/jsx-dev-runtime' || v.specifier === '@emotion/react' || v.specifier === '@emotion/react/jsx-runtime' || v.specifier === '@emotion/react/jsx-dev-runtime');
31
34
  }
32
35
  var _default = exports.default = new (_plugin().Transformer)({
33
36
  async transform({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaspack/transformer-react-refresh-wrap",
3
- "version": "2.14.5-canary.138+eda07caaf",
3
+ "version": "2.14.5-canary.139+d2fd84977",
4
4
  "license": "(MIT OR Apache-2.0)",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -9,18 +9,22 @@
9
9
  "type": "git",
10
10
  "url": "https://github.com/atlassian-labs/atlaspack.git"
11
11
  },
12
- "main": "lib/ReactRefreshWrapTransformer.js",
13
- "source": "src/ReactRefreshWrapTransformer.js",
12
+ "main": "./lib/ReactRefreshWrapTransformer.js",
13
+ "source": "./src/ReactRefreshWrapTransformer.ts",
14
+ "types": "./lib/ReactRefreshWrapTransformer.d.ts",
14
15
  "engines": {
15
16
  "node": ">= 16.0.0"
16
17
  },
17
18
  "dependencies": {
18
- "@atlaspack/feature-flags": "2.14.1-canary.206+eda07caaf",
19
- "@atlaspack/plugin": "2.14.5-canary.138+eda07caaf",
20
- "@atlaspack/utils": "2.14.5-canary.138+eda07caaf",
19
+ "@atlaspack/feature-flags": "2.14.1-canary.207+d2fd84977",
20
+ "@atlaspack/plugin": "2.14.5-canary.139+d2fd84977",
21
+ "@atlaspack/utils": "2.14.5-canary.139+d2fd84977",
21
22
  "react-error-overlay": "6.0.9",
22
23
  "react-refresh": ">=0.9 <=0.16"
23
24
  },
24
25
  "type": "commonjs",
25
- "gitHead": "eda07caafd2ebb814bbdbfd0ec12fa63124e213f"
26
- }
26
+ "scripts": {
27
+ "check-ts": "tsc --emitDeclarationOnly --rootDir src"
28
+ },
29
+ "gitHead": "d2fd849770fe6305e9c694bd97b1bd905abd9d94"
30
+ }
@@ -1,10 +1,9 @@
1
- // @flow
2
-
3
1
  import path from 'path';
4
2
  import {Transformer} from '@atlaspack/plugin';
5
3
  import {getFeatureFlag} from '@atlaspack/feature-flags';
6
4
 
7
- function shouldExclude(asset, options) {
5
+ // @ts-expect-error TS2304
6
+ function shouldExclude(asset: MutableAsset, options: PluginOptions) {
8
7
  return (
9
8
  !asset.isSource ||
10
9
  !options.hmrOptions ||
@@ -13,21 +12,20 @@ function shouldExclude(asset, options) {
13
12
  asset.env.isWorker() ||
14
13
  asset.env.isWorklet() ||
15
14
  options.mode !== 'development' ||
16
- !asset
17
- .getDependencies()
18
- .find(
19
- (v) =>
20
- v.specifier === 'react' ||
21
- v.specifier === 'react/jsx-runtime' ||
22
- v.specifier === 'react/jsx-dev-runtime' ||
23
- v.specifier === '@emotion/react' ||
24
- v.specifier === '@emotion/react/jsx-runtime' ||
25
- v.specifier === '@emotion/react/jsx-dev-runtime',
26
- )
15
+ !asset.getDependencies().find(
16
+ // @ts-expect-error TS7006
17
+ (v) =>
18
+ v.specifier === 'react' ||
19
+ v.specifier === 'react/jsx-runtime' ||
20
+ v.specifier === 'react/jsx-dev-runtime' ||
21
+ v.specifier === '@emotion/react' ||
22
+ v.specifier === '@emotion/react/jsx-runtime' ||
23
+ v.specifier === '@emotion/react/jsx-dev-runtime',
24
+ )
27
25
  );
28
26
  }
29
27
 
30
- export default (new Transformer({
28
+ export default new Transformer({
31
29
  async transform({asset, options}) {
32
30
  if (shouldExclude(asset, options)) {
33
31
  return [asset];
@@ -74,4 +72,4 @@ ${code}
74
72
 
75
73
  return [asset];
76
74
  },
77
- }): Transformer<mixed>);
75
+ }) as Transformer<unknown>;
package/tsconfig.json ADDED
@@ -0,0 +1,4 @@
1
+ {
2
+ "extends": "../../../tsconfig.json",
3
+ "include": ["src"]
4
+ }