From a3687d84ba011639f6bd1b25ea8ea906fcc5b1f3 Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Fri, 20 Aug 2021 13:01:35 +0200 Subject: separate node entry points Signed-off-by: Florian Dold --- packages/taler-util/package.json | 7 +++++-- packages/taler-util/src/globbing/minimatch.ts | 18 +----------------- packages/taler-util/src/index.node.ts | 2 ++ packages/taler-util/src/index.ts | 4 +--- 4 files changed, 9 insertions(+), 22 deletions(-) create mode 100644 packages/taler-util/src/index.node.ts (limited to 'packages/taler-util') diff --git a/packages/taler-util/package.json b/packages/taler-util/package.json index 730e99e81..b4bc32214 100644 --- a/packages/taler-util/package.json +++ b/packages/taler-util/package.json @@ -5,8 +5,11 @@ "exports": { ".": "./lib/index.js" }, - "module": "./lib/index.js", - "main": "./lib/index.js", + "module": "./lib/index.node.js", + "main": "./lib/index.node.js", + "browser": { + "./lib/index.node.js": "./lib/index.js" + }, "type": "module", "types": "./lib/index.d.ts", "typesVersions": { diff --git a/packages/taler-util/src/globbing/minimatch.ts b/packages/taler-util/src/globbing/minimatch.ts index 54779623a..b23de4e92 100644 --- a/packages/taler-util/src/globbing/minimatch.ts +++ b/packages/taler-util/src/globbing/minimatch.ts @@ -7,27 +7,11 @@ purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. */ - import { expand } from "./brace-expansion.js"; -const nodejs_path = (function () { - let path: typeof import("path"); - return function () { - if (!path) { - /** - * need to use an expression when doing a require if we want - * webpack not to find out about the requirement - */ - const _r = "require"; - path = module[_r]("path"); - } - return path; - }; -})(); - let path = { sep: "/" }; try { - path.sep = nodejs_path().sep; + path.sep = require("path").sep; } catch (er) {} const GLOBSTAR = {}; diff --git a/packages/taler-util/src/index.node.ts b/packages/taler-util/src/index.node.ts new file mode 100644 index 000000000..f0c805982 --- /dev/null +++ b/packages/taler-util/src/index.node.ts @@ -0,0 +1,2 @@ +export * from "./index.js"; +export * from "./talerconfig.js"; diff --git a/packages/taler-util/src/index.ts b/packages/taler-util/src/index.ts index e45e5dc02..a4b5cc8db 100644 --- a/packages/taler-util/src/index.ts +++ b/packages/taler-util/src/index.ts @@ -11,7 +11,6 @@ export * from "./notifications.js"; export * from "./payto.js"; export * from "./ReserveStatus.js"; export * from "./ReserveTransaction.js"; -export * from "./talerconfig.js"; export * from "./talerTypes.js"; export * from "./taleruri.js"; export * from "./time.js"; @@ -19,5 +18,4 @@ export * from "./transactionsTypes.js"; export * from "./walletTypes.js"; export * from "./i18n.js"; export * from "./logging.js"; -export * from "./url.js"; -export * from "./globbing/minimatch.js"; \ No newline at end of file +export * from "./url.js"; \ No newline at end of file -- cgit v1.2.3