Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

fix: Allows naming of outputs individually#896

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
rschristian wants to merge3 commits intomaster
base:master
Choose a base branch
Loading
fromfix/output-naming

Conversation

rschristian
Copy link
Collaborator

@rschristianrschristian commentedSep 15, 2021
edited
Loading

Summary

Closes#884 and#825

Each output can be individually given output paths now, there's no sharing of names/paths. This removes an over reliance upon"main" to provide output paths for every other format.

There's no longer a guarantee of all output being in the same directory: based on the file paths, different formats can be output in different locations.

The--output flag is still functional, but only covers formats that are not provided an explicit path in thepackage.json. For example, if we're missing"module" but still outputting ESM, it will be output at<--output>/<pkg-name>.esm.{js/mjs}

For output formats that are not given an explicit path/name, they default to the package name. I think this orindex are equally valid, but this a) matches our examples in the ReadMe (if we have an example module named "foo", the output tends to befoo.js,foo.esm.js, etc.) and b) real world usage. People tend to prefer naming output than keeping it asindex from what I've seen, but YMMV.

Edit: Both#825 and#938 bring up the filename specified with"types" not being acknowledged and I don't think it's something we can support. TSC itself outputs filenames as-is, there's no easy way (besides a post-build script) to have it instead output an arbitrary name for the entry file.rpt2 forgoes the Rollup process anyhow under certain circumstances and uses TS to write directly to the filesystem, so we don't necessarily have a good way of altering that post-build ourselves I don't think.

@changeset-bot
Copy link

changeset-botbot commentedSep 15, 2021
edited
Loading

🦋 Changeset detected

Latest commit:8aaf60f

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
NameType
microbundleMinor

Not sure what this means?Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Comment on lines -144 to +138
? blue(`Build "${options.pkg.name}" to ${targetDir}:`)
? blue(`Built "${options.pkg.name}":`)
Copy link
CollaboratorAuthor

@rschristianrschristianMar 28, 2022
edited
Loading

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

targetDir is a bit unknowable now (each output format could theoretically have a different output directory, if the user so desired), so it's been removed.

