@module-federation/data-prefetch 0.6.7 → 0.6.8

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/.swcrc ADDED
@@ -0,0 +1,29 @@
1
+ {
2
+ "jsc": {
3
+ "target": "es2017",
4
+ "parser": {
5
+ "syntax": "typescript",
6
+ "decorators": true,
7
+ "dynamicImport": true
8
+ },
9
+ "transform": {
10
+ "decoratorMetadata": true,
11
+ "legacyDecorator": true
12
+ },
13
+ "keepClassNames": true,
14
+ "externalHelpers": true,
15
+ "loose": true
16
+ },
17
+ "module": {
18
+ "type": "es6"
19
+ },
20
+ "sourceMaps": true,
21
+ "exclude": [
22
+ "jest.config.ts",
23
+ ".*\\.spec.tsx?$",
24
+ ".*\\.test.tsx?$",
25
+ "./src/jest-setup.ts$",
26
+ "./**/jest-setup.ts$",
27
+ ".*.js$"
28
+ ]
29
+ }
package/CHANGELOG.md CHANGED
@@ -1,5 +1,16 @@
1
1
  # @module-federation/data-prefetch
2
2
 
3
+ ## 0.6.8
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [32db0ac]
8
+ - Updated dependencies [32db0ac]
9
+ - Updated dependencies [6c5f444]
10
+ - Updated dependencies [fac6ecf]
11
+ - @module-federation/sdk@0.6.8
12
+ - @module-federation/runtime@0.6.8
13
+
3
14
  ## 0.6.7
4
15
 
5
16
  ### Patch Changes
package/dist/babel.cjs.js CHANGED
@@ -1,62 +1,50 @@
1
1
  'use strict';
2
2
 
3
- var require$$1 = require('path');
4
-
5
- function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
6
-
7
- var require$$1__default = /*#__PURE__*/_interopDefaultLegacy(require$$1);
3
+ var path = require('path');
8
4
 
9
5
  // no used now
10
- var attribute = 'id';
11
- var hookId = 'usePrefetch';
12
- var importPackage = '@module-federation/data-prefetch/react';
6
+ const attribute = 'id';
7
+ const hookId = 'usePrefetch';
8
+ const importPackage = '@module-federation/data-prefetch/react';
13
9
  // biome-ignore lint/suspicious/noExplicitAny: <explanation>
