Skip to content

Commit

Permalink
v0.6.59
Browse files Browse the repository at this point in the history
  • Loading branch information
mbloch committed Dec 8, 2023
1 parent 578879a commit ec6e7a4
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
v0.6.59
* Second attempted fix for -require error on Windows.

v0.6.58
* Fix for -require error on Windows.

Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mapshaper",
"version": "0.6.58",
"version": "0.6.59",
"description": "A tool for editing vector datasets for mapping and GIS.",
"keywords": [
"shapefile",
Expand Down
7 changes: 2 additions & 5 deletions src/commands/mapshaper-require.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { isValidExternalCommand } from '../commands/mapshaper-external';

cmd.require = async function(opts) {
var globals = getStashedVar('defs');
var moduleFile, moduleName, mod, err;
var moduleFile, moduleName, mod;
if (!opts.module) {
stop("Missing module name or path to module");
}
Expand All @@ -20,17 +20,14 @@ cmd.require = async function(opts) {
} else {
moduleName = opts.module;
}
if (moduleFile && !require('path').isAbsolute(moduleFile)) {
moduleFile = require('path').join(process.cwd(), moduleFile);
}
try {
// import CJS and ES modules
mod = await import(moduleFile ? require('url').pathToFileURL(moduleFile) : moduleName);
if (mod.default) {
mod = mod.default;
}
if (typeof mod == 'function') {
// assuming that functions are mapshpaper command generators...
// assuming that functions are mapshaper command generators...
// this MUST be changed asap.
var retn = mod(api);
if (retn && isValidExternalCommand(retn)) {
Expand Down

0 comments on commit ec6e7a4

Please sign in to comment.