Skip to content

assets v0.6.0

Choose a tag to compare

@github-actions github-actions released this 31 Aug 18:59
· 2 commits to main since this release
1e50c51

Minor Changes

  • BREAKING CHANGE: In createAssetServer, replace the fileMap option with optional directory-based mounts. Mounts recursively preserve the path beneath each public and filesystem root, keeping module URLs aligned with the filesystem hierarchy used for package resolution.

    When mounts is omitted, the asset server uses { app: 'app', npm: 'node_modules' }.

    To migrate an app whose fileMap is equivalent to the new defaults, remove the fileMap option entirely:

    // before
    createAssetServer({
      basePath: '/assets',
      fileMap: {
        '/app/*path': 'app/*path',
        '/npm/*path': 'node_modules/*path',
      },
      // ...
    })
    
    // after
    createAssetServer({
      basePath: '/assets',
      // ...
    })

    To migrate custom fileMap rules that preserve directory hierarchy, remove the trailing wildcard from both sides and rename fileMap to mounts:

    // before
    createAssetServer({
      basePath: '/assets',
      fileMap: {
        '/source/*path': 'app/*path',
        '/vendor/*path': 'node_modules/*path',
      },
      // ...
    })
    
    // after
    createAssetServer({
      basePath: '/assets',
      mounts: {
        source: 'app',
        vendor: 'node_modules',
      },
      // ...
    })
  • Add assetServer.getAssets() for listing browser-reachable files and assetServer.getAssetDetails(urlOrFile) for inspecting URL mappings, file types, access rules, and reachability status. These APIs use the asset server's configured mapping and access policy, so diagnostic results match request handling (see #11726).