@@ -279,42 +270,45 @@ function walk(exports, includeDefault) {
function getMain({ options, entry, format }) {
const { pkg } = options;
const pkgMain = options['pkg-main'];
const pkgTypeModule = pkg.type === 'module';
let multipleEntries = options.multipleEntries;
Copy link
CollaboratorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

multipleEntries needs to act as an escape hatch to our name resolution logic to ensure no collisions.

This can be seen with Microbundle itself; when we create acli.js andmicrobundle.js, we need to ensure the assigned name ofcli does not get replaced by the"main" field ("microbundle").

@rschristianrschristian marked this pull request as ready for reviewMarch 28, 2022 21:28
mainNoExtension,
mainsByFormat.es = resolve(
(!multipleEntries &&
(pkg.module && !pkg.module.match(/src\//)
Copy link
CollaboratorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Random q: What's this match againstsrc/ about? Goes back to repo init afaict so couldn't find any context there.

This was referencedMay 16, 2022
@github-actions
Copy link
Contributor

github-actionsbot commentedJan 5, 2023
edited
Loading

Size Change: 0 B

Total Size: 65.3 kB

ℹ️View Unchanged
FilenameSize
test/fixtures/alias-external/dist/alias-external.esm.mjs85 B
test/fixtures/alias-external/dist/alias-external.js80 B
test/fixtures/alias-external/dist/alias-external.umd.js140 B
test/fixtures/alias/dist/alias-mapping.esm.mjs62 B
test/fixtures/alias/dist/alias-mapping.js62 B
test/fixtures/alias/dist/alias-mapping.umd.js118 B
test/fixtures/async-iife-ts/dist/async-iife-ts.esm.mjs114 B
test/fixtures/async-iife-ts/dist/async-iife-ts.js111 B
test/fixtures/async-iife-ts/dist/async-iife-ts.umd.js161 B
test/fixtures/async-iife-ts/dist/index.d.ts20 B
test/fixtures/async-ts/dist/async-ts.esm.mjs159 B
test/fixtures/async-ts/dist/async-ts.js149 B
test/fixtures/async-ts/dist/async-ts.umd.js247 B
test/fixtures/async-ts/dist/index.d.ts75 B
test/fixtures/basic-babelrc/dist/basic-babelrc.esm.mjs160 B
test/fixtures/basic-babelrc/dist/basic-babelrc.js157 B
test/fixtures/basic-babelrc/dist/basic-babelrc.umd.js198 B
test/fixtures/basic-compress-false/dist/basic-compress-false.esm.mjs302 B
test/fixtures/basic-compress-false/dist/basic-compress-false.js300 B
test/fixtures/basic-compress-false/dist/basic-compress-false.umd.js422 B
test/fixtures/basic-css/dist/basic-css.css106 B
test/fixtures/basic-css/dist/basic-css.esm.mjs143 B
test/fixtures/basic-css/dist/basic-css.js139 B
test/fixtures/basic-css/dist/basic-css.umd.js227 B
test/fixtures/basic-dashed-external/dist/basic-dashed-external.esm.mjs256 B
test/fixtures/basic-dashed-external/dist/basic-dashed-external.js312 B
test/fixtures/basic-dashed-external/dist/basic-dashed-external.umd.js395 B
test/fixtures/basic-flow/dist/basic-lib-flow.esm.mjs104 B
test/fixtures/basic-flow/dist/basic-lib-flow.js100 B
test/fixtures/basic-flow/dist/basic-lib-flow.umd.js206 B
test/fixtures/basic-json/dist/basic-json.esm.mjs128 B
test/fixtures/basic-json/dist/basic-json.js125 B
test/fixtures/basic-json/dist/basic-json.umd.js217 B
test/fixtures/basic-multi-source-css/dist/a.css97 B
test/fixtures/basic-multi-source-css/dist/a.esm.mjs135 B
test/fixtures/basic-multi-source-css/dist/a.js130 B
test/fixtures/basic-multi-source-css/dist/a.umd.js226 B
test/fixtures/basic-multi-source-css/dist/b.css96 B
test/fixtures/basic-multi-source-css/dist/b.esm.mjs135 B
test/fixtures/basic-multi-source-css/dist/b.js131 B
test/fixtures/basic-multi-source-css/dist/b.umd.js227 B
test/fixtures/basic-multi-source/dist/a.esm.mjs78 B
test/fixtures/basic-multi-source/dist/a.js73 B
test/fixtures/basic-multi-source/dist/a.umd.js133 B
test/fixtures/basic-multi-source/dist/b.esm.mjs78 B
test/fixtures/basic-multi-source/dist/b.js73 B
test/fixtures/basic-multi-source/dist/b.umd.js133 B
test/fixtures/basic-no-compress/dist/basic-no-compress.esm.mjs300 B
test/fixtures/basic-no-compress/dist/basic-no-compress.js298 B
test/fixtures/basic-no-compress/dist/basic-no-compress.umd.js422 B
test/fixtures/basic-no-pkg-main/dist/basic-no-pkg-main.js315 B
test/fixtures/basic-node-internals/dist/basic-node-internals.js232 B
test/fixtures/basic-ts/dist/basic-lib-ts.esm.mjs156 B
test/fixtures/basic-ts/dist/basic-lib-ts.js153 B
test/fixtures/basic-ts/dist/basic-lib-ts.umd.js235 B
test/fixtures/basic-ts/dist/car.d.ts117 B
test/fixtures/basic-ts/dist/index.d.ts83 B
test/fixtures/basic-tsx/dist/basic-lib-tsx.esm.mjs254 B
test/fixtures/basic-tsx/dist/basic-lib-tsx.js246 B
test/fixtures/basic-tsx/dist/basic-lib-tsx.umd.js331 B
test/fixtures/basic-tsx/dist/index.d.ts69 B
test/fixtures/basic-with-cwd/basic/dist/basic.esm.mjs224 B
test/fixtures/basic-with-cwd/basic/dist/basic.js221 B
test/fixtures/basic-with-cwd/basic/dist/basic.umd.js301 B
test/fixtures/basic/dist/basic-lib.esm.mjs227 B
test/fixtures/basic/dist/basic-lib.js224 B
test/fixtures/basic/dist/basic-lib.umd.js307 B
test/fixtures/class-decorators-ts/dist/class-decorators-ts.esm.mjs388 B
test/fixtures/class-decorators-ts/dist/class-decorators-ts.js386 B
test/fixtures/class-decorators-ts/dist/class-decorators-ts.umd.js451 B
test/fixtures/class-decorators-ts/dist/index.d.ts123 B
test/fixtures/class-properties/dist/class-properties.esm.mjs140 B
test/fixtures/class-properties/dist/class-properties.js135 B
test/fixtures/class-properties/dist/class-properties.umd.js235 B
test/fixtures/css-modules--false/dist/css-modules--false.css114 B
test/fixtures/css-modules--false/dist/css-modules--false.esm.mjs52 B
test/fixtures/css-modules--false/dist/css-modules--false.js49 B
test/fixtures/css-modules--false/dist/css-modules--false.umd.js156 B
test/fixtures/css-modules--null/dist/css-modules--null.css118 B
test/fixtures/css-modules--null/dist/css-modules--null.esm.mjs112 B
test/fixtures/css-modules--null/dist/css-modules--null.js110 B
test/fixtures/css-modules--null/dist/css-modules--null.umd.js200 B
test/fixtures/css-modules--string/dist/css-modules--string.css144 B
test/fixtures/css-modules--string/dist/css-modules--string.esm.mjs168 B
test/fixtures/css-modules--string/dist/css-modules--string.js166 B
test/fixtures/css-modules--string/dist/css-modules--string.umd.js263 B
test/fixtures/css-modules--true/dist/css-modules--true.css115 B
test/fixtures/css-modules--true/dist/css-modules--true.esm.mjs141 B
test/fixtures/css-modules--true/dist/css-modules--true.js139 B
test/fixtures/css-modules--true/dist/css-modules--true.umd.js230 B
test/fixtures/custom-babelrc/dist/custom-babelrc.esm.mjs259 B
test/fixtures/custom-babelrc/dist/custom-babelrc.js252 B
test/fixtures/custom-babelrc/dist/custom-babelrc.umd.js343 B
test/fixtures/custom-outputs-alt/dist/custom-outputs-alt.cjsmain.js233 B
test/fixtures/custom-outputs-alt/dist/custom-outputs-alt.esmodule.mjs158 B
test/fixtures/custom-outputs-alt/dist/custom-outputs-alt.jsnextmain.mjs236 B
test/fixtures/custom-outputs-alt/dist/custom-outputs-alt.unpkg.js316 B
test/fixtures/custom-outputs/dist/custom-outputs.exportsx.mjs153 B
test/fixtures/custom-outputs/dist/custom-outputs.js226 B
test/fixtures/custom-outputs/dist/custom-outputs.modulex.mjs232 B
test/fixtures/custom-outputs/dist/custom-outputs.umdx.js309 B
test/fixtures/custom-source-with-cwd/custom-source/dist/custom-src.esm.mjs227 B
test/fixtures/custom-source-with-cwd/custom-source/dist/custom-src.js224 B
test/fixtures/custom-source-with-cwd/custom-source/dist/custom-src.umd.js306 B
test/fixtures/custom-source/dist/custom-source.esm.mjs227 B
test/fixtures/custom-source/dist/custom-source.js224 B
test/fixtures/custom-source/dist/custom-source.umd.js307 B
test/fixtures/default-named/dist/default-named.esm.mjs116 B
test/fixtures/default-named/dist/default-named.js97 B
test/fixtures/default-named/dist/default-named.umd.js201 B
test/fixtures/define-expression/dist/define-expression.esm.mjs56 B
test/fixtures/define/dist/define.esm.mjs55 B
test/fixtures/define/dist/define.js55 B
test/fixtures/define/dist/define.umd.js108 B
test/fixtures/esnext-ts/dist/esnext-ts.esm.mjs1.05 kB
test/fixtures/esnext-ts/dist/esnext-ts.js1.04 kB
test/fixtures/esnext-ts/dist/esnext-ts.umd.js1.11 kB
test/fixtures/esnext-ts/dist/index.d.ts68 B
test/fixtures/inline-source-map/dist/inline-source-map.esm.mjs740 B
test/fixtures/inline-source-map/dist/inline-source-map.js739 B
test/fixtures/inline-source-map/dist/inline-source-map.umd.js827 B
test/fixtures/jsx/dist/jsx.esm.mjs267 B
test/fixtures/jsx/dist/jsx.js264 B
test/fixtures/jsx/dist/jsx.umd.js341 B
test/fixtures/macro/dist/macro-lib.esm.mjs88 B
test/fixtures/macro/dist/macro-lib.js84 B
test/fixtures/macro/dist/macro-lib.umd.js187 B
test/fixtures/mangle-json-file/dist/mangle-json-file.esm.mjs148 B
test/fixtures/mangle-json-file/dist/mangle-json-file.js143 B
test/fixtures/mangle-json-file/dist/mangle-json-file.umd.js235 B
test/fixtures/minify-config-boolean/dist/minify-config-boolean.esm.mjs161 B
test/fixtures/minify-config-boolean/dist/minify-config-boolean.js152 B
test/fixtures/minify-config-boolean/dist/minify-config-boolean.umd.js254 B
test/fixtures/minify-config/dist/minify-config.esm.mjs143 B
test/fixtures/minify-config/dist/minify-config.js137 B
test/fixtures/minify-config/dist/minify-config.umd.js226 B
test/fixtures/minify-path-config/dist/minify-path-config.esm.mjs151 B
test/fixtures/minify-path-config/dist/minify-path-config.js145 B
test/fixtures/minify-path-config/dist/minify-path-config.umd.js237 B
test/fixtures/minify-path-parent-dir-with-cwd/minify-path-parent-dir/dist/minify-path-parent-dir.esm.mjs153 B
test/fixtures/minify-path-parent-dir-with-cwd/minify-path-parent-dir/dist/minify-path-parent-dir.js149 B
test/fixtures/minify-path-parent-dir-with-cwd/minify-path-parent-dir/dist/minify-path-parent-dir.umd.js242 B
test/fixtures/modern-generators/dist/modern-generators.esm.mjs282 B
test/fixtures/modern-generators/dist/modern-generators.js279 B
test/fixtures/modern-generators/dist/modern-generators.modern.mjs159 B
test/fixtures/modern-generators/dist/modern-generators.umd.js358 B
test/fixtures/modern/dist/modern-lib.modern.mjs152 B
test/fixtures/name-custom-amd/dist/name-custom-amd.esm.mjs230 B
test/fixtures/name-custom-amd/dist/name-custom-amd.js226 B
test/fixtures/name-custom-amd/dist/name-custom-amd.umd.js312 B
test/fixtures/name-custom-cli/dist/name-custom.esm.mjs227 B
test/fixtures/name-custom-cli/dist/name-custom.js224 B
test/fixtures/name-custom-cli/dist/name-custom.umd.js311 B
test/fixtures/no-pkg-name/dist/no-pkg-name.esm.mjs229 B
test/fixtures/no-pkg-name/dist/no-pkg-name.js225 B
test/fixtures/no-pkg-name/dist/no-pkg-name.umd.js311 B
test/fixtures/no-pkg/dist/no-pkg.esm.mjs225 B
test/fixtures/no-pkg/dist/no-pkg.js222 B
test/fixtures/no-pkg/dist/no-pkg.umd.js303 B
test/fixtures/optional-chaining-ts/dist/index.d.ts107 B
test/fixtures/optional-chaining-ts/dist/optional-chaining-ts.esm.mjs154 B
test/fixtures/optional-chaining-ts/dist/optional-chaining-ts.js148 B
test/fixtures/optional-chaining-ts/dist/optional-chaining-ts.umd.js247 B
test/fixtures/parameters-rest-closure/dist/parameters-rest-closure.esm.mjs202 B
test/fixtures/parameters-rest-closure/dist/parameters-rest-closure.js191 B
test/fixtures/parameters-rest-closure/dist/parameters-rest-closure.umd.js283 B
test/fixtures/pretty/dist/pretty.esm.mjs6.39 kB
test/fixtures/pretty/dist/pretty.js6.37 kB
test/fixtures/pretty/dist/pretty.umd.js6.5 kB
test/fixtures/publish-config/dist/bar.js87 B
test/fixtures/publish-config/dist/foo.d.ts60 B
test/fixtures/pure/dist/pure.esm.mjs108 B
test/fixtures/pure/dist/pure.js98 B
test/fixtures/pure/dist/pure.umd.js197 B
test/fixtures/raw/dist/raw.esm.mjs1.43 kB
test/fixtures/raw/dist/raw.js1.42 kB
test/fixtures/raw/dist/raw.umd.js1.53 kB
test/fixtures/shebang/dist/shebang.esm.mjs125 B
test/fixtures/shebang/dist/shebang.js118 B
test/fixtures/shebang/dist/shebang.umd.js216 B
test/fixtures/terser-annotations/dist/terser-annotations.esm.mjs179 B
test/fixtures/terser-annotations/dist/terser-annotations.js171 B
test/fixtures/terser-annotations/dist/terser-annotations.umd.js258 B
test/fixtures/ts-custom-declaration/dist/index.esm.mjs100 B
test/fixtures/ts-custom-declaration/dist/index.js89 B
test/fixtures/ts-custom-declaration/dist/index.umd.js206 B
test/fixtures/ts-declaration/dist/index.esm.mjs100 B
test/fixtures/ts-declaration/dist/index.js89 B
test/fixtures/ts-declaration/dist/index.umd.js202 B
test/fixtures/ts-jsx/dist/index.d.ts52 B
test/fixtures/ts-jsx/dist/ts-jsx.esm.mjs164 B
test/fixtures/ts-jsx/dist/ts-jsx.js159 B
test/fixtures/ts-jsx/dist/ts-jsx.umd.js252 B
test/fixtures/ts-mixed-exports/dist/car.d.ts117 B
test/fixtures/ts-mixed-exports/dist/index.d.ts89 B
test/fixtures/ts-mixed-exports/dist/ts-mixed-exports.esm.mjs168 B
test/fixtures/ts-mixed-exports/dist/ts-mixed-exports.js159 B
test/fixtures/ts-mixed-exports/dist/ts-mixed-exports.umd.js261 B
test/fixtures/ts-module/dist/foo.d.ts60 B
test/fixtures/ts-module/dist/index.d.ts63 B
test/fixtures/ts-module/dist/ts-module.esm.mjs108 B
test/fixtures/ts-module/dist/ts-module.js97 B
test/fixtures/ts-module/dist/ts-module.umd.js197 B
test/fixtures/visualizer/dist/visualizer.esm.mjs119 B
test/fixtures/visualizer/dist/visualizer.js177 B
test/fixtures/visualizer/dist/visualizer.umd.js260 B
test/fixtures/worker-loader/dist/worker-35b22e56.js125 B
test/fixtures/worker-loader/dist/worker-7e1b9921.js107 B
test/fixtures/worker-loader/dist/worker-loader.esm.mjs180 B
test/fixtures/worker-loader/dist/worker-loader.modern.mjs174 B

compressed-size-action

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers
No reviews
Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

Bug: Shouldn't fall back to pkg name in the absence of output flag & pkg main Not generating correct names for different output formats
1 participant
@rschristian

[8]ページ先頭

©2009-2025 Movatter.jp