14
- function babel(babel, options) {
15
- var t = babel.types;
16
- var shouldHandle = false;
17
- var scope = '';
18
- var name = options.name, exposes = options.exposes;
10
+ var babel = ((babel, options)=>{
11
+ const t = babel.types;
12
+ let shouldHandle = false;
13
+ let scope = '';
14
+ const { name, exposes } = options;
19
15
  if (!exposes) {
20
16
  return {};
21
17
  }
22
- var exposesKey = Object.keys(exposes);
23
- var processedExposes = exposesKey.map(function(expose) {
24
- return {
18
+ const exposesKey = Object.keys(exposes);
19
+ const processedExposes = exposesKey.map((expose)=>({
25
20
  key: expose.replace('.', ''),
26
- value: require$$1__default["default"].resolve(// @ts-ignore
21
+ value: path.resolve(// @ts-ignore
27
22
  typeof exposes[expose] === 'string' ? exposes[expose] : exposes[expose].import)
28
- };
29
- });
23
+ }));
30
24
  return {
31
25
  visitor: {
32
- ImportDeclaration: function ImportDeclaration(nodePath, // biome-ignore lint/suspicious/noExplicitAny: <explanation>
26
+ ImportDeclaration (nodePath, // biome-ignore lint/suspicious/noExplicitAny: <explanation>
33
27
  state) {
34
- var source = nodePath.node.source.value;
35
- var specifiers = nodePath.node.specifiers;
36
- var filename = state.file.opts.filename;
28
+ const source = nodePath.node.source.value;
29
+ const { specifiers } = nodePath.node;
30
+ const { filename } = state.file.opts;
37
31
  if (source === importPackage) {
38
- shouldHandle = specifiers.some(function(specifier) {
39
- return specifier.imported && specifier.imported.name === hookId && processedExposes.find(// biome-ignore lint/suspicious/noAssignInExpressions: <explanation>
40
- function(expose) {
41
- return expose.value === filename && (scope = expose.key);
42
- });
43
- });
32
+ shouldHandle = specifiers.some((specifier)=>specifier.imported && specifier.imported.name === hookId && processedExposes.find(// biome-ignore lint/suspicious/noAssignInExpressions: <explanation>
33
+ (expose)=>expose.value === filename && (scope = expose.key)));
44
34
  }
45
35
  },
46
- CallExpression: function CallExpression(nodePath) {
36
+ CallExpression (nodePath) {
47
37
  if (shouldHandle && t.isIdentifier(nodePath.node.callee, {
48
38
  name: hookId
49
39
  }) && nodePath.node.arguments.length > 0) {
50
- var objectExpression = nodePath.node.arguments[0];
51
- if (objectExpression && t.isObjectExpression(objectExpression) && !objectExpression.properties.find(function(p) {
52
- return p.key.name === attribute;
53
- })) {
40
+ const objectExpression = nodePath.node.arguments[0];
41
+ if (objectExpression && t.isObjectExpression(objectExpression) && !objectExpression.properties.find((p)=>p.key.name === attribute)) {
54
42
  objectExpression.properties.push(t.objectProperty(t.identifier(attribute), t.stringLiteral(name + scope)));
55
43
  }
56
44
  }
57
45
  }
58
46
  }
59
47
  };
60
- }
48
+ });
61
49
 
62
50
  module.exports = babel;
@@ -0,0 +1,2 @@
1
+ export * from "./src/cli/babel";
2
+ export { default } from "./src/cli/babel";
package/dist/babel.esm.js CHANGED
@@ -1,56 +1,48 @@
1
- import require$$1 from 'path';
1
+ import path from 'path';
2
2
 
3
3
  // no used now
4
- var attribute = 'id';
5
- var hookId = 'usePrefetch';
6
- var importPackage = '@module-federation/data-prefetch/react';
4
+ const attribute = 'id';
5
+ const hookId = 'usePrefetch';
6
+ const importPackage = '@module-federation/data-prefetch/react';
7
7
  // biome-ignore lint/suspicious/noExplicitAny: <explanation>
8
- function babel(babel, options) {
9
- var t = babel.types;
10
- var shouldHandle = false;
11
- var scope = '';
12
- var name = options.name, exposes = options.exposes;
8
+ var babel = ((babel, options)=>{
9
+ const t = babel.types;
10
+ let shouldHandle = false;
11
+ let scope = '';
12
+ const { name, exposes } = options;
13
13
  if (!exposes) {
14
14
  return {};
15
15
  }
16
- var exposesKey = Object.keys(exposes);
17
- var processedExposes = exposesKey.map(function(expose) {
18
- return {
16
+ const exposesKey = Object.keys(exposes);
17
+ const processedExposes = exposesKey.map((expose)=>({
19
18
  key: expose.replace('.', ''),
20
- value: require$$1.resolve(// @ts-ignore
19
+ value: path.resolve(// @ts-ignore
21
20
  typeof exposes[expose] === 'string' ? exposes[expose] : exposes[expose].import)
22
- };
23
- });
21
+ }));
24
22
  return {
25
23
  visitor: {
26
- ImportDeclaration: function ImportDeclaration(nodePath, // biome-ignore lint/suspicious/noExplicitAny: <explanation>
24
+ ImportDeclaration (nodePath, // biome-ignore lint/suspicious/noExplicitAny: <explanation>
27
25
  state) {
28
- var source = nodePath.node.source.value;
29
- var specifiers = nodePath.node.specifiers;
30
- var filename = state.file.opts.filename;
26
+ const source = nodePath.node.source.value;
27
+ const { specifiers } = nodePath.node;
28
+ const { filename } = state.file.opts;
31
29
  if (source === importPackage) {
32
- shouldHandle = specifiers.some(function(specifier) {
33
- return specifier.imported && specifier.imported.name === hookId && processedExposes.find(// biome-ignore lint/suspicious/noAssignInExpressions: <explanation>
34
- function(expose) {
35
- return expose.value === filename && (scope = expose.key);
36
- });
37
- });
30
+ shouldHandle = specifiers.some((specifier)=>specifier.imported && specifier.imported.name === hookId && processedExposes.find(// biome-ignore lint/suspicious/noAssignInExpressions: <explanation>
31
+ (expose)=>expose.value === filename && (scope = expose.key)));
38
32
  }
39
33
  },
40
- CallExpression: function CallExpression(nodePath) {
34
+ CallExpression (nodePath) {
41
35
  if (shouldHandle && t.isIdentifier(nodePath.node.callee, {
42
36
  name: hookId
43
37
  }) && nodePath.node.arguments.length > 0) {
44
- var objectExpression = nodePath.node.arguments[0];
45
- if (objectExpression && t.isObjectExpression(objectExpression) && !objectExpression.properties.find(function(p) {
46
- return p.key.name === attribute;
47
- })) {
38
+ const objectExpression = nodePath.node.arguments[0];
39
+ if (objectExpression && t.isObjectExpression(objectExpression) && !objectExpression.properties.find((p)=>p.key.name === attribute)) {
48
40
  objectExpression.properties.push(t.objectProperty(t.identifier(attribute), t.stringLiteral(name + scope)));
49
41
  }
50
42
  }
51
43
  }
52
44
  }
53
45
  };
54
- }
46
+ });
55
47
 
56
48
  export { babel as default };