Skip to content
Compare
Choose a tag to compare
@github-actions github-actions released this 13 Apr 16:10
· 544 commits to master since this release
db40fe9

Major Changes

  • #73 b90c724 Thanks @tommy351! - Add support for browser. Several APIs were introduced in this release.

    • Loader interface
    • createEnvironment function
    • createAsyncEnvironment function
    • createNodeCJSEnvironment function
    • createNodeESMEnvironment function
    • createSyncEnvironment function
    • createSyncLoaderReducers function
    • createAsyncLoaderReducers function

    The following example shows how to use this package in browsers.

    import env, { createLoaderReducers } from "@kosko/env";
    
    env.setReducers(reducers => [
      ...reducers,
      ...createAsyncLoaderReducers({
        global: () =>
          import("./environments/dev/index.js").then(mod => mod.default),
        component: name =>
          import(`./environments/dev/${name}.js`).then(mod => mod.default)
      })
    ]);

    BREAKING CHANGES: The following APIs were changed in this release.

    • Environment class → Environment interface
    • SyncEnvironment class → createNodeCJSEnvironment function
    • AsyncEnvironment class → createNodeESMEnvironment function

    You don't have to change anything, unless you initialize these classes manually.

    // Before
    const { Environment } = require("@kosko/env");
    const env = new Environment(process.cwd());
    
    // After
    const { createNodeCJSEnvironment } = require("@kosko/env");
    const env = createNodeCJSEnvironment({ cwd: process.cwd() });

Patch Changes