Open BinToss opened 1 month ago
I tried a quick and easy fix. It didn't work.
Instead of changing the pattern for the InputMap keys, the path of an MJS wrapper should not be affected by the Input Map key at all and should be created alongside the CJS output.
.keysOf(string().match(/^[/a-zA-Z0-9-_]+$/u)),
^
This change causes the wrapper files to be created in the correct directory, but their import will now add the directories in the InputMap key to the import path, thereby breaking the import path again.
Before this change:
// ./cjs/dotnetHelpers-wrapper.mjs
// Bundled with Packemon: https://packemon.dev
// This is an MJS wrapper for a sibling CJS file
// should be './dotnet/dotnetHelpers.cjs'
import data from './dotnetHelpers.cjs';
export const { configureDotnetNugetPush, configurePrepareCmd, nugetDefault } = data;
After this change and InputMap key prefixed with dotnet/
:
// ./cjs/dotnet/dotnetHelpers-wrapper.mjs
// Bundled with Packemon: https://packemon.dev
// This is an MJS wrapper for a sibling CJS file
// should be './dotnetHelpers.cjs'
import data from './dotnet/dotnetHelpers.cjs';
export const { configureDotnetNugetPush, configurePrepareCmd, nugetDefault } = data;
Whats your packemon
config look like?
The wrappers then try and fail to import their CJS module from './*.cjs' The path of the wrappers depend on their CJS module's InputMap key.
Additionally... The pattern for an InputMap key prohibits '/' characters.![image](https://github.com/milesj/packemon/assets/7243190/3a0b51a4-4346-4591-8154-1ed4d1bb76d7)
Removing the '/' characters from the keys causes the "-wrapper.m,js" files to be created at![image](https://github.com/milesj/packemon/assets/7243190/5f00a907-0345-4a80-9318-cc717f16b7a0)
./cjs/*-wrapper.mjs
instead of alongside the CJS files at./cjs/dotnet/*.cjs
This doesn't work. The wrappers' import statements treat the CJS modules as if they're in the same directory and will fail to load them.