Closed BinToss closed 4 months ago
I wonder if changing types.ts
to types.d.ts
would fix the issue...
This'll be fixed by https://github.com/milesj/packemon/pull/252 Will close for now.
This may need further investigation.
The only typed import is import { Filesystem } from 'packemon'
. The same applies to type-only imports. Just Filesystem.
Node's REPL indicates packemon exports the following.
 hce.shared-config  node
Welcome to Node.js v22.2.0.
Type ".help" for more information.
> let x = await import('packemon')
undefined
> x
[Module: null prototype] {
ASSETS: [
'.css', '.scss', '.sass',
'.less', '.svg', '.png',
'.jpg', '.jpeg', '.gif',
'.webp', '.ogg', '.mp3',
'.mpe', '.mpeg', '.wav',
'.mp4', '.mov', '.avi',
'.webm', '.woff', '.woff2',
'.ttf'
],
Artifact: [class Artifact],
BINARY_ASSETS: [
'.svg', '.png', '.jpg',
'.jpeg', '.gif', '.webp',
'.ogg', '.mp3', '.mpe',
'.mpeg', '.wav', '.mp4',
'.mov', '.avi', '.webm',
'.woff', '.woff2', '.ttf'
],
BROWSER_TARGETS: {
legacy: [ '>=0.10%', 'not IE 11' ],
stable: [ 'defaults', 'not IE 11' ],
current: [ '>=1%', 'not dead' ],
experimental: [ 'last 2 chrome versions', 'last 2 firefox versions' ]
},
BaseCommand: [class BaseCommand extends Command] {
options: {
cwd: [Object],
debug: [Object],
formats: [Object],
loadConfigs: [Object],
platforms: [Object],
quiet: [Object],
skipPrivate: [Object]
},
hasRegisteredOptions: 'BaseCommand'
},
BuildCommand: [class BuildCommand extends BaseCommand] {
options: {
addEngines: [Object],
addExports: [Object],
addFiles: [Object],
concurrency: [Object],
declaration: [Object],
timeout: [Object],
stamp: [Object]
},
hasRegisteredOptions: 'BuildCommand',
path: 'build',
description: 'Build a standardized package for distribution'
},
BuildWorkspaceCommand: [class BuildWorkspaceCommand extends BuildCommand] {
options: { filter: [Object] },
hasRegisteredOptions: 'BuildWorkspaceCommand',
path: 'build-workspace',
description: 'Build all packages across the workspace'
},
CleanCommand: [class CleanCommand extends BaseCommand] {
path: 'clean',
description: 'Clean build artifacts from a package'
},
DEFAULT_FORMATS: { browser: 'esm', electron: 'esm', native: 'esm', node: 'mjs' },
DEFAULT_INPUT: 'src/index.ts',
DEFAULT_PLATFORM: 'browser',
DEFAULT_SUPPORT: 'stable',
ELECTRON_TARGETS: {
legacy: '11.0.0',
stable: '16.0.0',
current: '21.0.0',
experimental: '26.0.0'
},
EXCLUDE: [
'**/node_modules/**',
'**/tests/**',
'**/__fixtures__/**',
'**/__mocks__/**',
'**/__tests__/**',
'**/*.(config|test|spec).*',
'**/*-(test|spec).*'
],
EXCLUDE_RUST: [
'node_modules',
'tests',
'__fixtures__',
'__mocks__',
'__tests__',
'\\.(config|test|spec)\\.[a-z]+$',
'\\.(test|spec)\\.[a-z]+$'
],
EXTENSIONS: [
'.ts', '.tsx',
'.cts', '.mts',
'.js', '.jsx',
'.cjs', '.mjs'
],
FORMATS: [ 'lib', 'esm', 'umd', 'mjs', 'cjs' ],
FORMATS_BROWSER: [ 'lib', 'esm', 'umd' ],
FORMATS_ELECTRON: [ 'lib', 'esm' ],
FORMATS_NATIVE: [ 'lib', 'esm' ],
FORMATS_NODE: [ 'lib', 'mjs', 'cjs' ],
FilesCommand: [class FilesCommand extends BaseCommand] {
options: { format: [Object] },
hasRegisteredOptions: 'FilesCommand',
path: 'files',
description: 'List all files that will be distributed within a package'
},
InitCommand: [class InitCommand extends BaseCommand] {
options: { force: [Object] },
hasRegisteredOptions: 'InitCommand',
path: 'init',
description: 'Initialize and configure a package for Packemon'
},
NATIVE_TARGETS: {
legacy: 'iOS 14',
stable: 'iOS 15',
current: 'iOS 16',
experimental: 'iOS 17'
},
NODE_SUPPORTED_VERSIONS: {
legacy: '16.12.0',
stable: '18.12.0',
current: '20.10.0',
experimental: '21.6.0'
},
NPM_SUPPORTED_VERSIONS: {
legacy: '8.1.0',
stable: '8.19.0',
current: '10.0.0',
experimental: '10.4.0'
},
PLATFORMS: [ 'native', 'electron', 'node', 'browser' ],
PackCommand: [class PackCommand extends BuildCommand] {
path: 'pack',
description: 'Clean, build, and validate a package for distribution'
},
PackWorkspaceCommand: [class PackWorkspaceCommand extends BuildWorkspaceCommand] {
path: 'pack-workspace',
description: 'Clean, build, and validate all packages across the workspace'
},
Package: [class Package],
PackageValidator: [class PackageValidator] {
entryPoints: [
'main', 'module',
'browser', 'types',
'typings', 'bin',
'man'
]
},
Packemon: [class Packemon],
STATE_COLORS: { pending: 'muted', passed: 'success', failed: 'failure' },
SUPPORTS: [ 'legacy', 'stable', 'current', 'experimental' ],
SUPPORT_PRIORITY: { legacy: 0, stable: 1, current: 2, experimental: 3 },
SUPPORT_TO_ESM_SPEC: {
legacy: 'es2019',
stable: 'es2020',
current: 'es2021',
experimental: 'es2022'
},
ScaffoldCommand: [class ScaffoldCommand extends Command] {
options: {
force: [Object],
packageManager: [Object],
packagesFolder: [Object],
skipInstall: [Object],
template: [Object]
},
hasRegisteredOptions: 'ScaffoldCommand',
params: [ [Object] ],
path: 'scaffold',
description: 'Scaffold projects and packages with ease'
},
TEXT_ASSETS: [ '.css', '.scss', '.sass', '.less' ],
ValidateCommand: [class ValidateCommand extends BaseCommand] {
options: {
deps: [Object],
engines: [Object],
entries: [Object],
license: [Object],
links: [Object],
meta: [Object],
people: [Object],
repo: [Object]
},
hasRegisteredOptions: 'ValidateCommand',
path: 'validate',
description: 'Validate package metadata and configuration'
},
WatchCommand: [class WatchCommand extends BaseCommand] {
options: { debounce: [Object], poll: [Object] },
hasRegisteredOptions: 'WatchCommand',
path: 'watch',
description: 'Watch local files for changes and rebuild'
},
getBabelInputConfig: [Function: getBabelInputConfig],
getBabelOutputConfig: [Function: getBabelOutputConfig],
getRollupConfig: [AsyncFunction: getRollupConfig],
getRollupExternals: [Function: getRollupExternals],
getRollupOutputConfig: [Function: getRollupOutputConfig],
getSwcInputConfig: [Function: getSwcInputConfig],
getSwcOutputConfig: [Function: getSwcOutputConfig]
}
@BinToss I think I need export type * from './types';
instead of export * from './types';
. But that seems... weird.
None of Packemon's Types are visible to other packages. Release 4.0.1 does not include declaration files. Because Types.ts is a glorified declarations file, its MJS output has no code and its sourcemap is broken.
{"version":3,"file":"types.mjs","sources":[],"sourcesContent":null,"names":[],"mappings":""}
Consequently,
import type { ConfigFile } from 'packemon';
(as demonstrated at https://packemon.dev/docs/advanced/#customizing-babel-swc-and-rollup:~:text=TypeScript,JavaScript) is invalid.Types can be explicitly imported via the relative path of
src/Types.ts
, but this can result in error TS1484 when TS is configured withcompilerOptions.verbatimModuleSyntax
. This issue is monitored at #249.