@modern-js/plugin-polyfill 1.2.3 → 1.2.6

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 CHANGED
@@ -1,5 +1,35 @@
1
1
  # @modern-js/plugin-polyfill
2
2
 
3
+ ## 1.2.6
4
+
5
+ ### Patch Changes
6
+
7
+ - 592edabc: feat: prebundle url-join,mime-types,json5,fast-glob,globby,ora,inquirer
8
+ - 895fa0ff: chore: using "workspace:\*" in devDependencies
9
+ - Updated dependencies [2d155c4c]
10
+ - Updated dependencies [123e432d]
11
+ - Updated dependencies [e5a9b26d]
12
+ - Updated dependencies [0b26b93b]
13
+ - Updated dependencies [123e432d]
14
+ - Updated dependencies [f9f66ef9]
15
+ - Updated dependencies [592edabc]
16
+ - Updated dependencies [895fa0ff]
17
+ - Updated dependencies [3578913e]
18
+ - Updated dependencies [1c3beab3]
19
+ - @modern-js/utils@1.6.0
20
+
21
+ ## 1.2.5
22
+
23
+ ### Patch Changes
24
+
25
+ - 60f7d8bf: feat: add tests dir to npmignore
26
+
27
+ ## 1.2.4
28
+
29
+ ### Patch Changes
30
+
31
+ - bebb39b6: chore: improve devDependencies and peerDependencies
32
+
3
33
  ## 1.2.3
4
34
 
5
35
  ### Patch Changes
@@ -1,5 +1,5 @@
1
1
  import { getPolyfillString } from '@modern-js/polyfill-lib';
2
- import mime from 'mime-types';
2
+ import { mime } from '@modern-js/utils';
3
3
  import Parser from 'ua-parser-js';
4
4
  import { defaultFeatures, defaultPolyfill } from "./const";
5
5
  import PolyfillCache, { generateCacheKey } from "./libs/cache";
@@ -7,7 +7,7 @@ exports.default = void 0;
7
7
 
8
8
  var _polyfillLib = require("@modern-js/polyfill-lib");
9
9
 
10
- var _mimeTypes = _interopRequireDefault(require("mime-types"));
10
+ var _utils = require("@modern-js/utils");
11
11
 
12
12
  var _uaParserJs = _interopRequireDefault(require("ua-parser-js"));
13
13
 
@@ -55,7 +55,7 @@ var _default = () => ({
55
55
  const matched = cache.get(cacheKey);
56
56
 
57
57
  if (matched) {
58
- context.res.setHeader('content-type', _mimeTypes.default.contentType('js'));
58
+ context.res.setHeader('content-type', _utils.mime.contentType('js'));
59
59
  return context.res.end(matched);
60
60
  }
61
61
 
@@ -65,7 +65,7 @@ var _default = () => ({
65
65
  features
66
66
  });
67
67
  cache.set(cacheKey, polyfill);
68
- context.res.setHeader('content-type', _mimeTypes.default.contentType('js'));
68
+ context.res.setHeader('content-type', _utils.mime.contentType('js'));
69
69
  return context.res.end(polyfill);
70
70
  };
71
71
  }
package/jest.config.js CHANGED
@@ -2,7 +2,6 @@ const sharedConfig = require('@scripts/jest-config');
2
2
 
3
3
  /** @type {import('@jest/types').Config.InitialOptions} */
4
4
  module.exports = {
5
- // eslint-disable-next-line node/no-unsupported-features/es-syntax
6
5
  ...sharedConfig,
7
6
  rootDir: __dirname,
8
7
  };
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "modern",
12
12
  "modern.js"
13
13
  ],
14
- "version": "1.2.3",
14
+ "version": "1.2.6",
15
15
  "jsnext:source": "./src/index.ts",
16
16
  "types": "./dist/types/index.d.ts",
17
17
  "main": "./dist/js/node/index.js",
@@ -37,23 +37,22 @@
37
37
  },
38
38
  "dependencies": {
39
39
  "@babel/runtime": "^7",
40
+ "@modern-js/utils": "^1.6.0",
40
41
  "@modern-js/polyfill-lib": "^1.0.0",
41
42
  "lru-cache": "^6.0.0",
42
- "mime-types": "^2.1.32",
43
43
  "ua-parser-js": "^0.7.28"
44
44
  },
45
45
  "devDependencies": {
46
- "@modern-js/server-core": "^1.2.3",
47
- "@modern-js/types": "^1.3.5",
46
+ "@modern-js/server-core": "1.3.2",
47
+ "@modern-js/types": "1.5.1",
48
48
  "@types/jest": "^26",
49
49
  "@types/lru-cache": "^5.1.1",
50
- "@types/mime-types": "^2.1.1",
51
50
  "@types/node": "^14",
52
51
  "@types/react": "^17",
53
52
  "@types/react-dom": "^17",
54
53
  "@types/ua-parser-js": "^0.7.36",
55
54
  "typescript": "^4",
56
- "@modern-js/core": "^1.5.0",
55
+ "@modern-js/core": "1.9.0",
57
56
  "@scripts/build": "0.0.0",
58
57
  "jest": "^27",
59
58
  "@scripts/jest-config": "0.0.0"
@@ -1,6 +0,0 @@
1
- module.exports = {
2
- extends: ['@modern-js'],
3
- parserOptions: {
4
- project: require.resolve('./tsconfig.json'),
5
- },
6
- };
@@ -1,53 +0,0 @@
1
- import type { NormalizedConfig } from '@modern-js/core';
2
- import cliPugin from '../src/cli';
3
- import serverPlugin from '../src';
4
- import { defaultPolyfill } from '../src/const';
5
-
6
- describe('plugin-static-hosting', () => {
7
- it('cli', () => {
8
- expect(cliPugin).toBeDefined();
9
- const instance = cliPugin();
10
- expect(instance.name).toBe('@modern-js/plugin-polyfill');
11
-
12
- const hooks: any = instance.setup?.({
13
- useResolvedConfigContext: () => {
14
- return {
15
- output: {},
16
- } as NormalizedConfig;
17
- },
18
- } as any);
19
-
20
- const params = { entrypoint: [], partials: [] };
21
- expect(hooks.htmlPartials(params)).toEqual(params);
22
- });
23
-
24
- it('server', async () => {
25
- expect(serverPlugin).toBeDefined();
26
- const instance = serverPlugin();
27
- expect(instance.name).toBe('@modern-js/plugin-polyfill');
28
-
29
- const hooks: any = instance.setup?.({} as any);
30
- const fn = hooks.preServerInit();
31
- expect(typeof fn).toBe('function');
32
-
33
- const errorContext = { url: '' };
34
- expect(await fn(errorContext, () => false)).toBeFalsy();
35
-
36
- const context = {
37
- url: defaultPolyfill,
38
- res: {
39
- setHeader: () => false,
40
- end: (result: string) => result,
41
- },
42
- headers: {
43
- 'user-agent':
44
- 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.99 Safari/537.36',
45
- },
46
- };
47
-
48
- const res = await fn(context);
49
- expect(res).toMatch('modern polyfill');
50
- const res1 = await fn(context);
51
- expect(res1).toMatch('modern polyfill');
52
- });
53
- });
@@ -1,9 +0,0 @@
1
- {
2
- "extends": "@modern-js/tsconfig/base",
3
- "compilerOptions": {
4
- "declaration": false,
5
- "jsx": "preserve",
6
- "baseUrl": "./",
7
- "isolatedModules": true
8
- }
9
- }