Skip to content

Commit

Permalink
use konan instead of detective since we need ESM support
Browse files Browse the repository at this point in the history
  • Loading branch information
zloirock committed Aug 5, 2021
1 parent 25f09dd commit 9c3a0d8
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
"core-js-compat": "file:./packages/core-js-compat",
"core-js-pure": "file:./packages/core-js-pure",
"david": "^12.0.0",
"detective": "^5.2.0",
"electron-to-chromium": "^1.3.795",
"es-observable": "git+https://github.com/tc39/proposal-observable.git#d3404f06bc70c7c578a5047dfb3dc813730e3319",
"eslint": "^7.32.0",
Expand All @@ -52,6 +51,7 @@
"karma-chrome-launcher": "^3.1.0",
"karma-phantomjs-launcher": "~1.0.4",
"karma-qunit": "^4.1.2",
"konan": "^2.1.1",
"lerna": "^4.0.0",
"moon-unit": "0.2.2",
"npm": "^7.20.3",
Expand Down
4 changes: 2 additions & 2 deletions scripts/build-compat-entries.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import detective from 'detective';
import { globby } from 'globby';
import konan from 'konan';
import { modules } from 'core-js-compat/src/data.mjs';
import helpers from 'core-js-compat/helpers.js';

Expand All @@ -14,7 +14,7 @@ async function getModulesForEntryPoint(path, parent) {
if (!await fs.pathExists(entry)) return [];

const file = await fs.readFile(entry);
const result = await Promise.all(detective(file).map(dependency => {
const result = await Promise.all(konan(String(file)).strings.map(dependency => {
return getModulesForEntryPoint(dependency, entry);
}));

Expand Down
4 changes: 2 additions & 2 deletions scripts/check-unused-modules.mjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint-disable no-console -- output */
import detective from 'detective';
import { globby } from 'globby';
import konan from 'konan';
import { modules } from 'core-js-compat/src/data.mjs';

async function jsModulesFrom(path) {
Expand All @@ -26,7 +26,7 @@ const internalModules = await jsModulesFrom('packages/core-js/internals');
const allModules = await globby('packages/core-js?(-pure)/**/*.js');

await Promise.all(allModules.map(async path => {
for (const dependency of detective(await fs.readFile(path))) {
for (const dependency of konan(String(await fs.readFile(path))).strings) {
internalModules.delete(dependency.match(/\/internals\/([^/]+)$/)?.[1]);
}
}));
Expand Down

0 comments on commit 9c3a0d8

Please sign in to comment.