⚗️Nitro provides a powerful toolchain and a runtime framework from the UnJS ecosystem to build and deploy any JavaScript server, anywhere

Overview

npm version npm downloads npm-edge version npm-edge downloads

⚗️ Nitro

Build and Deploy Universal JavaScript Servers

Why using Nitro?

Nitro provides a powerful toolchain and a runtime framework from the UnJS ecosystem to build and deploy any JavaScript server, anywhere!

🐇 Rapid development experience with hot module replacement
😌 Multi-provider deployments with a single codebase and zero-configuration
💼 Portable and compact deployments without node_modules dependency
📁 Directory structure aware to register API routes and more with zero configuration
🤏 Minimal Design to fit into any solution with minimum overhead
🚀 Code-splitting and async chunk loading for fast server startup time
👕 TypeScript fully supported
💾 Multi-driver storage and caching layer
💰 Route caching and static pre-rendering with built-in crawler
🐱 Hackable to extend almost any part of nitro using options
Auto imports for lazy folks and a tidy minimal codebase
🏛️ Best-effort compatibility for using legacy npm packages and mocking Node.js modules

Who is using Nitro?

Nuxt 3 is using Nitro as its server engine.



📖 Documentation

✍️ Changelog

🏀 Online playground



😺 Quick Start

0️⃣ Create an empty directory nitro-app

mkdir nitro-app
cd nitro-app

1️⃣ Create routes/index.ts:

export default () => 'nitro is amazing!'

2️⃣ Start development server:

npx nitropack dev

🪄 Your API is ready at http://localhost:3000/

Check .nitro/dev/index.mjs if want to know what is happening

3️⃣ You can now build your production-ready server:

npx nitropack build

4️⃣ Output is in the .output directory and ready to be deployed on almost any VPS with no dependencies. You can locally try it too:

node .output/server/index.mjs

That's it you got it! Read the documentation to learn more.


🌱 nitro is young and under development

Check 🐛 open issues for the known issues and roadmap and tell us 💡 your ideas!


License

Made with 💛 Published under MIT.

