Skip to content

Latest commit

Β 

History

History
735 lines (400 loc) Β· 44.1 KB

CHANGELOG.md

File metadata and controls

735 lines (400 loc) Β· 44.1 KB

preconstruct

2.1.8

Patch Changes

2.1.7

Patch Changes

  • 3f202fd Thanks @mitchellhamilton! - Imports to @babel/runtime/helpers/esm/* will now be rewritten to @babel/runtime/helpers/* for CommonJS outputs. This fixes the CommonJS output in case you have ["@babel/plugin-transform-runtime", { "useESModules": true }]) in your Babel config.

2.1.6

Patch Changes

2.1.5

Patch Changes

  • ad15ffa Thanks @mitchellhamilton! - Fixed resolving typescript package when using Yarn PnP and installing typescript at the root of a project

2.1.4

Patch Changes

2.1.3

Patch Changes

2.1.2

Patch Changes

  • ce31841 #411 Thanks @mitchellhamilton! - Fixed generating declaration maps with versions of TypeScript 4.3 and above.

    Errors are now also emitted when TypeScript fails to generate declarations because it needs to reference a type that isn't exported. Previously Preconstruct silently generated a broken declaration file when encountering inputs like the one shown below where TypeScript needs to be able to name the type X when generating the d.ts file for index.ts but it isn't exported, now it will emit an error instead. To fix the error, you need to export the type.

    // @filename: index.ts
    import { getX } from "./x";
    
    export const x = getX();
    
    // @filename: x.ts
    type X = {
      x?: X;
    };
    
    export const getX = (): X => ({});

    Note that Preconstruct still does not run TypeScript's type checking, you should still do that in addition to running Preconstruct, Preconstruct will only emit these specific errors.

2.1.1

Patch Changes

  • adcca78 Thanks @mitchellhamilton! - Fixed issues around ERR_PACKAGE_PATH_NOT_EXPORTED errors when resolving the location of dependencies' package.jsons with UMD builds

2.1.0

Minor Changes

  • f798f04 #393 Thanks @with-heart! - Added support for the tsconfig.declarationMap option. preconstruct now outputs both d.ts and d.ts.map files to dist/declarations/src when the option is enabled.

2.0.7

Patch Changes

  • eee1b6e #383 Thanks @mitchellhamilton! - Add keepDynamicImportAsDynamicImportInCommonJS experimental flag to allow importing Node ESM-only packages in Preconstruct packages. This can be used to ship a package that can be both imported and required and has a dependency that doesn't have a CommonJS distribution.

    Note that import() is asynchronous so it won't be possible to get access to such ESM-only dependency synchronously.

2.0.6

Patch Changes

  • d1feb8e #376 Thanks @Andarist! - Fixed the watch command not clearing dev links of additional entrypoints correctly and creating an infinite loop because of this.

2.0.5

Patch Changes

2.0.4

Patch Changes

  • 87e8713 #295 Thanks @Andarist! - Fixed destination paths of generated "local dependency" .d.ts files (for files other than src/index.ts) in TypeScript projects on Windows.

2.0.3

Patch Changes

  • a41034d #366 Thanks @Andarist! - Fixed destination paths of generated .d.ts files in TypeScript projects on Windows.

2.0.2

Patch Changes

  • 1451fc4 Thanks @mitchellhamilton! - Fix UMD builds where files contain typeof window/document and process.env.NODE_ENV
  • e3b4196 #358 Thanks @mitchellhamilton! - Improvements to Babel helper generation so that @babel/runtime(and the core-js versions) is automatically used when it is a dependency even without @babel/plugin-transform-runtime including using all of the available helpers in the version of @babel/runtime that is specified as a dependency(without Preconstruct, unless you specify the version of @babel/runtime that you use in @babel/plugin-transform-runtime, Babel helpers that aren't available in the oldest version of @babel/runtime will be inlined rather than imported from @babel/runtime).
  • fe57d4c Thanks @mitchellhamilton! - Improve TypeScript declaration generation performance by only creating a single program per TS project rather than one per package

2.0.1

Patch Changes

2.0.0

Major Changes

  • 9ac1df4 Thanks @mitchellhamilton! - Change the way entrypoints are configured. Instead of the entrypoints option referring to the entrypoint directories, they new refer to entrypoint source files. They are resolved relative to the src directory of the package. To get the entrypoint directory from a source file, the extension is removed from the path relative to the src directory and if the last part is index, the index part is removed. For example, an entrypoint of something.js would create an entrypoint at pkg-name/something and another/index.js would create an entrypoint at pkg-name/another.

    preconstruct fix will also now automatically create the entrypoint package.jsons because it already knows where the source file is.

    For example, a package that looks like the following in @preconstruct/cli@1

    package.json

    {
      "name": "pkg",
      "main": "dist/pkg.cjs.js",
      "preconstruct": {
        "entrypoints": [".", "other"]
      }
    }

    src/index.js

    export const something = true;

    src/other.js

    export const other = true;

    other/package.json

    {
      "main": "dist/pkg.cjs.js",
      "preconstruct": {
        "source": "../src/other.js"
      }
    }

    Would need the following changes to work in @preconstruct/cli@2

    package.json

     {
       "name": "pkg",
       "main": "dist/pkg.cjs.js",
       "preconstruct": {
    -    "entrypoints": [".", "other"]
    +    "entrypoints": ["index.js", "other.js"]
       }
     }

    other/package.json

     {
       "main": "dist/pkg.cjs.js",
    -  "preconstruct": {
    -    "source": "../src/other.js"
    -  }
     }
  • 9ac1df4 Thanks @mitchellhamilton! - Change the way that process.env.NODE_ENV is replaced in the production CJS bundle to search for process.env.NODE_ENV in the AST and replace it rather than using Terser to replace it and also skip running Terser on the production CJS bundle and instead rely on Rollup's dead code elimination to improve build performance. It's extremely unlikely that this will break anything but this is being made in a major release just in case it does.
  • 9ac1df4 Thanks @mitchellhamilton! - Change default dist filename strategy to include the scope and entrypoint path. For example, with an entrypoint accessible at @scope/pkg/entrypoint, the CJS dist filename would be scope-pkg-entrypoint.cjs.js. If you'd like to use the old dist filenames, you can set "distFilenameStrategy": "unscoped-package-name" in your root Preconstruct config.
  • dd0f041 Thanks @mitchellhamilton! - Use fast-glob directly instead of globby. This shouldn't break anything but because using fast-glob directly instead of globby may have subtly different behaviour, this is being done in a major version.

Patch Changes

  • 027e44d Thanks @mitchellhamilton! - Remove the useSourceInsteadOfGeneratingTSDeclarations and useTSMorphToGenerateTSDeclarations experimental flags as the TypeScript declaration generator no longer has the issues that these experimental flags tried to solve
  • 20902dc Thanks @mitchellhamilton! - Use symlinks instead of CJS re-export files for "module" and "browser" field when using preconstruct dev.

1.2.1

Patch Changes

  • 620e71f #344 Thanks @mitchellhamilton! - Make preconstruct fix automatically create entrypoint package.jsons rather than asking if it should create them with the new entrypoints experimental flag
  • 620e71f #344 Thanks @mitchellhamilton! - Rename only-unscoped-package-name to unscoped-package-name in the distFilenameStrategy option(which is only enabled when the experimental newDistFilenames flag is enabled)

1.2.0

Minor Changes

  • 3c031da #343 Thanks @Andarist! - Respect package.json#browser when bundling dependencies for the UMD build.

Patch Changes

  • a198073 #340 Thanks @Andarist! - Allow to build UMD files for packages having dependencies with top-level this in ESM files. This can often happen if a dependency package is transpiled down to ES5 using TypeScript.

1.1.34

Patch Changes

1.1.33

Patch Changes

  • cef98e9 Thanks @mitchellhamilton! - Revert change from globby to fast-glob because fast-glob doesn't directly support negations

1.1.32

Patch Changes

1.1.31

Patch Changes

  • b79bb61 Thanks @mitchellhamilton! - Skip unnecessary repeated module resolution when doing a build (this won't make a very noticable difference for projects with a small amount of packages and entrypoints but will for projects with a large amount of packages and entrypoint)
  • 4e0d249 Thanks @mitchellhamilton! - Revert change in @preconstruct/cli@1.1.30 that skips unregistering the require hook in the code generated by preconstruct dev because not unregistering the hook caused some issues when using Preconstruct to build a Babel plugin.
  • b79bb61 Thanks @mitchellhamilton! - Only generate the Babel helpers that are used and not imported from @babel/runtime along with only generating and parsing them once rather than per package (note that unused helpers were already removed from the bundles, this is just a performance improvement when doing a build)

1.1.30

Patch Changes

  • 47515cd Thanks @mitchellhamilton! - Validate that the root dist directory of a package is included in the published files since common chunks may be written to it
  • cfda1c6 Thanks @mitchellhamilton! - Fix the error message shown when an entrypoint in a package has a given build type and another doesn't
  • cfe7d95 Thanks @mitchellhamilton! - Add no-op file to @preconstruct/hook that will be imported by bundlers instead of the real require hook so that the preconstruct dev output will work in bundlers without a module build or bundler config changes(including for React Native's bundler, Metro)
  • 9a64c4e Thanks @mitchellhamilton! - Cache Acorn parse step so that modules are only parsed a single time with Acorn rather than a number of times equal to the number of build types for a given package

1.1.29

Patch Changes

1.1.28

Patch Changes

  • 86d8d3d #322 Thanks @mitchellhamilton! - Deduplicate Babel helpers when not using @babel/plugin-transform-runtime(note that we still recommend using @babel/plugin-transform-runtime, this is just stopping the duplication if you choose not to use it)
  • 3b3cacb Thanks @mitchellhamilton! - Disable usage of worker processes when running on CI to improve performance(Emotion's preconstruct build on CircleCI went from ~2 minutes to ~10 seconds when disabling the worker)

1.1.27

Patch Changes

  • f4e9954 Thanks @mitchellhamilton! - Stop memoizing creation of TS programs for declaration generation when the tsconfig is in the package directory to allow garbage collection and prevent out of memory errors (Note that having a tsconfig per package will still be slower than having one at the root of the project since TS will be doing unnecessary repeated work)

1.1.26

Patch Changes

1.1.25

Patch Changes

  • 6b3f95e Thanks @mitchellhamilton! - Fix bug in reading of TS config resulting in wrong type definitions being generated in some cases. This should remove the need for the experimental useTSMorphToGenerateTSDeclarations and useSourceInsteadOfGeneratingTSDeclarations flags.

1.1.24

Patch Changes

  • 6727d9b Thanks @mitchellhamilton! - Add logCompiledFiles experimental flag for logging when files are compiled with Babel

1.1.23

Patch Changes

  • d56018d Thanks @mitchellhamilton! - Skip double removing of package dist directory to attempt to fix EINVAL errors on build

1.1.22

Patch Changes

  • 5ad1c73 Thanks @mitchellhamilton! - Correctly only compile files within the package directory in the require hook for preconstruct dev

  • Updated dependencies [5ad1c73]:

    • @preconstruct/hook@0.3.0

1.1.21

Patch Changes

  • 286d8fb Thanks @mitchellhamilton! - Make check for default exports more reliable for preconstruct dev's .d.ts redirect file generation
  • b8d1906 Thanks @mitchellhamilton! - Only compile files within the package directory in the require hook for preconstruct dev

  • Updated dependencies [b8d1906]:

    • @preconstruct/hook@0.2.0

1.1.20

Patch Changes

  • a723556 Thanks @mitchellhamilton! - Fix prompt for creating entrypoint package.jsons showing every entrypoint as the package name when using newEntrypoints experimental flag

1.1.19

Patch Changes

1.1.18

Patch Changes

  • e3a5c0c Thanks @mitchellhamilton! - Skip parsing modules with Babel to determine if they have default exports or not if we're sure they don't based on a regex when running preconstruct dev

1.1.17

Patch Changes

  • 933d831 Thanks @mitchellhamilton! - Fix the ts-morph declaration generator generating files outside of the package's directory

1.1.16

Patch Changes

1.1.15

Patch Changes

1.1.14

Patch Changes

  • 0b1c19c Thanks @mitchellhamilton! - Add experimental useSourceInsteadOfGeneratingTSDeclarations flag. This flag should not be used and is intended to be a workaround for some TypeScript declaration bugs.

1.1.13

Patch Changes

  • 8e5c29d #281 Thanks @mitchellhamilton! - Exclude package directories without package.jsons rather than prompting to delete them, this aligns with the behaviour of package managers.

1.1.12

Patch Changes

1.1.11

Patch Changes

1.1.10

Patch Changes

  • 6698d62 #275 Thanks @mitchellhamilton! - Add experimental new entrypoints feature flag (note that this should not be used and will break in patch versions)

1.1.9

Patch Changes

1.1.8

Patch Changes

  • 3292d97 #264 Thanks @NateRadebaugh! - Fix type import file paths when running preconstruct dev to point to properly escaped paths.

1.1.7

Patch Changes

1.1.6

Patch Changes

  • 5808f26 #258 Thanks @Andarist! - Fixed issue with temporarily created files (during validation) not being cleaned up correctly on validation error.

1.1.5

Patch Changes

1.1.4

Patch Changes

  • e50769a #239 Thanks @mrmartineau - Improve error message when attempting to create a TypeScript declaration file for a non-TypeScript file

  • fd875bb Thanks @mitchellhamilton! - Update npm-packlist to fix bug where npm-normalize-package-bin wasn't specified in the dependencies of npm-packlist

1.1.3

Patch Changes

1.1.2

Patch Changes

1.1.1

Patch Changes

  • c1cfc05 #226 Thanks @mitchellhamilton! - Fixed global prompt never showing up and get each global lazily so that peerDependencies which are never imported are not required to have a global

1.1.0

Minor Changes

  • b2e1118 #224 Thanks @Andarist! - Rewrite references to @babel/runtime helpers when they are externalized in ESM builds.

1.0.2

Patch Changes

1.0.1

Patch Changes

  • 887349e Thanks @mitchellhamilton! - Replace rollup-plugin-alias with @rollup/plugin-alias and rollup-plugin-replace with @rollup/plugin-replace

1.0.0

Major Changes

Minor Changes

  • 0ac7b7f Thanks @mitchellhamilton! - Stop prompting to create browser build because people often don't want it/it isn't useful for most cases. Note that support for the field hasn't been removed, you can still add the field manually

Patch Changes

0.3.2

Patch Changes

  • 21bbc08 #205 Thanks @Vultraz! - Fixed dist file check failing on Windows due to path separator mismatch

0.3.1

Patch Changes

0.3.0

Minor Changes

  • f02cce5 #163 Thanks @mitchellhamilton! - Remove automatic inclusion of @babel/plugin-transform-runtime.

    Preconstruct no longer automatically includes @babel/plugin-transform-runtime to reduce confusion where code works when built with Preconstruct but fails if built using another tool which directly uses a project's Babel config. You should include @babel/plugin-transform-runtime in your Babel config unless it is already included.

    {
      "plugins": ["@babel/plugin-transform-runtime"]
    }

Patch Changes

0.2.0

Minor Changes

0.1.3

Patch Changes

  • aefeb4f Thanks @mitchellhamilton! - Use TypeScript internally

  • Updated dependencies [aefeb4f]:

    • @preconstruct/hook@undefined

0.1.2

Patch Changes

0.1.1

Patch Changes

  • f14c39e Thanks @mitchellhamilton! - Add a comment to the commonjs file for preconstruct dev explaining what it does
  • 7c278d2 Thanks @mitchellhamilton! - Change redirect for flow in preconstruct dev to a file with export * because symlinks seem to be breaking

0.1.0

Minor Changes

  • 2f50306 #88 Thanks @mitchellhamilton! - Remove react-native field support(note: this doesn't mean you can't build libraries for react native with preconstruct, it just means preconstruct won't make a special build for react native)

0.0.90

Patch Changes

0.0.89

Patch Changes

  • b147abd - Fix TypeScript declaration generation in some cases with resolving

0.0.88

Patch Changes

  • ba73086 - Fix typescript declaration generation in some cases

0.0.87

Patch Changes

  • 19d36a4 - Build preconstruct with preconstruct
  • 9c36a88 - Allow empty bundles

0.0.86

Patch Changes

0.0.85

Patch Changes

0.0.84

Patch Changes

0.0.83

Patch Changes

0.0.82

Patch Changes

  • 1e851be #69 Thanks @mitchellhamilton! - Switch symlinks in preconstruct dev to CommonJS re-exports to avoid issues when using Node's --preserve-symlinks option.

0.0.81

Patch Changes

  • 99f1549 - Remove dependency on some emotion packages that caused preconstruct to break when building emotion

0.0.80

Patch Changes

  • ccc162f #64 Thanks @mitchellhamilton! - Refactor logging and include package name in uncaught build errors
  • 9cab2d1 #65 Thanks @mitchellhamilton! - Replace internal Babel runtime helpers CJS transform from an AST transform to regex
  • df58a43 #68 Thanks @mitchellhamilton! - Add validation to disallow transitive peerDependencies where the peerDep is not specified in the direct parent
  • ff49a6d #66 Thanks @mitchellhamilton! - Create rollup externals from dependencies and peerDependencies without checking nested deps. If you get an error saying that a dependency is missing when it previously worked, you should add that package as a dependency or peerDependency.

0.0.79

Patch Changes

  • 525137a - Remove erroneous console.log

0.0.78

  • Updated dependencies [9efd990]:
    • @preconstruct/hook@0.0.3

0.0.77

  • Updated dependencies [aea0c36]:
    • @preconstruct/hook@0.0.2

0.0.76

Patch Changes

  • ce8909b - Add file redirect instead of symlink redirect for TS in dev

0.0.75

Patch Changes

  • 7bade91 - Improve TypeScript declaration generation performance

0.0.74

Patch Changes

  • f79b195 - Change import path generated in TypeScript declarations

0.0.73

Patch Changes

  • 2e01590 #60 Thanks @mitchellhamilton! - Stop adding a postinstall script with preconstruct dev in preconstruct init. This was causing problems with single package repos so it's being removing for now.

0.0.72

Patch Changes

  • cd0979f - Change TS declaration filename

0.0.71

Patch Changes

0.0.70

Patch Changes

0.0.69

Patch Changes

  • 802fec0 #54 Thanks @mitchellhamilton! - Replace flow file that re-exports source contents with a symlink in dev command. This fixes the problem where if you added or removed the default export of an entrypoint source file, you would have to run preconstruct dev again.
  • b351218 #55 Thanks @mitchellhamilton! - Add support for TypeScript resolving types with dev command

0.0.68

Patch Changes

  • 9022265 - Set fields in a better order

0.0.67

Patch Changes

  • b22d4e1 - Fix init command prompting incorrectly for UMD builds
  • 0a9b9d7 - Remove aliases export, this is now replaced with the dev command

0.0.66

Patch Changes