@mediatool/frontend-tools 1.3.6 → 1.4.3
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/dist/mtft.cjs +4 -2
- package/dist/utils.js +3 -3
- package/lib/build/get-module-context.js +2 -1
- package/lib/test/require.cjs +6 -5
- package/package.json +9 -5
package/dist/mtft.cjs
CHANGED
|
@@ -6,9 +6,11 @@ var vite = require('vite');
|
|
|
6
6
|
var promises = require('fs/promises');
|
|
7
7
|
var path = require('path');
|
|
8
8
|
var ramda = require('ramda');
|
|
9
|
+
var yafu = require('yafu');
|
|
9
10
|
var module$1 = require('module');
|
|
10
11
|
var child_process = require('child_process');
|
|
11
12
|
|
|
13
|
+
var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
|
|
12
14
|
async function fileExists (location) {
|
|
13
15
|
return promises.stat(location)
|
|
14
16
|
.then(() => true)
|
|
@@ -38,7 +40,7 @@ async function getModuleContext () {
|
|
|
38
40
|
const entryLocation = await getEntryFileLocation(location);
|
|
39
41
|
const pkg = JSON.parse(await promises.readFile(pkgLocation));
|
|
40
42
|
const { name } = pkg;
|
|
41
|
-
const dependencies =
|
|
43
|
+
const dependencies = yafu.uniq(ramda.keys({ ...pkg.dependencies, ...pkg.peerDependencies }));
|
|
42
44
|
return {
|
|
43
45
|
entry: entryLocation,
|
|
44
46
|
root: location,
|
|
@@ -82,7 +84,7 @@ function build (type) {
|
|
|
82
84
|
return fn()
|
|
83
85
|
}
|
|
84
86
|
|
|
85
|
-
const require$1 = module$1.createRequire((typeof document === 'undefined' ?
|
|
87
|
+
const require$1 = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.src || new URL('mtft.cjs', document.baseURI).href)));
|
|
86
88
|
const mochaCliPath = require$1.resolve('mocha/lib/cli/cli.js');
|
|
87
89
|
const requireFilePath = require$1.resolve('@mediatool/frontend-tools/lib/test/require.cjs');
|
|
88
90
|
|
package/dist/utils.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { assert, expect } from 'chai';
|
|
2
2
|
import * as react$1 from '@testing-library/react';
|
|
3
3
|
|
|
4
4
|
function _mergeNamespaces(n, m) {
|
|
@@ -18,8 +18,8 @@ function _mergeNamespaces(n, m) {
|
|
|
18
18
|
|
|
19
19
|
var assertions = /*#__PURE__*/Object.freeze({
|
|
20
20
|
__proto__: null,
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
assert: assert,
|
|
22
|
+
expect: expect
|
|
23
23
|
});
|
|
24
24
|
|
|
25
25
|
var react = /*#__PURE__*/_mergeNamespaces({
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { readFile, stat } from 'fs/promises'
|
|
2
2
|
import { resolve } from 'path'
|
|
3
3
|
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
4
|
-
import { keys
|
|
4
|
+
import { keys } from 'ramda'
|
|
5
|
+
import { uniq } from 'yafu'
|
|
5
6
|
|
|
6
7
|
async function fileExists (location) {
|
|
7
8
|
return stat(location)
|
package/lib/test/require.cjs
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
// eslint-disable-next-line import/no-unresolved
|
|
1
2
|
require('global-jsdom/register')
|
|
2
3
|
|
|
3
4
|
if (typeof window !== 'undefined') {
|
|
@@ -7,11 +8,11 @@ if (typeof window !== 'undefined') {
|
|
|
7
8
|
matches: false,
|
|
8
9
|
media: query,
|
|
9
10
|
onchange: null,
|
|
10
|
-
addListener
|
|
11
|
-
removeListener
|
|
12
|
-
addEventListener
|
|
13
|
-
removeEventListener
|
|
14
|
-
dispatchEvent
|
|
11
|
+
addListener () {},
|
|
12
|
+
removeListener () {},
|
|
13
|
+
addEventListener () {},
|
|
14
|
+
removeEventListener () {},
|
|
15
|
+
dispatchEvent () { return true },
|
|
15
16
|
}
|
|
16
17
|
}
|
|
17
18
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mediatool/frontend-tools",
|
|
3
|
-
"version": "1.3
|
|
3
|
+
"version": "1.4.3",
|
|
4
4
|
"description": "Common configs and tooling for bundling, testing, linting frontend modules",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"type": "module",
|
|
@@ -12,16 +12,18 @@
|
|
|
12
12
|
"./lib/test/require.cjs": "./lib/test/require.cjs"
|
|
13
13
|
},
|
|
14
14
|
"scripts": {
|
|
15
|
+
"preinstall": "npx only-allow pnpm",
|
|
15
16
|
"build": "rm -rf dist && rollup -c rollup.config.js",
|
|
17
|
+
"lint": "eslint --max-warnings 0 lib",
|
|
16
18
|
"test": "echo 'Testless'",
|
|
17
|
-
"prepublishOnly": "
|
|
19
|
+
"prepublishOnly": "pnpm run build"
|
|
18
20
|
},
|
|
19
21
|
"bin": {
|
|
20
22
|
"mtft": "dist/mtft.cjs"
|
|
21
23
|
},
|
|
22
24
|
"dependencies": {
|
|
23
25
|
"@babel/preset-react": "^7.18.6",
|
|
24
|
-
"@mediatool/eslint-config-mediatool": "^1.
|
|
26
|
+
"@mediatool/eslint-config-mediatool": "^1.7.0",
|
|
25
27
|
"@testing-library/react": "^13.4.0",
|
|
26
28
|
"@testing-library/user-event": "^14.4.3",
|
|
27
29
|
"@types/chai": "^4.3.4",
|
|
@@ -33,13 +35,15 @@
|
|
|
33
35
|
"jsdom": "^20.0.2",
|
|
34
36
|
"mocha": "^10.3.0",
|
|
35
37
|
"tsx": "^4.7.1",
|
|
36
|
-
"vite": "^3.2.4"
|
|
38
|
+
"vite": "^3.2.4",
|
|
39
|
+
"yafu": "^2.1.4"
|
|
37
40
|
},
|
|
38
41
|
"peerDependencies": {
|
|
39
42
|
"react": "^18.2.0",
|
|
40
43
|
"react-dom": "^18.2.0"
|
|
41
44
|
},
|
|
42
45
|
"devDependencies": {
|
|
43
|
-
"ramda": "^0.28.0"
|
|
46
|
+
"ramda": "^0.28.0",
|
|
47
|
+
"rollup": "^4.21.2"
|
|
44
48
|
}
|
|
45
49
|
}
|