Comments
  • Serve assets with compression

    Serve assets with compression

    Environment

    • Operating System: macOS
    • Node Version: v16.14.0
    • Nitro Version: 0.2.1
    • Package Manager: [email protected]

    Reproduction

    n/a

    Describe the bug

    It would be a nice addition to nitro if there is be a possibility to change the response of static assets. Then it would also be possible to implement content encoding like brotli or gzip.

    Additional context

    There does exist a discussion in the nuxt repo. https://github.com/nuxt/framework/discussions/3472

    In addition to the discussion i already found the corresponding lines, which i changed in nuxt, in the nitro package:

    https://github.com/unjs/nitro/blob/main/src/runtime/static.ts#L68 https://github.com/unjs/nitro/blob/main/src/rollup/plugins/public-assets.ts#L44

    Logs

    No response

    Update 21.07.2022

    I wrote a module which can handle the compression https://github.com/exreplay/nuxt-compression. This is still no official way and messes with the internal nitro code but there is no need to use patches.

    enhancement 
    opened by exreplay 26
  • feat(cluster): `node-cluster` preset

    feat(cluster): `node-cluster` preset

    🔗 Linked issue

    #451

    ❓ Type of change

    • [ ] 📖 Documentation (updates to the documentation or readme)
    • [ ] 🐞 Bug fix (a non-breaking change that fixes an issue)
    • [x] 👌 Enhancement (improving an existing functionality like performance)
    • [ ] ✨ New feature (a non-breaking change that adds functionality)
    • [ ] ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

    📚 Description

    📝 Checklist

    • [x] I have linked an issue or discussion.
    • [ ] I have updated the documentation accordingly.
    opened by Mastercuber 14
  • feat: enable response type infer for API routes with params

    feat: enable response type infer for API routes with params

    🔗 Linked issue

    resolves #221, https://github.com/nuxt/framework/issues/5558

    ❓ Type of change

    • [ ] 📖 Documentation (updates to the documentation or readme)
    • [ ] 🐞 Bug fix (a non-breaking change that fixes an issue)
    • [x] 👌 Enhancement (improving an existing functionality like performance)
    • [x] ✨ New feature (a non-breaking change that adds functionality)
    • [ ] ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

    📚 Description

    Update MatchedRoutes helper type in types/fetch.ts to enable $fetch to infer response type even for routes with params, (ex: users/[useId]/posts/[postId].ts)

    This will provide better DX for a wider range of complex string requests with variables in it for requesting server routes containing params

    This would also further provide Nuxt 3's useFetch and useLazyFetch to be able to infer the response's data type as well. 😎

    Usage scenario

    assume the project contains following API file structure

    nitroTestApiFileStructure

    with each file export a default h3 eventHandler, for example:

    // routes\users\[userId].ts
    export default eventHandler(() => {
        return { username: 'David', age: 18 }
    })
    

    and use in other file as

    declare const params
    cosnt { userId, postId } = params
    
    const user = await $fetch(`/api/user/${userId}`)
    // user's type will be 
    // { 
    //    username: string; 
    //    age: number; 
    // }
    
    const post = await $fetch(`/api/user/${userId}/post/${postId}`) // param match
    // post's type will be the return type of API routes:
    //    '/api/user/:userId/post/:postId'  |  '/api/user/:userId/post/firstPost' | 
    //    '/api/user/john/post/:postId'  |   '/api/user/john/post/coffee'
    
    // support glob matching
    const johnPost= await $fetch(`/api/user/john/post/${postId}/**`) // exact match
    // johnPost's type will be the return type of API routes: '/api/user/john/post/:postId'
    
    // while if :userId is sure not matching 'john', will exclude all API with '/api/user/john/**'
    const otherUserPost = await $fetch(`/api/user/someUserId/post/${postId}`)
    // otherUserPost's type will be the return type of API routes: 
    //    '/api/user/:userId/post/:postId'   |   '/api/user/:userId/post/firstPost'
    
    const coffeePost= await $fetch(`/api/user/john/post/coffee`) // exact match
    // coffeePost's type will be the return type of API routes: '/api/user/john/post/coffee'
    
    const firstPost = await $fetch(`/api/user/${userId}/post/firstPost`) // param and partial exact match
    // firstPost's type will be the return type of API routes: '/api/user/:userId/post/firstPost'
    
    const todos = await $fetch(`/api/todos/some/deeply/nest/${dynamicString}/path`) // match globs
    // todos's type will be the return type of API routes: '/api/todos/**'
    
    const comments = await $fetch(`/api/todos/${dynamicString}/comments/foo/bar/baz`) // match globs
    // comments's type will be the return type of API routes: 
    //    '/api/todos/**'  |  '/api/todos/:todoId/comments/**:commentId'
    
    const result = await $fetch('/api/otherPath/unknown')
    // result's type will be 'unknown'
    
    

    📝 Checklist

    • [x] I have linked an issue or discussion.
    • [ ] I have updated the documentation accordingly.
    opened by didavid61202 12
  • feat: add cleavr preset

    feat: add cleavr preset

    🔗 Linked issue

    #522

    ❓ Type of change

    • [x] 📖 Documentation (updates to the documentation or readme)
    • [ ] 🐞 Bug fix (a non-breaking change that fixes an issue)
    • [x] 👌 Enhancement (improving an existing functionality like performance)
    • [ ] ✨ New feature (a non-breaking change that adds functionality)
    • [ ] ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

    📚 Description

    Add Cleavr.io (https://cleavr.io) preset for Nitro.

    Resolves #522

    📝 Checklist

    • [x] I have linked an issue or discussion.
    • [x] I have updated the documentation accordingly.
    opened by anishghimire862 10
  • fix(options):  correct `include` empty value

    fix(options): correct `include` empty value

    🔗 Linked issue

    ❓ Type of change

    • [ ] 📖 Documentation (updates to the documentation or readme)
    • [x] 🐞 Bug fix (a non-breaking change that fixes an issue)
    • [ ] 👌 Enhancement (improving an existing functionality like performance)
    • [ ] ✨ New feature (a non-breaking change that adds functionality)
    • [ ] ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

    📚 Description

    If include is omitted or has zero length, filter will return true by default. Resulted in scanning the entire directory.

    📝 Checklist

    • [ ] I have linked an issue or discussion.
    • [ ] I have updated the documentation accordingly.
    pending 
    opened by cinob 9
  • feat: include only compressible mime types

    feat: include only compressible mime types

    🔗 Linked issue

    https://github.com/nuxt/framework/discussions/9626

    ❓ Type of change

    • [ ] 📖 Documentation (updates to the documentation or readme)
    • [ ] 🐞 Bug fix (a non-breaking change that fixes an issue)
    • [x] 👌 Enhancement (improving an existing functionality like performance)
    • [ ] ✨ New feature (a non-breaking change that adds functionality)
    • [ ] ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

    📚 Description

    The code for compressPublicAssets was double-compressing all image types (including .jpg, .png, .gif, .webp, etc.) when it really should only be compressible static file types that are text-based. I updated the code to use the following list of MIME types, and also added it to the docs for compressPublicAssets:

    text/html text/css text/plain text/xml text/x-component text/javascript application/x-javascript application/javascript application/json application/manifest+json application/vnd.api+json application/xml application/xhtml+xml application/rss+xml application/atom+xml application/vnd.ms-fontobject application/x-font-ttf application/x-font-opentype application/x-font-truetype image/svg+xml image/x-icon image/vnd.microsoft.icon font/ttf font/eot font/otf font/opentype

    📝 Checklist

    • [x] I have linked an issue or discussion.
    • [x] I have updated the documentation accordingly.
    opened by nathanchase 7
  • fix(cloudflare): pass raw body instead of parsing it

    fix(cloudflare): pass raw body instead of parsing it

    🔗 Linked issue

    ❓ Type of change

    • [ ] 📖 Documentation (updates to the documentation or readme)
    • [x] 🐞 Bug fix (a non-breaking change that fixes an issue)
    • [ ] 👌 Enhancement (improving an existing functionality like performance)
    • [ ] ✨ New feature (a non-breaking change that adds functionality)
    • [ ] ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

    📚 Description

    In cases where it is necessary to read the body of the raw request, the cloudflare deploy was always parsing the body even using useRawBody. Implementations like the stripe's webhook that needs to read the raw body would break.

    📝 Checklist

    • [x] I have linked an issue or discussion.
    • [ ] I have updated the documentation accordingly.
    opened by brendonmatos 7
  • Generated package.json is not valid

    Generated package.json is not valid

    Environment

    Node: v16.15.1 Nitro: 0.5.3

    Reproduction

    Probably doesn't need a reproduction, but let me know if I need to supply a Stackblitz or GH repro

    Describe the bug

    When using the aws-lamda preset (probably goes for other ones too), the generated package.json is missing the required fields name and version, which means that deploying the code through (for example) SAM fails.

    Maybe the name and version could be grabbed from the root's package.json?

    Additional context

    No response

    Logs

    No response

    opened by TheDutchCoder 7
  • refactor: improve `esbuild.target` option handling

    refactor: improve `esbuild.target` option handling

    🔗 Linked issue

    https://github.com/nuxt/framework/issues/4771

    ❓ Type of change

    • [ ] 📖 Documentation (updates to the documentation or readme)
    • [x] 🐞 Bug fix (a non-breaking change that fixes an issue)
    • [ ] 👌 Enhancement (improving an existing functionality like performance)
    • [ ] ✨ New feature (a non-breaking change that adds functionality)
    • [ ] ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

    📚 Description

    Context: https://github.com/nuxt/framework/issues/507

    This sets esbuild target to currently minimum node version required for project, and removes the additional default set within the plugin.

    https://esbuild.github.io/api/#target

    📝 Checklist

    • [x] I have linked an issue or discussion.
    • [ ] I have updated the documentation accordingly.
    bug 
    opened by danielroe 7
  • fix(prerender): remove `baseURL` from generated file paths

    fix(prerender): remove `baseURL` from generated file paths

    🔗 Linked issue

    ❓ Type of change

    • [ ] 📖 Documentation (updates to the documentation or readme)
    • [x] 🐞 Bug fix (a non-breaking change that fixes an issue)
    • [ ] 👌 Enhancement (improving an existing functionality like performance)
    • [ ] ✨ New feature (a non-breaking change that adds functionality)
    • [ ] ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

    📚 Description

    Generating a project using custom baseURL results unwanted directory inside .output/public. For example, if you set baseURL = romi-project, you will see a romi-project directory in the generated website. https://github.com/hacknug/romi-project/tree/gh-pages

    📝 Checklist

    • [ ] I have linked an issue or discussion.
    • [ ] I have updated the documentation accordingly.
    opened by farnabaz 6
  • feat: add cloudflare-pages preset

    feat: add cloudflare-pages preset

    🔗 Linked issue

    #196

    ❓ Type of change

    • [ ] 📖 Documentation (updates to the documentation or readme)
    • [ ] 🐞 Bug fix (a non-breaking change that fixes an issue)
    • [ ] 👌 Enhancement (improving an existing functionality like performance)
    • [x] ✨ New feature (a non-breaking change that adds functionality)
    • [ ] ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

    📚 Description

    Related to discussions #110 #196, a few in nuxt/framework

    This PR intends to add a preset for Cloudflare Pages Functions - which is currently in Open Beta. Docs can be found at https://developers.cloudflare.com/pages/platform/functions/ .

    Pages Functions are based on the modules worker type, so a different deployment preset will be needed.

    update since first drafted, removed no longer relevant beta warnings

    Functions are still in beta, however Direct Upload is now available for Pages, and I fixed all the issues I could find.

    update again

    Docs have now been updated (feedback welcome), the newest version of std-env should allow for automatic detection (only via git integration).

    Have a good day.

    📝 Checklist

    • [x] I have linked an issue or discussion.
    • [x] I have updated the documentation accordingly.
    opened by DaniFoldi 6
  • docs: fix readme grammar

    docs: fix readme grammar

    🔗 Linked issue

    ❓ Type of change

    • [x] 📖 Documentation (updates to the documentation or readme)
    • [ ] 🐞 Bug fix (a non-breaking change that fixes an issue)
    • [ ] 👌 Enhancement (improving an existing functionality like performance)
    • [ ] ✨ New feature (a non-breaking change that adds functionality)
    • [ ] ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

    📚 Description

    The phrase "Why using Nitro?" is not correct grammar. Here is one example.

    📝 Checklist

    • [ ] I have linked an issue or discussion.
    • [x] I have updated the documentation accordingly.
    opened by alvarlagerlof 0
  • fix: empty imports.exclude array by default

    fix: empty imports.exclude array by default

    🔗 Linked issue

    Fixes a Nuxt related issue: https://github.com/nuxt/framework/issues/9961 I'm not sure this is the best way to fix it but this should at least allow for fully customizing that exclude array.

    ❓ Type of change

    • [ ] 📖 Documentation (updates to the documentation or readme)
    • [x] 🐞 Bug fix (a non-breaking change that fixes an issue)
    • [ ] 👌 Enhancement (improving an existing functionality like performance)
    • [ ] ✨ New feature (a non-breaking change that adds functionality)
    • [ ] ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

    📚 Description

    📝 Checklist

    • [x] I have linked an issue or discussion.
    • [ ] I have updated the documentation accordingly.
    opened by yassilah 1
  • docs: add new render deployment examples & steps

    docs: add new render deployment examples & steps

    ❓ Type of change

    • [x] 📖 Documentation (updates to the documentation or readme)
    • [ ] 🐞 Bug fix (a non-breaking change that fixes an issue)
    • [ ] 👌 Enhancement (improving an existing functionality like performance)
    • [ ] ✨ New feature (a non-breaking change that adds functionality)
    • [ ] ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

    📚 Description

    Add another option to deploy to render, called Infrastructure as Code, and add two steps and one sample code to the page. The advantage is that deployment steps can be set up in one click and error opportunities can be reduced

    📝 Checklist

    • [ ] I have linked an issue or discussion.
    • [x] I have updated the documentation accordingly.
    opened by connectshark 0
  • chore(deps): update all non-major dependencies

    chore(deps): update all non-major dependencies

    Mend Renovate

    This PR contains the following updates:

    | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | @rollup/plugin-terser (source) | ^0.2.1 -> ^0.3.0 | age | adoption | passing | confidence | | esbuild | ^0.16.14 -> ^0.16.15 | age | adoption | passing | confidence | | prettier (source) | ^2.8.1 -> ^2.8.2 | age | adoption | passing | confidence | | unimport | ^1.1.0 -> ^1.2.0 | age | adoption | passing | confidence |


    Release Notes

    rollup/plugins

    v0.3.0

    Compare Source

    2023-01-06

    Features
    evanw/esbuild

    v0.16.15

    Compare Source

    • Add format to input files in the JSON metafile data

      When --metafile is enabled, input files may now have an additional format field that indicates the export format used by this file. When present, the value will either be cjs for CommonJS-style exports or esm for ESM-style exports. This can be useful in bundle analysis.

      For example, esbuild's new Bundle Size Analyzer now uses this information to visualize whether ESM or CommonJS was used for each directory and file of source code (click on the CJS/ESM bar at the top).

      This information is helpful when trying to reduce the size of your bundle. Using the ESM variant of a dependency instead of the CommonJS variant always results in a faster and smaller bundle because it omits CommonJS wrappers, and also may result in better tree-shaking as it allows esbuild to perform tree-shaking at the statement level instead of the module level.

    • Fix a bundling edge case with dynamic import (#​2793)

      This release fixes a bug where esbuild's bundler could produce incorrect output. The problematic edge case involves the entry point importing itself using a dynamic import() expression in an imported file, like this:

      // src/a.js
      export const A = 42;
      
      // src/b.js
      export const B = async () => (await import(".")).A
      
      // src/index.js
      export * from "./a"
      export * from "./b"
      
    • Remove new type syntax from type declarations in the esbuild package (#​2798)

      Previously you needed to use TypeScript 4.3 or newer when using the esbuild package from TypeScript code due to the use of a getter in an interface in node_modules/esbuild/lib/main.d.ts. This release removes this newer syntax to allow people with versions of TypeScript as far back as TypeScript 3.5 to use this latest version of the esbuild package. Here is change that was made to esbuild's type declarations:

       export interface OutputFile {
         /** "text" as bytes */
         contents: Uint8Array;
         /** "contents" as text (changes automatically with "contents") */
      -  get text(): string;
      +  readonly text: string;
       }
      
    prettier/prettier

    v2.8.2

    Compare Source

    diff

    Don't lowercase link references (#​13155 by @​DerekNonGeneric & @​fisker)
    <!-- Input -->
    We now don't strictly follow the release notes format suggested by [Keep a Changelog].
    
    [Keep a Changelog]: https://example.com/
    
    <!-- Prettier 2.8.1 -->
    We now don't strictly follow the release notes format suggested by [Keep a Changelog].
    
    [keep a changelog]: https://example.com/
    <!--
    ^^^^^^^^^^^^^^^^^^ lowercased
    -->
    
    <!-- Prettier 2.8.2 -->
    <Same as input>
    
    Preserve self-closing tags (#​13691 by @​dcyriller)
    {{! Input }}
    <div />
    <div></div>
    <custom-component />
    <custom-component></custom-component>
    <i />
    <i></i>
    <Component />
    <Component></Component>
    
    {{! Prettier 2.8.1 }}
    <div></div>
    <div></div>
    <custom-component></custom-component>
    <custom-component></custom-component>
    <i></i>
    <i></i>
    <Component />
    <Component />
    
    {{! Prettier 2.8.2 }}
    <div />
    <div></div>
    <custom-component />
    <custom-component></custom-component>
    <i />
    <i></i>
    <Component />
    <Component />
    
    Allow custom "else if"-like blocks with block params (#​13930 by @​jamescdavis)

    #​13507 added support for custom block keywords used with else, but failed to allow block params. This updates printer-glimmer to allow block params with custom "else if"-like blocks.

    {{! Input }}
    {#when isAtWork as |work|}}
      Ship that
      {{work}}!
    {{else when isReading as |book|}}
      You can finish
      {{book}}
      eventually...
    {{else}}
      Go to bed!
    {{/when}}
    
    {{! Prettier 2.8.1 }}
    {{#when isAtWork as |work|}}
      Ship that
      {{work}}!
    {{else when isReading}}
      You can finish
      {{book}}
      eventually...
    {{else}}
      Go to bed!
    {{/when}}
    
    {{! Prettier 2.8.2 }}
    {#when isAtWork as |work|}}
      Ship that
      {{work}}!
    {{else when isReading as |book|}}
      You can finish
      {{book}}
      eventually...
    {{else}}
      Go to bed!
    {{/when}}
    
    Preserve empty lines between nested SCSS maps (#​13931 by @​jneander)
    /* Input */
    $map: (
      'one': (
         'key': 'value',
      ),
    
      'two': (
         'key': 'value',
      ),
    )
    
    /* Prettier 2.8.1 */
    $map: (
      'one': (
         'key': 'value',
      ),
      'two': (
         'key': 'value',
      ),
    )
    
    /* Prettier 2.8.2 */
    $map: (
      'one': (
         'key': 'value',
      ),
    
      'two': (
         'key': 'value',
      ),
    )
    
    Fix missing parentheses when an expression statement starts with let[ (#​14000, #​14044 by @​fisker, @​thorn0)
    // Input
    (let[0] = 2);
    
    // Prettier 2.8.1
    let[0] = 2;
    
    // Prettier 2.8.1 (second format)
    SyntaxError: Unexpected token (1:5)
    > 1 | let[0] = 2;
        |     ^
      2 |
    
    // Prettier 2.8.2
    (let)[0] = 2;
    
    Fix semicolon duplicated at the end of LESS file (#​14007 by @​mvorisek)
    // Input
    @&#8203;variable: {
      field: something;
    };
    
    // Prettier 2.8.1
    @&#8203;variable: {
      field: something;
    }; ;
    
    // Prettier 2.8.2
    @&#8203;variable: {
      field: something;
    };
    
    Fix no space after unary minus when followed by opening parenthesis in LESS (#​14008 by @​mvorisek)
    // Input
    .unary_minus_single {
      margin: -(@&#8203;a);
    }
    
    .unary_minus_multi {
      margin: 0 -(@&#8203;a);
    }
    
    .binary_minus {
      margin: 0 - (@&#8203;a);
    }
    
    // Prettier 2.8.1
    .unary_minus_single {
      margin: - (@&#8203;a);
    }
    
    .unary_minus_multi {
      margin: 0 - (@&#8203;a);
    }
    
    .binary_minus {
      margin: 0 - (@&#8203;a);
    }
    
    // Prettier 2.8.2
    .unary_minus_single {
      margin: -(@&#8203;a);
    }
    
    .unary_minus_multi {
      margin: 0 -(@&#8203;a);
    }
    
    .binary_minus {
      margin: 0 - (@&#8203;a);
    }
    
    Do not change case of property name if inside a variable declaration in LESS (#​14034 by @​mvorisek)
    // Input
    @&#8203;var: {
      preserveCase: 0;
    };
    
    // Prettier 2.8.1
    @&#8203;var: {
      preservecase: 0;
    };
    
    // Prettier 2.8.2
    @&#8203;var: {
      preserveCase: 0;
    };
    
    Fix formatting for auto-accessors with comments (#​14038 by @​fisker)
    // Input
    class A {
      @&#8203;dec()
      // comment
      accessor b;
    }
    
    // Prettier 2.8.1
    class A {
      @&#8203;dec()
      accessor // comment
      b;
    }
    
    // Prettier 2.8.1 (second format)
    class A {
      @&#8203;dec()
      accessor; // comment
      b;
    }
    
    // Prettier 2.8.2
    class A {
      @&#8203;dec()
      // comment
      accessor b;
    }
    
    Add parentheses for TSTypeQuery to improve readability (#​14042 by @​onishi-kohei)
    // Input
    a as (typeof node.children)[number]
    a as (typeof node.children)[]
    a as ((typeof node.children)[number])[]
    
    // Prettier 2.8.1
    a as typeof node.children[number];
    a as typeof node.children[];
    a as typeof node.children[number][];
    
    // Prettier 2.8.2
    a as (typeof node.children)[number];
    a as (typeof node.children)[];
    a as (typeof node.children)[number][];
    
    Fix displacing of comments in default switch case (#​14047 by @​thorn0)

    It was a regression in Prettier 2.6.0.

    // Input
    switch (state) {
      default:
        result = state; // no change
        break;
    }
    
    // Prettier 2.8.1
    switch (state) {
      default: // no change
        result = state;
        break;
    }
    
    // Prettier 2.8.2
    switch (state) {
      default:
        result = state; // no change
        break;
    }
    
    Support type annotations on auto accessors via babel-ts (#​14049 by @​sosukesuzuki)

    The bug that @babel/parser cannot parse auto accessors with type annotations has been fixed. So we now support it via babel-ts parser.

    class Foo {
      accessor prop: number;
    }
    
    Fix formatting of empty type parameters (#​14073 by @​fisker)
    // Input
    const foo: bar</* comment */> = () => baz;
    
    // Prettier 2.8.1
    Error: Comment "comment" was not printed. Please report this error!
    
    // Prettier 2.8.2
    const foo: bar</* comment */> = () => baz;
    
    Add parentheses to head of ExpressionStatement instead of the whole statement (#​14077 by @​fisker)
    // Input
    ({}).toString.call(foo) === "[object Array]"
      ? foo.forEach(iterateArray)
      : iterateObject(foo);
    
    // Prettier 2.8.1
    ({}.toString.call(foo) === "[object Array]"
      ? foo.forEach(iterateArray)
      : iterateObject(foo));
    
    // Prettier 2.8.2
    ({}).toString.call(foo.forEach) === "[object Array]"
      ? foo.forEach(iterateArray)
      : iterateObject(foo);
    
    Fix comments after directive (#​14081 by @​fisker)
    // Input
    "use strict" /* comment */;
    
    // Prettier 2.8.1 (with other js parsers except `babel`)
    Error: Comment "comment" was not printed. Please report this error!
    
    // Prettier 2.8.2
    <Same as input>
    
    Fix formatting for comments inside JSX attribute (#​14082 with by @​fisker)
    // Input
    function MyFunctionComponent() {
      <button label=/*old*/"new">button</button>
    }
    
    // Prettier 2.8.1
    Error: Comment "old" was not printed. Please report this error!
    
    // Prettier 2.8.2
    function MyFunctionComponent() {
      <button label=/*old*/ "new">button</button>;
    }
    
    Quote numeric keys for json-stringify parser (#​14083 by @​fisker)
    // Input
    {0: 'value'}
    
    // Prettier 2.8.1
    {
      0: "value"
    }
    
    // Prettier 2.8.2
    {
      "0": "value"
    }
    
    Fix removing commas from function arguments in maps (#​14089 by @​sosukesuzuki)
    /* Input */
    $foo: map-fn(
      (
        "#{prop}": inner-fn($first, $second),
      )
    );
    
    /* Prettier 2.8.1 */
    $foo: map-fn(("#{prop}": inner-fn($first $second)));
    
    /* Prettier 2.8.2 */
    $foo: map-fn(
      (
        "#{prop}": inner-fn($first, $second),
      )
    );
    
    
    Do not insert space in LESS property access (#​14103 by @​fisker)
    // Input
    a {
      color: @&#8203;colors[@&#8203;white];
    }
    
    // Prettier 2.8.1
    a {
      color: @&#8203;colors[ @&#8203;white];
    }
    
    // Prettier 2.8.2
    <Same as input>
    
    unjs/unimport

    v1.2.0

    Compare Source

    Features
    • support metadata collecting (3429ff5)

    Configuration

    📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

    🚦 Automerge: Enabled.

    Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

    👻 Immortal: This PR will be recreated if closed unmerged. Get config help if that's undesired.


    • [ ] If you want to rebase/retry this PR, check this box

    This PR has been generated by Mend Renovate. View repository job log here.

    opened by renovate[bot] 1
  • feat(dev): support for `/_vfs.json`

    feat(dev): support for `/_vfs.json`

    🔗 Linked issue

    ❓ Type of change

    • [ ] 📖 Documentation (updates to the documentation or readme)
    • [ ] 🐞 Bug fix (a non-breaking change that fixes an issue)
    • [ ] 👌 Enhancement (improving an existing functionality like performance)
    • [ ] ✨ New feature (a non-breaking change that adds functionality)
    • [ ] ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

    📚 Description

    This could be useful for other integrations to get the data and render it in their own style.

    📝 Checklist

    • [ ] I have linked an issue or discussion.
    • [ ] I have updated the documentation accordingly.
    opened by antfu 4
  • Nitro plugins are no longer transpiled

    Nitro plugins are no longer transpiled

    Environment


    • Operating System: Linux
    • Node Version: v16.14.2
    • Nuxt Version: 3.0.1-rc.0-27880943.da38c62
    • Nitro Version: 2.0.0-27860563.409fe2b
    • Package Manager: [email protected]
    • Builder: vite
    • User Config: modules
    • Runtime Modules: ()
    • Build Modules: -

    Reproduction

    https://stackblitz.com/edit/github-mnypyo

    Describe the bug

    Previously TS plugins could be processed (and also mjs plugins needing to be transpiled for other reasons, like imports from virtual files). I think this is likely a regression caused by https://github.com/unjs/nitro/pull/732.

    Additional context

    No response

    Logs

    No response

    bug 
    opened by danielroe 0
Releases(v0.6.0)
  • v0.6.0(Oct 18, 2022)

    ⚠️ Breaking Changes

    • H3 updated to to 0.8x [Release Notes]
    • Experimental routes is renamed to routeRules (#593)

    🚀 Enhancements

    • Support redirect, headers, and cors route rules (#538)
    • netlify: Incremental static regeneration + swr (#540)
    • Add debugger option to debug hooks (#577)
    • Allow matching multiple route rules (#582)
    • Normalize route options and shortcuts (#583)
    • cleavr: Add cleavr preset (#523)
    • cleavr: Auto detect preset (d5bbdeb)
    • Allow disabling public dir generation using noPublicDir (00a304a)
    • cache: Mock res.end, res.write and res.writeHead (673fe8e)
    • cache: Support headersOnly cache mode (4e6dda1)
    • Allow cache: false route rule to override cache options (91f8300)

    🩹 Fixes

    • Fully resolve internal paths for autoimports (#543)
    • Retry writing traced files if there are conflicts (#537)
    • externals: Rewrite traced file paths to latest semver-minor version (#578)
    • Workaround rollup issue (b884d0c)
    • Handle output dirs set to empty string (#584)
    • azure: Raw body no longer returns parsed json (#589)
    • Default workspaceDir to rootDir (#594)
    • renderer: Directly return body to allow caching (859a984)
    • cache: Only spy on end/write for string chunks (bd0b1ed)
    • error: Do not assign default statusMessage for errors (cbe0e91)
    • cache: Use lowercase headers (9eb5769)
    • cache: Abort cache handler for error status codes (ba21751)
    • cache: Skip error status codes by invalidating cache (4fd164f)
    • deps: Ensure radix3 version is expected (245ed70)
    • cache: Invalidate entries with undefined body (e9285da)
    • app: Only apply cache rules ro routes (not middleware) (4603279)

    💅 Refactors

    • ⚠️ Rename routeOptions to routeRules (#593)

    📖 Documentation

    • Add quotes to string (#547)
    • Fix link to cloudflare-pages preset (#564)
    • Add note about cache options for route options (221c747)

    🏡 Chore

    • ci: Bump edge version acording to changelog (8b7740e)

    🤖 CI

    • Fetch tags for proper version bump (6d4b416)

    ❤️ Contributors

    • Anish Ghimire
    • Christopher Lis
    • Daniel Roe
    • Louis Haftmann
    • Pooya Parsa
    • Tobias Diez
    • Wolfgang Ziegler
    Source code(tar.gz)
    Source code(zip)
  • v0.5.0(Sep 1, 2022)

    🚀 Enhancements

    • Add cloudflare-pages preset [experimental] (#210)
    • Support prerendering binary files (#320)
    • Opt-in option to compress public assets using gzip and br (#449)
    • Allow specifying wasm plugin options (#450)
    • Allow using extends alongside with preset (6a43985)

    🩹 Fixes

    • azure: Fix route name (#430)
    • Add resolved side-effect for node-fetch-native (#435)
    • aws-lambda: Join cookies with semicolon (#356)
    • aws-lambda: Fix normalizeIncomingHeaders (#418)
    • aws-lambda: Return outgoing cookies on response objects (#357)
    • aws-lambda: Add multiValueQueryStringParameters to aws preset (#398)
    • ⚠️ Update unenv to 0.6.x (#438)
    • Add code location and code frame for rollup errors (#406)
    • prerender: Allow updating route contents (#452)
    • externals: ⚠️ Fall back to mlly resolver in more cases (#431)
    • ⚠️ NITRO_PRESET should have the highest priority (92d711f)

    💅 Refactors

    • ⚠️ Rename options autoImport to imports (#433)
    • Utilize knitwork to generate safe variable names (#447)

    📖 Documentation

    • Migrate to docus (#365)
    • Simplify deploy index route (a1d7b17)
    • storage: Fix typo (#424)

    🏡 Chore

    • Remove unused @types/jsdom from dependencies (#429)

    📦 Build

    • Expose /package.json subpath export (d0029c0)
    • Use changelogen to bump edge and generate chagelog (679e356)

    ⚠️ Breaking Changes

    • ⚠️ Update unenv to 0.6.x (#438)
    • externals: ⚠️ Fall back to mlly resolver in more cases (#431)
    • ⚠️ NITRO_PRESET should have highest periority (92d711f)
    • ⚠️ Rename options autoImport to imports (#433)

    ❤️ Contributors

    • Ahad Birang
    • Alexander Lichter
    • Anthony Fu
    • Daniel Roe
    • Dániel Földi
    • Eckhardt (Kaizen) Dreyer
    • Julien Huang
    • Pooya Parsa
    • Sören Schwert
    • Tobias Diez
    • Yaël Guilloux
    Source code(tar.gz)
    Source code(zip)
  • v0.4.0(May 5, 2022)

    🐛 Fixes

    Handlers

    • 89da30a Respect default value for lazy

    General

    • #179 Improve bundled storage
    • 247cfca Enable lazy only when explicitly set (enable for api and rotues by default)

    Prerender

    • #190 Allow all extensions (resolves )
    • 970286d Support relative urls

    Rollup

    • 2b7209a Set NODE_ENV to prerender when prerendering
    • 43b1d02 Respect rollupConfig options to override default config
    • 32f598a Enable preferBuiltins only for node targets

    Worker

    • 6c8cae7 Use iife format by default

    Cache

    • #189 Preserve event context (resolves )

    🚀 Features

    General

    • #173 Expose all assets to nitro.vfs and /_vfs endpoint (resolves )
    • #181 Universal import.meta (resolves )
    • e1c234e nitro.storage
    • 233e024 Named wildcard params
    • 04e2f26 Update unenv
    • 23d8cde Allow explicit middleware handlers
    • #115 Extend prerender links from X-Nitro-Prerender (resolves )
    • 11e732b Add X-Nitro-Prerender header to detect prerendering

    Cache

    • ⚠️ 7e72b8f Only accept event handler for defineCachedEventHandler

    Prerender

    • ⚠️ #166 Write html files to subfolder (resolves )

    Rollup

    • #187 Allow edit of commonJs plugin options
    • ff2dd44 Fail build when externals are not allowed and cannot resolve id

    💅 Refactors

    General

    • #180 Improve esbuild.target option handling
    • 45f48a3 Hide .map files from output tree

    Rollup

    • d7da0fe Use built-in dynamic virtual plugin

    📖 Documentation

    General

    • #197 Add render setup configuration

    Cloudflare

    • 91f5339 Update wrangler.toml

    🏡 Chore

    Release

    • 6e1a0e7 0.4.0

    ⚠️ Breaking Changes

    • ⚠️ 7e72b8f Only accept event handler for defineCachedEventHandler
    • ⚠️ #166 Write html files to subfolder (resolves )

    ❤️ Contributors

    • Julien Huang

    Source code(tar.gz)
    Source code(zip)
Owner
unjs
Unified JavaScript Tools
unjs
Example code for MFE routing, shared state, build-time & runtime deploy video

Turborepo starter with pnpm This is an official starter turborepo. What's inside? This turborepo uses pnpm as a packages manager. It includes the foll

Jack Herrington 42 Nov 2, 2022
Toolkit for development, test and deploy smart-contracts on Waves Enterprise ecosystem.

JS Contract SDK Toolkit for development, test and deploy smart-contracts on Waves Enterprise ecosystem. Quickstart The fastest way to get started with

Waves Enterprise 20 Dec 15, 2022
📋 unjs project starter template

packageName Package description Usage Install package: # npm npm install packageName # yarn yarn install packageName # pnpm pnpm install packageName

unjs 59 Jan 6, 2023
Subscribe to rss feeds from anywhere, receive notifications from anywhere.

INK RSS 管理订阅,接收通知 示例网页 · 示例群组 · 报告Bug 介绍 特点 项目背景 TODO 注意事项 部署 额外附赠 使用建议 调查 贡献 作者 协议 介绍 INK RSS 提供及时且多样的 rss 通知服务,借助现有的接口你可以在任意位置订阅,并使用任意方式接收通知,并且所有服务均

null 253 Dec 28, 2022
Markdoc is a Markdown-based syntax and toolchain for creating custom documentation sites and experiences.

A powerful, flexible, Markdown-based authoring framework. Markdoc is a Markdown-based syntax and toolchain for creating custom documentation sites and

Markdoc 5.8k Jan 2, 2023
Minecraft modpack that port Create: Above and Beyond to Fabric Toolchain.

English Cabricality Create: Above and Beyond but for Fabric 1.18.2 using Create 0.5. Cabricality aims to port the CAB experience to Fabric, but not 1:

DM Earth 43 Dec 23, 2022
Internationalization for svelte framework. Based on i18next ecosystem

svelte-i18next Svelte wrapper for i18next npm i svelte-i18next i18next Implementation This library wraps an i18next instance in a Svelte Store to obs

Nishu Goel 20 Dec 9, 2022
fcall, fetch and call any remote hot functions, anywhere, anytime, without installations or configurations.

fcall, fetch and call any remote hot functions, anywhere, anytime, without installations or configurations.

立党 Lidang 4 Sep 20, 2022
Dead-simple CORS handling for any itty-router API (test with Cloudflare Workers, but works anywhere)!

Simple CORS-handling for any itty-router API. Designed on Cloudflare Workers, but works anywhere. Features Tiny. Currently ~600 bytes, with zero-depen

Kevin R. Whitley 6 Dec 16, 2022
ToolJet an open-source low-code framework to build and deploy internal tools quickly without much effort from the engineering teams

ToolJet is an open-source low-code framework to build and deploy internal tools quickly without much effort from the engineering teams. You can connect to your data sources, such as databases (like PostgreSQL, MongoDB, Elasticsearch, etc), API endpoints (ToolJet supports importing OpenAPI spec & OAuth2 authorization), and external services (like Stripe, Slack, Google Sheets, Airtable) and use our pre-built UI widgets to build internal tools.

ToolJet 15.6k Jan 3, 2023
A discord bot that generates Discord Nitro, Hulu accounts, Origin, spotify and VPNs!

Discord-Account-Generator-Bot A discord bot that generates Discord Nitro, Hulu accounts, Origin, spotify and VPNs! Tutorial Basically download the fil

#Fluroescent 20 Oct 4, 2022
this is a discord nitro generator and checker⚙ EZPZ

Language | EN Hello my dear friends ???? In this new project, I wrote a program to extract nitro discord code, which after extracting the code, verifi

Sobhan.SRZA 6 Sep 17, 2022
Générateur de nitro Discord by RyzeTool

Vlaque Nitro Generator Le Vlaque Nitro Générator comme son nom l'indique génère des code nitro. Ryze Ryze Avant de d'installer le tool n'hésite pas a

Ryze 4 Dec 9, 2022
Supercharge Multicall.js with nitro features 💨

multicall-nitro Supercharge Multicall.js with nitro features ?? Highlights TypeScript support ✅ Ready-to-use calls ✍?? React hook ⚛️ One time call ??

Enzo Ferey 5 Dec 15, 2022
A server side rendering framework for Deno CLI and Deploy. 🦟 🦕

nat A server side rendering framework for Deno CLI and Deploy. Incorporating acorn, nano-jsx, and twind, it provides the tooling to provide a server c

oak 12 Nov 17, 2022
Windmill: Open-source platform and runtime to turn any scripts into internal apps, integrations and workflows

. Open-source and self-hostable alternative to Airplane, Pipedream, Superblocks and a simplified Temporal with autogenerated UIs to trigger flows and

Windmill Labs, Inc 1.6k Jan 4, 2023
io-ts Typed Event Bus for the runtime of your Node.js application. A core for any event-driven architecture based app.

Typed Event Bus Based on io-ts types, this bus provides a handy interface to publish and consume events in the current runtime of the Node.js process.

Konstantin Knyazev 3 May 23, 2022
A documentation site for the Aries JavaScript ecosystem.

Aries JavaScript Documentation Getting started | Contributing | License Aries JavaScipt is an ecosystem of self-sovereign identity development tools,

Hyperledger 11 Nov 16, 2022
A small, but powerful HTTP library for Deno & Deno Deploy, built for convenience and simplicity

Wren Wren is a small, but powerful HTTP library for Deno & Deno Deploy, built for convenience and simplicity. convenient aliases for HTTP responses au

Jakub Neander 69 Dec 12, 2022