File tree Expand file tree Collapse file tree 4 files changed +17
-5
lines changed Expand file tree Collapse file tree 4 files changed +17
-5
lines changed Original file line number Diff line number Diff line change @@ -4,12 +4,15 @@ cat >dist/cjs/package.json <<!EOF
4
4
}
5
5
!EOF
6
6
7
- sed -i ' ' " s/require(\ " graphql\/execution\/values\ " )/require(\ " graphql\/execution\/values.js\ " )/" " dist/cjs/QueryComplexity.js"
7
+ sed -i ' ' ' s/require("graphql\/execution\/values")/require("graphql\/execution\/values.js")/' " dist/cjs/QueryComplexity.js"
8
8
9
9
cat > dist/esm/package.json << !EOF
10
10
{
11
11
"type": "module"
12
12
}
13
13
!EOF
14
14
15
- sed -i ' ' " s/from 'graphql\/execution\/values';/from 'graphql\/execution\/values.mjs';/" " dist/esm/QueryComplexity.js"
15
+ sed -i ' ' ' s/from ' \' ' graphql\/execution\/values' \' ' ;/from ' \' ' graphql\/execution\/values.mjs' \' ' ;/' " dist/esm/QueryComplexity.js"
16
+
17
+ # We need to update from 'graphql' to 'graphql/index.mjs' in all files in dist/esm to ensure the GraphQL module is loaded from the same realm
18
+ find dist/esm -type f -name " *.js" -exec sed -i ' ' ' s/from ' \' ' graphql' \' ' ;/from ' \' ' graphql\/index.mjs' \' ' ;/' {} +
Original file line number Diff line number Diff line change @@ -2,4 +2,6 @@ cat >dist/test/cjs/package.json <<!EOF
2
2
{
3
3
"type": "commonjs"
4
4
}
5
- !EOF
5
+ !EOF
6
+
7
+ sed -i ' ' ' s/require("graphql\/execution\/values")/require("graphql\/execution\/values.js")/' " dist/test/cjs/QueryComplexity.js"
Original file line number Diff line number Diff line change @@ -3,3 +3,8 @@ cat >dist/test/esm/package.json <<!EOF
3
3
"type": "module"
4
4
}
5
5
!EOF
6
+
7
+ sed -i ' ' ' s/from ' \' ' graphql\/execution\/values' \' ' ;/from ' \' ' graphql\/execution\/values.mjs' \' ' ;/' " dist/test/esm/QueryComplexity.js"
8
+
9
+ # We need to update from 'graphql' to 'graphql/index.mjs' in all files in dist/esm to ensure the GraphQL module is loaded from the same realm
10
+ find dist/test/esm -type f -name " *.js" -exec sed -i ' ' ' s/from ' \' ' graphql' \' ' ;/from ' \' ' graphql\/index.mjs' \' ' ;/' {} +
Original file line number Diff line number Diff line change 16
16
"build:test:esm" : " tsc -p ./tsconfig.test.esm.json && ./fix-hybrid-module.test.esm.sh" ,
17
17
"test" : " npm run lint && npm run build:test:cjs && npm run testonly:cjs && npm run build:test:esm && npm run testonly:esm" ,
18
18
"testonly:cjs" : " mocha --check-leaks --exit --full-trace 'dist/test/cjs/**/__tests__/**/*-test.js'" ,
19
- "testonly:esm" : " mocha -n experimental-json-modules --check-leaks --exit --full-trace 'dist/test/esm/**/__tests__/**/*-test.js'" ,
19
+ "testonly:esm" : " mocha -n experimental-json-modules --loader=ts-node/esm -- check-leaks --exit --full-trace 'dist/test/esm/**/__tests__/**/*-test.js'" ,
20
20
"dist" : " npm run clean && npm run build" ,
21
21
"prepare" : " npm run clean && npm run dist"
22
22
},
47
47
"." : {
48
48
"import" : " ./dist/esm/index.js" ,
49
49
"require" : " ./dist/cjs/index.js"
50
- }
50
+ },
51
+ "./esm" : " ./dist/esm/index.js" ,
52
+ "./cjs" : " ./dist/cjs/index.js"
51
53
},
52
54
"author" : " Ivo Meißner" ,
53
55
"license" : " MIT" ,
You can’t perform that action at this time.
0 commit comments