mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-11 08:33:53 +00:00
Merge branch 'dev' into 2.x
This commit is contained in:
commit
5af0901c83
14
.babelrc
14
.babelrc
@ -1,14 +0,0 @@
|
||||
{
|
||||
"env": {
|
||||
"test": {
|
||||
"presets": [
|
||||
["@babel/env", {
|
||||
"targets": {
|
||||
"node": "current"
|
||||
}
|
||||
}]
|
||||
],
|
||||
"plugins": ["dynamic-import-node"]
|
||||
}
|
||||
}
|
||||
}
|
@ -1,11 +1,16 @@
|
||||
version: 2
|
||||
|
||||
defaults: &defaults
|
||||
working_directory: ~/project/nuxt
|
||||
working_directory: ~/project
|
||||
docker:
|
||||
- image: banian/node-headless-chrome
|
||||
environment:
|
||||
- NODE_ENV: test
|
||||
|
||||
jobs:
|
||||
# --------------------------------------------------------------------------
|
||||
# Phase 1: Setup
|
||||
# --------------------------------------------------------------------------
|
||||
setup:
|
||||
<<: *defaults
|
||||
steps:
|
||||
@ -19,23 +24,32 @@ jobs:
|
||||
# Install dependencies
|
||||
- run:
|
||||
name: Install Dependencies
|
||||
command: NODE_ENV=dev yarn
|
||||
command: yarn --frozen-lockfile --non-interactive
|
||||
|
||||
# Keep cache
|
||||
# Save cache
|
||||
- save_cache:
|
||||
key: yarn-{{ checksum "yarn.lock" }}
|
||||
paths:
|
||||
- "node_modules"
|
||||
- node_modules
|
||||
- packages/*/node_modules
|
||||
- distributions/*/node_modules
|
||||
|
||||
# Persist files
|
||||
# Persist workspace
|
||||
- persist_to_workspace:
|
||||
root: ~/project
|
||||
paths:
|
||||
- nuxt
|
||||
- node_modules
|
||||
- packages/*/node_modules
|
||||
- distributions/*/node_modules
|
||||
- packages/*/dist
|
||||
|
||||
# --------------------------------------------------------------------------
|
||||
# Phase 2: Lint + Audit + Build Nuxt and fixtures
|
||||
# --------------------------------------------------------------------------
|
||||
lint:
|
||||
<<: *defaults
|
||||
steps:
|
||||
- checkout
|
||||
- attach_workspace:
|
||||
at: ~/project
|
||||
- run:
|
||||
@ -45,6 +59,7 @@ jobs:
|
||||
audit:
|
||||
<<: *defaults
|
||||
steps:
|
||||
- checkout
|
||||
- attach_workspace:
|
||||
at: ~/project
|
||||
- run:
|
||||
@ -54,44 +69,47 @@ jobs:
|
||||
build:
|
||||
<<: *defaults
|
||||
steps:
|
||||
- checkout
|
||||
- attach_workspace:
|
||||
at: ~/project
|
||||
- run:
|
||||
name: Build Fixtures
|
||||
command: yarn build && yarn test:fixtures -w=4 --coverage && yarn coverage
|
||||
command: yarn test:fixtures -w=4 --coverage && yarn coverage
|
||||
- persist_to_workspace:
|
||||
root: ~/project
|
||||
paths:
|
||||
- nuxt/test/fixtures
|
||||
- nuxt/dist
|
||||
environment:
|
||||
- NODE_ENV: "test"
|
||||
- test/fixtures
|
||||
|
||||
# --------------------------------------------------------------------------
|
||||
# Phase 3: Unit and E2E tests
|
||||
# --------------------------------------------------------------------------
|
||||
test-unit:
|
||||
<<: *defaults
|
||||
steps:
|
||||
- checkout
|
||||
- attach_workspace:
|
||||
at: ~/project
|
||||
- run:
|
||||
name: Unit Test
|
||||
name: Unit Tests
|
||||
command: yarn test:unit -w=4 --coverage && yarn coverage
|
||||
environment:
|
||||
- NODE_ENV: "test"
|
||||
|
||||
test-e2e:
|
||||
<<: *defaults
|
||||
steps:
|
||||
- checkout
|
||||
- attach_workspace:
|
||||
at: ~/project
|
||||
- run:
|
||||
name: E2E Test
|
||||
name: E2E Tests
|
||||
command: yarn test:e2e && yarn coverage
|
||||
environment:
|
||||
- NODE_ENV: "test"
|
||||
|
||||
# --------------------------------------------------------------------------
|
||||
# Phase 4: Release (dev branch only)
|
||||
# --------------------------------------------------------------------------
|
||||
release:
|
||||
<<: *defaults
|
||||
steps:
|
||||
- checkout
|
||||
- attach_workspace:
|
||||
at: ~/project
|
||||
- run:
|
||||
@ -99,19 +117,14 @@ jobs:
|
||||
command: |
|
||||
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc
|
||||
echo "//registry.yarnpkg.com/:_authToken=$NPM_TOKEN" >> ~/.npmrc
|
||||
BUILD_SUFFIX=edge yarn build
|
||||
npm publish
|
||||
for p in packages/*; do
|
||||
if [ -f "$p/package.json" ]; then
|
||||
cd $p
|
||||
npm publish
|
||||
cd -
|
||||
fi
|
||||
done
|
||||
yarn lerna version
|
||||
PACKAGE_SUFFIX=edge yarn build
|
||||
./scripts/workspace-run npm publish
|
||||
|
||||
# Workflow definition
|
||||
workflows:
|
||||
version: 2
|
||||
setup-and-parallel-test:
|
||||
setup-and-test:
|
||||
jobs:
|
||||
- setup
|
||||
|
||||
|
@ -1,7 +1,16 @@
|
||||
app
|
||||
!app/store.js
|
||||
# Common
|
||||
node_modules
|
||||
dist
|
||||
.nuxt
|
||||
coverage
|
||||
|
||||
# Examples
|
||||
|
||||
## cofeescript
|
||||
examples/coffeescript/pages/index.vue
|
||||
!examples/storybook/.storybook
|
||||
|
||||
# Packages
|
||||
|
||||
# vue-app
|
||||
packages/vue-app/template
|
||||
!packages/vue-app/template/store.js
|
||||
|
101
.eslintrc.js
101
.eslintrc.js
@ -4,81 +4,34 @@ module.exports = {
|
||||
parser: 'babel-eslint',
|
||||
sourceType: 'module'
|
||||
},
|
||||
env: {
|
||||
browser: true,
|
||||
node: true,
|
||||
'jest/globals': true
|
||||
},
|
||||
extends: [
|
||||
'standard',
|
||||
'plugin:import/errors',
|
||||
'plugin:import/warnings',
|
||||
'plugin:vue/recommended'
|
||||
'@nuxtjs'
|
||||
],
|
||||
plugins: [
|
||||
'vue',
|
||||
'jest'
|
||||
],
|
||||
settings: {
|
||||
'import/resolver': {
|
||||
node: { extensions: ['.js', '.mjs'] }
|
||||
overrides: [{
|
||||
files: [ 'test/fixtures/*/.nuxt*/**' ],
|
||||
rules: {
|
||||
'vue/name-property-casing': ['error', 'kebab-case']
|
||||
}
|
||||
},
|
||||
rules: {
|
||||
// Enforce import order
|
||||
'import/order': 2,
|
||||
|
||||
// Imports should come first
|
||||
'import/first': 2,
|
||||
|
||||
// Other import rules
|
||||
'import/no-mutable-exports': 2,
|
||||
|
||||
// Allow unresolved imports
|
||||
'import/no-unresolved': 0,
|
||||
|
||||
// Allow paren-less arrow functions only when there's no braces
|
||||
'arrow-parens': [2, 'as-needed', { requireForBlockBody: true }],
|
||||
|
||||
// Allow async-await
|
||||
'generator-star-spacing': 0,
|
||||
|
||||
// Allow debugger during development
|
||||
'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0,
|
||||
|
||||
// Prefer const over let
|
||||
'prefer-const': [2, {
|
||||
'destructuring': 'any',
|
||||
'ignoreReadBeforeAssign': false
|
||||
}],
|
||||
|
||||
// No single if in an "else" block
|
||||
'no-lonely-if': 2,
|
||||
|
||||
// Force curly braces for control flow
|
||||
curly: 2,
|
||||
|
||||
// No async function without await
|
||||
'require-await': 2,
|
||||
|
||||
// Force dot notation when possible
|
||||
'dot-notation': 2,
|
||||
|
||||
'no-var': 2,
|
||||
|
||||
// Do not allow console.logs etc...
|
||||
'no-console': 2,
|
||||
'space-before-function-paren': [2, {
|
||||
anonymous: 'always',
|
||||
named: 'never'
|
||||
}],
|
||||
'vue/no-parsing-error': [2, {
|
||||
'x-invalid-end-tag': false
|
||||
}],
|
||||
'vue/max-attributes-per-line': [2, {
|
||||
'singleline': 5,
|
||||
}]
|
||||
},
|
||||
|
||||
globals: {}
|
||||
}, {
|
||||
files: [ 'test/fixtures/*/.nuxt*/**/+(App|index).js' ],
|
||||
rules: {
|
||||
'import/order': 'ignore'
|
||||
}
|
||||
}, {
|
||||
files: [ 'test/fixtures/*/.nuxt*/**/client.js' ],
|
||||
rules: {
|
||||
'no-console': ['error', { allow: ['error'] }]
|
||||
}
|
||||
}, {
|
||||
files: [ 'test/fixtures/*/.nuxt*/**/router.js' ],
|
||||
rules: {
|
||||
'no-console': ['error', { allow: ['warn'] }]
|
||||
}
|
||||
}, {
|
||||
files: [ 'test/fixtures/*/.nuxt*/**/*.html' ],
|
||||
rules: {
|
||||
'semi': ['error', 'always', { 'omitLastInOneLineBlock': true }],
|
||||
'no-var': 'warn'
|
||||
}
|
||||
}]
|
||||
}
|
||||
|
6
.github/ISSUE_TEMPLATE.md
vendored
6
.github/ISSUE_TEMPLATE.md
vendored
@ -3,9 +3,9 @@
|
||||
|
||||
Please use the following link to create a new issue:
|
||||
|
||||
- 🚨 Bug report - http://bug.nuxt.xyz/
|
||||
- 🙋 Feature request - http://feature.nuxt.xyz/
|
||||
- ❗️ All other issues - http://cmty.nuxt.xyz/
|
||||
- 🚨 Bug report - https://bug.nuxtjs.org/
|
||||
- 🙋 Feature request - https://feature.nuxtjs.org/
|
||||
- ❗️ All other issues - https://cmty.nuxtjs.org/
|
||||
|
||||
If your issue was not created using the app above, **it will be closed immediately**.
|
||||
-->
|
||||
|
8
.github/lock.yml
vendored
Normal file
8
.github/lock.yml
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
# Configuration for lock-threads - https://github.com/dessant/lock-threads
|
||||
daysUntilLock: 30
|
||||
exemptLabels: []
|
||||
lockLabel: false
|
||||
lockComment: >
|
||||
This thread has been automatically locked since there has not been
|
||||
any recent activity after it was closed. Please open a new issue for
|
||||
related bugs.
|
9
.github/stale.yml
vendored
Normal file
9
.github/stale.yml
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
# Configuration for probot-stale - https://github.com/probot/stale
|
||||
daysUntilStale: 21
|
||||
daysUntilClose: 7
|
||||
staleLabel: stale
|
||||
exemptLabels:
|
||||
- "cmty:feature-request"
|
||||
markComment: >
|
||||
This issue has been automatically marked as stale because it has not had
|
||||
recent activity. It will be closed if no further activity occurs.
|
26
.gitignore
vendored
26
.gitignore
vendored
@ -1,28 +1,33 @@
|
||||
# Dependencies
|
||||
node_modules
|
||||
examples/**/*/yarn.lock
|
||||
jspm_packages
|
||||
|
||||
# Only keep yarn.lock in the root
|
||||
package-lock.json
|
||||
*/**/yarn.lock
|
||||
|
||||
# Logs
|
||||
*.log
|
||||
npm-debug.log*
|
||||
yarn-error.log*
|
||||
|
||||
# Packages
|
||||
packages/*/LICENSE
|
||||
|
||||
# Distributions
|
||||
distributions/*/LICENSE
|
||||
|
||||
# Other
|
||||
.nuxt*
|
||||
.cache
|
||||
|
||||
# Dist folder
|
||||
# Dist folders
|
||||
dist
|
||||
|
||||
# Dist example generation
|
||||
examples/**/dist
|
||||
|
||||
# Coverage support
|
||||
# Coverage reports
|
||||
coverage
|
||||
*.lcov
|
||||
.nyc_output
|
||||
|
||||
# VSCode
|
||||
.vscode
|
||||
|
||||
# Intellij idea
|
||||
@ -30,7 +35,7 @@ coverage
|
||||
.idea
|
||||
|
||||
# OSX
|
||||
*.DS_Store
|
||||
.DS_Store
|
||||
.AppleDouble
|
||||
.LSOverride
|
||||
|
||||
@ -49,3 +54,6 @@ coverage
|
||||
Network Trash Folder
|
||||
Temporary Items
|
||||
.apdisk
|
||||
|
||||
# Junit report from jest-junit
|
||||
*junit.xml
|
||||
|
106
CONTRIBUTING.md
106
CONTRIBUTING.md
@ -1,106 +0,0 @@
|
||||
# Contributing to Nuxt.js
|
||||
|
||||
First of all, thank you for considering to contribute to Nuxt.js! :heart:
|
||||
|
||||
## Reporting Issues
|
||||
|
||||
A great way to contribute to the project is to send a detailed report when you encounter an issue.
|
||||
To make things easier for contributors and maintainers, we use [CMTY](http://cmty.nuxt.xyz).
|
||||
|
||||
Please make sure to include a reproduction repository or [CodeSandBox](http://template.nuxt.xyz)
|
||||
so that bugs can be reproduced without great efforts. The better a bug can be reproduced, the faster we can start fixing it!
|
||||
|
||||
## Pull Requests
|
||||
|
||||
We'd love to see your pull requests, even if it's just to fix a typo!
|
||||
|
||||
However, any significant improvement should be associated to an existing
|
||||
[feature request](http://feature.nuxt.xyz/)
|
||||
or [bug report](http://bug.nuxt.xyz/).
|
||||
|
||||
### Getting started
|
||||
|
||||
1. [Fork](https://help.github.com/articles/fork-a-repo/) this repository to your own GitHub account and then [clone](https://help.github.com/articles/cloning-a-repository/) it to your local device.
|
||||
2. Run `npm install` or `yarn install` to install the dependencies.
|
||||
|
||||
> _Note that both **npm** and **yarn** have been seen to miss installing dependencies. To remedy that, you can either delete the `node_modules` folder in your example app and install again or do a local install of the missing dependencies._
|
||||
|
||||
> If you are adding a dependency, please use `yarn add`. The `yarn.lock` file is the source of truth for all Nuxt dependencies.
|
||||
|
||||
### Test structure
|
||||
|
||||
A great PR, whether it includes a bug fix or a new feature, will often include tests.
|
||||
To write great tests, let us explain our test structure:
|
||||
|
||||
#### Fixtures
|
||||
|
||||
The fixtures (found under `tests/fixtures`) contain several Nuxt applications. To keep build time as short as possible,
|
||||
we don't build an own Nuxt application per test. Instead, the fixtures are built (`yarn test:fixtures`) before running
|
||||
the actual unit tests.
|
||||
|
||||
Please make sure to **alter** or **add a new fixture** when submitting a PR to reflect the changes properly (if applicable).
|
||||
|
||||
Also, don't forget to **rebuild** a fixture after changing it by running the corresponding test
|
||||
with `jest test/fixtures/my-fixture/my-fixture.test.js`!
|
||||
|
||||
#### Unit tests
|
||||
|
||||
The unit tests can be found in `tests/unit` and will be executed after building the fixtures. A fresh Nuxt server will be used
|
||||
per test so that no shared state (except the initial state from the build step) is present.
|
||||
|
||||
After adding your unit tests, you can run them directly:
|
||||
|
||||
```sh
|
||||
jest test/unit/test.js
|
||||
```
|
||||
|
||||
Or you can run the whole unit test suite:
|
||||
|
||||
```sh
|
||||
yarn test:unit
|
||||
```
|
||||
|
||||
Again, please be aware that you might have to rebuild your fixtures before!
|
||||
|
||||
### Testing your changes
|
||||
|
||||
While working on your PR you will likely want to check if your fixture is set up correctly or debug your current changes.
|
||||
|
||||
To do so you can use the Nuxt script itself to launch for example your fixture or an example app:
|
||||
|
||||
```sh
|
||||
bin/nuxt examples/your-app
|
||||
bin/nuxt test/fixtures/your-fixture-app
|
||||
```
|
||||
|
||||
> `npm link` could also (and does, to some extent) work for this, but it has been known to exhibit some issues. That is why we recommend calling `bin/nuxt` directly to run examples.
|
||||
|
||||
### Examples
|
||||
|
||||
If you are working on a larger feature, please set up an example app in `examples/`.
|
||||
This will help greatly in understanding changes and also help Nuxt users to understand the feature you've built in-depth.
|
||||
|
||||
### Linting
|
||||
|
||||
As you might have noticed already, we are using ESLint to enforce a code standard. Please run `yarn lint` before committing
|
||||
your changes to verify that the code style is correct. If not, you can use `yarn lint --fix` or `npm run lint -- --fix` (no typo!) to fix most of the
|
||||
style changes. If there are still errors left, you must correct them manually.
|
||||
|
||||
### Documentation
|
||||
|
||||
If you are adding a new feature, do a refactoring or change the behavior of Nuxt in any other manner, you'll likely
|
||||
want to document the changes. Please do so with a PR to the [docs](https://github.com/nuxt/docs/pulls) repository.
|
||||
You don't have to write documentation up immediately (but please do so as soon as your pull request is mature enough).
|
||||
|
||||
### Final checklist
|
||||
|
||||
When submitting your PR, there is a simple template that you have to fill out.
|
||||
Please tick all appropriate "answers" in the checklists.
|
||||
|
||||
### Troubleshooting
|
||||
|
||||
#### Debugging tests on macOS
|
||||
|
||||
Searching for `getPort()` will reveal it's used to start new Nuxt processes during tests. It's been seen to stop working on macOS at times and may require you to manually set a port for testing.
|
||||
|
||||
Another common issue is Nuxt processes that may hang in memory when running fixture tests. A ghost process will often prevent subsequent tests from working. Run `ps aux | grep -i node` to inspect any hanging test processes if you suspect this is happening.
|
14
README.md
14
README.md
@ -1,18 +1,18 @@
|
||||
<p align="center"><img align="center" src="http://imgur.com/V4LtoII.png"/></p>
|
||||
<p align="center">
|
||||
<a href="https://circleci.com/gh/nuxt/nuxt.js"><img src="https://badgen.net/circleci/github/nuxt/nuxt.js/dev" alt="Build Status"></a>
|
||||
<a href="https://ci.appveyor.com/project/nuxt/nuxt-js"><img src="https://badgen.net/appveyor/ci/nuxt/nuxt-js/dev" alt="Windows Build Status"></a>
|
||||
<a href="https://dev.azure.com/nuxt/nuxt.js/_build/latest?definitionId=1"><img src="https://dev.azure.com/nuxt/nuxt.js/_apis/build/status/nuxt.js" alt="Azure Build Status"></a>
|
||||
<a href="https://codecov.io/gh/nuxt/nuxt.js"><img src="https://badgen.net/codecov/c/github/nuxt/nuxt.js/dev" alt="Coverage Status"></a>
|
||||
<a href="https://www.npmjs.com/package/nuxt"><img src="https://badgen.net/npm/dm/nuxt" alt="Downloads"></a>
|
||||
<a href="https://www.npmjs.com/package/nuxt"><img src="https://badgen.net/npm/v/nuxt" alt="Version"></a>
|
||||
<a href="https://www.npmjs.com/package/nuxt"><img src="https://badgen.net/npm/license/nuxt" alt="License"></a>
|
||||
<a href="http://discord.nuxt.xyz"><img src="https://badgen.net/badge/Discord/join-us/7289DA" alt="Discord"></a>
|
||||
<a href="https://discord.nuxtjs.org/"><img src="https://badgen.net/badge/Discord/join-us/7289DA" alt="Discord"></a>
|
||||
</p>
|
||||
<p align="center">
|
||||
<a href="#partners" alt="Partner on Open Collective"><img src="https://opencollective.com/nuxtjs/tiers/partner/badge.svg" /></a>
|
||||
<a href="#sponsors" alt="Sponsors on Open Collective"><img src="https://opencollective.com/nuxtjs/tiers/sponsors/badge.svg" /></a>
|
||||
<a href="#backers" alt="Backers on Open Collective"><img src="https://opencollective.com/nuxtjs/tiers/backers/badge.svg" /></a>
|
||||
<a href="http://oc.nuxt.xyz/"><img src="https://img.shields.io/badge/Support%20us-Open%20Collective-41B883.svg" alt="Support us"></a>
|
||||
<a href="https://oc.nuxtjs.org/"><img src="https://img.shields.io/badge/Support%20us-Open%20Collective-41B883.svg" alt="Support us"></a>
|
||||
|
||||
</p>
|
||||
|
||||
@ -23,10 +23,10 @@
|
||||
- 📘 Documentation: [https://nuxtjs.org](https://nuxtjs.org)
|
||||
- 👥 Community: [cmty.app/nuxt](https://cmty.app/nuxt)
|
||||
- 🎬 Video: [1 minute demo](https://www.youtube.com/watch?v=kmf-p-pTi40)
|
||||
- 🐦 Twitter: [@nuxt_js](http://twitter.nuxt.xyz)
|
||||
- 💬 Chat: [Discord](http://discord.nuxt.xyz)
|
||||
- 🐦 Twitter: [@nuxt_js](https://twitter.nuxtjs.org/)
|
||||
- 💬 Chat: [Discord](https://discord.nuxtjs.org/)
|
||||
- 📦 [Nuxt.js Modules](https://github.com/nuxt-community/modules)
|
||||
- 👉 [Play with Nuxt.js online](http://template.nuxt.xyz)
|
||||
- 👉 [Play with Nuxt.js online](https://template.nuxtjs.org)
|
||||
|
||||
## Features
|
||||
|
||||
@ -219,7 +219,7 @@ Thank you to all our [contributors](https://github.com/nuxt/nuxt.js/graphs/contr
|
||||
|
||||
## Contributing
|
||||
|
||||
Please see our [CONTRIBUTING.md](./CONTRIBUTING.md)
|
||||
Please refer to our [Contribution Guide](https://nuxtjs.org/guide/contribution-guide#codefund_ad)
|
||||
|
||||
## Cross-browser testing
|
||||
|
||||
|
37
appveyor.yml
37
appveyor.yml
@ -1,37 +0,0 @@
|
||||
# Test against the latest version of this Node.js version
|
||||
environment:
|
||||
nodejs_version: "Current"
|
||||
# environment:
|
||||
# matrix:
|
||||
# - nodejs_version: "Current"
|
||||
|
||||
cache:
|
||||
- 'node_modules -> yarn.lock'
|
||||
- '%LOCALAPPDATA%\\Yarn -> yarn.lock'
|
||||
|
||||
image: Visual Studio 2017
|
||||
|
||||
shallow_clone: true
|
||||
|
||||
# Install scripts. (runs after repo cloning)
|
||||
install:
|
||||
# Get the latest stable version of Node.js or io.js
|
||||
- ps: Install-Product node $env:nodejs_version
|
||||
# install modules
|
||||
- yarn install
|
||||
|
||||
# Post-install test scripts.
|
||||
test_script:
|
||||
# Output useful info for debugging.
|
||||
- node --version
|
||||
# - npm --version
|
||||
- yarn --version
|
||||
# run tests
|
||||
- yarn test:fixtures -w=2
|
||||
- yarn test:unit -w=2
|
||||
|
||||
# Don't actually build.
|
||||
build: off
|
||||
|
||||
# Do not build feature branch with open Pull Requests
|
||||
skip_branch_with_pr: true
|
34
azure-pipelines.yml
Normal file
34
azure-pipelines.yml
Normal file
@ -0,0 +1,34 @@
|
||||
# Node.js
|
||||
# Build a general Node.js project with npm.
|
||||
# Add steps that analyze code, save build artifacts, deploy, and more:
|
||||
# https://docs.microsoft.com/azure/devops/pipelines/languages/javascript
|
||||
|
||||
pool:
|
||||
vmImage: 'vs2017-win2016'
|
||||
|
||||
trigger:
|
||||
- dev
|
||||
|
||||
steps:
|
||||
- task: NodeTool@0
|
||||
inputs:
|
||||
versionSpec: '^10.10.0'
|
||||
displayName: 'Install Node.js'
|
||||
|
||||
- script: |
|
||||
yarn
|
||||
displayName: 'Install dependencies'
|
||||
|
||||
- script: |
|
||||
set JEST_JUNIT_OUTPUT=test-fixtures-junit.xml&& yarn test:fixtures -w=2
|
||||
displayName: 'Test: Build Fixtures'
|
||||
|
||||
- script: |
|
||||
set JEST_JUNIT_OUTPUT=test-unit-junit.xml&& yarn test:unit -w=2
|
||||
displayName: 'Test: Run unit tests'
|
||||
|
||||
- task: PublishTestResults@2
|
||||
inputs:
|
||||
testResultsFormat: 'JUnit'
|
||||
testResultsFiles: 'test-*.xml'
|
||||
displayName: 'Publish test results to Azure Pipelines'
|
19
babel.config.js
Normal file
19
babel.config.js
Normal file
@ -0,0 +1,19 @@
|
||||
function isBabelLoader(caller) {
|
||||
return caller && caller.name === 'babel-loader'
|
||||
}
|
||||
|
||||
module.exports = function (api) {
|
||||
if (api.env('test') && !api.caller(isBabelLoader)) {
|
||||
return {
|
||||
presets: [
|
||||
['@babel/env', {
|
||||
targets: {
|
||||
node: 'current'
|
||||
}
|
||||
}]
|
||||
],
|
||||
plugins: ['dynamic-import-node']
|
||||
}
|
||||
}
|
||||
return {}
|
||||
}
|
@ -1,73 +0,0 @@
|
||||
|
||||
const { resolve } = require('path')
|
||||
const { existsSync } = require('fs')
|
||||
const consola = require('consola')
|
||||
const esm = require('esm')(module, {
|
||||
cache: false,
|
||||
cjs: {
|
||||
cache: true,
|
||||
vars: true,
|
||||
namedExports: true
|
||||
}
|
||||
})
|
||||
|
||||
const getRootDir = argv => resolve(argv._[0] || '.')
|
||||
const getNuxtConfigFile = argv => resolve(getRootDir(argv), argv['config-file'])
|
||||
const getLatestHost = (argv) => {
|
||||
const port =
|
||||
argv.port ||
|
||||
process.env.NUXT_PORT ||
|
||||
process.env.PORT ||
|
||||
process.env.npm_package_config_nuxt_port
|
||||
const host =
|
||||
argv.hostname ||
|
||||
process.env.NUXT_HOST ||
|
||||
process.env.HOST ||
|
||||
process.env.npm_package_config_nuxt_host
|
||||
const socket =
|
||||
argv['unix-socket'] ||
|
||||
process.env.UNIX_SOCKET ||
|
||||
process.env.npm_package_config_unix_socket
|
||||
|
||||
return { port, host, socket }
|
||||
}
|
||||
|
||||
exports.nuxtConfigFile = getNuxtConfigFile
|
||||
|
||||
exports.loadNuxtConfig = (argv) => {
|
||||
const rootDir = getRootDir(argv)
|
||||
const nuxtConfigFile = getNuxtConfigFile(argv)
|
||||
|
||||
let options = {}
|
||||
|
||||
if (existsSync(nuxtConfigFile)) {
|
||||
delete require.cache[nuxtConfigFile]
|
||||
options = esm(nuxtConfigFile)
|
||||
if (!options) {
|
||||
options = {}
|
||||
}
|
||||
if (options.default) {
|
||||
options = options.default
|
||||
}
|
||||
} else if (argv['config-file'] !== 'nuxt.config.js') {
|
||||
consola.fatal('Could not load config file: ' + argv['config-file'])
|
||||
}
|
||||
|
||||
if (typeof options.rootDir !== 'string') {
|
||||
options.rootDir = rootDir
|
||||
}
|
||||
|
||||
// Nuxt Mode
|
||||
options.mode =
|
||||
(argv.spa && 'spa') || (argv.universal && 'universal') || options.mode
|
||||
|
||||
// Server options
|
||||
if (!options.server) {
|
||||
options.server = {}
|
||||
}
|
||||
const { port, host, socket } = getLatestHost(argv)
|
||||
options.server.port = port || options.server.port || 3000
|
||||
options.server.host = host || options.server.host || 'localhost'
|
||||
options.server.socket = socket || options.server.socket
|
||||
return options
|
||||
}
|
32
bin/nuxt
32
bin/nuxt
@ -1,32 +0,0 @@
|
||||
#!/usr/bin/env node
|
||||
const { join } = require('path')
|
||||
|
||||
const consola = require('consola')
|
||||
|
||||
// Global error handler
|
||||
process.on('unhandledRejection', err => consola.error(err))
|
||||
|
||||
// Exit process on fatal errors
|
||||
consola.add({
|
||||
log(logObj) {
|
||||
if (logObj.type === 'fatal') {
|
||||
process.stderr.write('Nuxt Fatal Error :(\n')
|
||||
process.exit(1)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
const defaultCommand = 'dev'
|
||||
const commands = new Set([defaultCommand, 'init', 'build', 'start', 'generate'])
|
||||
|
||||
let cmd = process.argv[2]
|
||||
|
||||
if (commands.has(cmd)) {
|
||||
process.argv.splice(2, 1)
|
||||
} else {
|
||||
cmd = defaultCommand
|
||||
}
|
||||
|
||||
const bin = join(__dirname, 'nuxt-' + cmd)
|
||||
|
||||
require(bin)
|
@ -1,88 +0,0 @@
|
||||
#!/usr/bin/env node
|
||||
process.env.NODE_ENV = process.env.NODE_ENV || 'production'
|
||||
|
||||
const parseArgs = require('minimist')
|
||||
const consola = require('consola')
|
||||
const { Nuxt, Builder, Generator } = require('..')
|
||||
const { loadNuxtConfig } = require('./common/utils')
|
||||
|
||||
const argv = parseArgs(process.argv.slice(2), {
|
||||
alias: {
|
||||
h: 'help',
|
||||
c: 'config-file',
|
||||
a: 'analyze',
|
||||
s: 'spa',
|
||||
u: 'universal',
|
||||
q: 'quiet'
|
||||
},
|
||||
boolean: ['h', 'a', 's', 'u', 'q'],
|
||||
string: ['c'],
|
||||
default: {
|
||||
c: 'nuxt.config.js'
|
||||
}
|
||||
})
|
||||
|
||||
if (argv.help) {
|
||||
process.stderr.write(`
|
||||
Description
|
||||
Compiles the application for production deployment
|
||||
Usage
|
||||
$ nuxt build <dir>
|
||||
Options
|
||||
--analyze, -a Launch webpack-bundle-analyzer to optimize your bundles.
|
||||
--spa, -s Launch in SPA mode
|
||||
--universal, -u Launch in Universal mode (default)
|
||||
--no-generate Don't generate static version for SPA mode (useful for nuxt start)
|
||||
--config-file, -c Path to Nuxt.js config file (default: nuxt.config.js)
|
||||
--quiet, -q Disable output except for errors
|
||||
--help, -h Displays this message
|
||||
`)
|
||||
process.exit(0)
|
||||
}
|
||||
|
||||
const options = loadNuxtConfig(argv)
|
||||
|
||||
// Create production build when calling `nuxt build`
|
||||
options.dev = false
|
||||
|
||||
// Analyze option
|
||||
options.build = options.build || {}
|
||||
if (argv.analyze && typeof options.build.analyze !== 'object') {
|
||||
options.build.analyze = true
|
||||
}
|
||||
|
||||
// Silence output when using --quiet
|
||||
if (argv.quiet) {
|
||||
options.build.quiet = !!argv.quiet
|
||||
}
|
||||
|
||||
const nuxt = new Nuxt(options)
|
||||
const builder = new Builder(nuxt)
|
||||
|
||||
// Setup hooks
|
||||
nuxt.hook('error', err => consola.fatal(err))
|
||||
|
||||
// Close function
|
||||
const close = () => {
|
||||
// In analyze mode wait for plugin
|
||||
// emitting assets and opening browser
|
||||
if (options.build.analyze === true || typeof options.build.analyze === 'object') {
|
||||
return
|
||||
}
|
||||
|
||||
process.exit(0)
|
||||
}
|
||||
|
||||
if (options.mode !== 'spa' || argv.generate === false) {
|
||||
// Build only
|
||||
builder
|
||||
.build()
|
||||
.then(close)
|
||||
.catch(err => consola.fatal(err))
|
||||
} else {
|
||||
// Build + Generate for static deployment
|
||||
new Generator(nuxt, builder)
|
||||
.generate({ build: true })
|
||||
.then(close)
|
||||
.catch(err => consola.fatal(err))
|
||||
}
|
100
bin/nuxt-dev
100
bin/nuxt-dev
@ -1,100 +0,0 @@
|
||||
#!/usr/bin/env node
|
||||
process.env.NODE_ENV = process.env.NODE_ENV || 'development'
|
||||
|
||||
const parseArgs = require('minimist')
|
||||
const consola = require('consola')
|
||||
const { version } = require('../package.json')
|
||||
const { Nuxt, Builder } = require('..')
|
||||
const { loadNuxtConfig } = require('./common/utils')
|
||||
|
||||
const argv = parseArgs(process.argv.slice(2), {
|
||||
alias: {
|
||||
h: 'help',
|
||||
H: 'hostname',
|
||||
p: 'port',
|
||||
c: 'config-file',
|
||||
s: 'spa',
|
||||
u: 'universal',
|
||||
v: 'version'
|
||||
},
|
||||
boolean: ['h', 's', 'u', 'v'],
|
||||
string: ['H', 'c'],
|
||||
default: {
|
||||
c: 'nuxt.config.js'
|
||||
}
|
||||
})
|
||||
|
||||
if (argv.version) {
|
||||
process.stderr.write(version + '\n')
|
||||
process.exit(0)
|
||||
}
|
||||
|
||||
if (argv.hostname === '') {
|
||||
consola.fatal('Provided hostname argument has no value')
|
||||
}
|
||||
|
||||
if (argv.help) {
|
||||
process.stderr.write(`
|
||||
Description
|
||||
Starts the application in development mode (hot-code reloading, error
|
||||
reporting, etc)
|
||||
Usage
|
||||
$ nuxt dev <dir> -p <port number> -H <hostname>
|
||||
Options
|
||||
--port, -p A port number on which to start the application
|
||||
--hostname, -H Hostname on which to start the application
|
||||
--spa Launch in SPA mode
|
||||
--universal Launch in Universal mode (default)
|
||||
--config-file, -c Path to Nuxt.js config file (default: nuxt.config.js)
|
||||
--help, -h Displays this message
|
||||
`)
|
||||
process.exit(0)
|
||||
}
|
||||
|
||||
const config = () => {
|
||||
// Force development mode for add hot reloading and watching changes
|
||||
return Object.assign(loadNuxtConfig(argv), { dev: true })
|
||||
}
|
||||
|
||||
const errorHandler = (err, instance) => {
|
||||
instance && instance.builder.watchServer()
|
||||
consola.error(err)
|
||||
}
|
||||
|
||||
// Start dev
|
||||
(function startDev(oldInstance) {
|
||||
let nuxt, builder
|
||||
|
||||
try {
|
||||
nuxt = new Nuxt(config())
|
||||
builder = new Builder(nuxt)
|
||||
nuxt.hook('watch:fileChanged', (builder, fname) => {
|
||||
consola.debug(`[${fname}] changed, Rebuilding the app...`)
|
||||
startDev({ nuxt: builder.nuxt, builder })
|
||||
})
|
||||
} catch (err) {
|
||||
return errorHandler(err, oldInstance)
|
||||
}
|
||||
|
||||
return (
|
||||
Promise.resolve()
|
||||
.then(() => oldInstance && oldInstance.nuxt.clearHook('watch:fileChanged'))
|
||||
.then(() => oldInstance && oldInstance.builder.unwatch())
|
||||
// Start build
|
||||
.then(() => builder.build())
|
||||
// Close old nuxt no mater if build successfully
|
||||
.catch((err) => {
|
||||
oldInstance && oldInstance.nuxt.close()
|
||||
// Jump to eventHandler
|
||||
throw err
|
||||
})
|
||||
.then(() => oldInstance && oldInstance.nuxt.close())
|
||||
// Start listening
|
||||
.then(() => nuxt.listen())
|
||||
// Show ready message first time, others will be shown through WebpackBar
|
||||
.then(() => !oldInstance && nuxt.showReady(false))
|
||||
.then(() => builder.watchServer())
|
||||
// Handle errors
|
||||
.catch(err => errorHandler(err, { builder, nuxt }))
|
||||
)
|
||||
})()
|
@ -1,58 +0,0 @@
|
||||
#!/usr/bin/env node
|
||||
process.env.NODE_ENV = process.env.NODE_ENV || 'production'
|
||||
|
||||
const parseArgs = require('minimist')
|
||||
const consola = require('consola')
|
||||
const { Nuxt, Builder, Generator } = require('..')
|
||||
const { loadNuxtConfig } = require('./common/utils')
|
||||
|
||||
const argv = parseArgs(process.argv.slice(2), {
|
||||
alias: {
|
||||
h: 'help',
|
||||
c: 'config-file',
|
||||
s: 'spa',
|
||||
u: 'universal'
|
||||
},
|
||||
boolean: ['h', 's', 'u', 'build'],
|
||||
string: ['c'],
|
||||
default: {
|
||||
c: 'nuxt.config.js',
|
||||
build: true
|
||||
}
|
||||
})
|
||||
|
||||
if (argv.help) {
|
||||
process.stderr.write(`
|
||||
Description
|
||||
Generate a static web application (server-rendered)
|
||||
Usage
|
||||
$ nuxt generate <dir>
|
||||
Options
|
||||
--spa Launch in SPA mode
|
||||
--universal Launch in Universal mode (default)
|
||||
--config-file, -c Path to Nuxt.js config file (default: nuxt.config.js)
|
||||
--help, -h Displays this message
|
||||
--no-build Just run generate for faster builds when just dynamic routes changed. Nuxt build is needed before this command.
|
||||
`)
|
||||
process.exit(0)
|
||||
}
|
||||
|
||||
const options = loadNuxtConfig(argv)
|
||||
|
||||
options.dev = false // Force production mode (no webpack middleware called)
|
||||
|
||||
const nuxt = new Nuxt(options)
|
||||
const builder = new Builder(nuxt)
|
||||
const generator = new Generator(nuxt, builder)
|
||||
|
||||
const generateOptions = {
|
||||
init: true,
|
||||
build: argv.build
|
||||
}
|
||||
|
||||
generator
|
||||
.generate(generateOptions)
|
||||
.then(() => {
|
||||
process.exit(0)
|
||||
})
|
||||
.catch(err => consola.fatal(err))
|
@ -1,86 +0,0 @@
|
||||
#!/usr/bin/env node
|
||||
process.env.NODE_ENV = process.env.NODE_ENV || 'production'
|
||||
|
||||
const fs = require('fs')
|
||||
const { resolve } = require('path')
|
||||
const parseArgs = require('minimist')
|
||||
const consola = require('consola')
|
||||
const { Nuxt } = require('../dist/nuxt-start')
|
||||
const { loadNuxtConfig } = require('./common/utils')
|
||||
|
||||
const argv = parseArgs(process.argv.slice(2), {
|
||||
alias: {
|
||||
h: 'help',
|
||||
H: 'hostname',
|
||||
p: 'port',
|
||||
n: 'unix-socket',
|
||||
c: 'config-file',
|
||||
s: 'spa',
|
||||
u: 'universal'
|
||||
},
|
||||
boolean: ['h', 's', 'u'],
|
||||
string: ['H', 'c', 'n'],
|
||||
default: {
|
||||
c: 'nuxt.config.js'
|
||||
}
|
||||
})
|
||||
|
||||
if (argv.hostname === '') {
|
||||
consola.fatal('Provided hostname argument has no value')
|
||||
}
|
||||
|
||||
if (argv.help) {
|
||||
process.stderr.write(`
|
||||
Description
|
||||
Starts the application in production mode.
|
||||
The application should be compiled with \`nuxt build\` first.
|
||||
Usage
|
||||
$ nuxt start <dir> -p <port number> -H <hostname>
|
||||
Options
|
||||
--port, -p A port number on which to start the application
|
||||
--hostname, -H Hostname on which to start the application
|
||||
--unix-socket, -n Path to a UNIX socket
|
||||
--spa Launch in SPA mode
|
||||
--universal Launch in Universal mode (default)
|
||||
--config-file, -c Path to Nuxt.js config file (default: nuxt.config.js)
|
||||
--help, -h Displays this message
|
||||
`)
|
||||
process.exit(0)
|
||||
}
|
||||
|
||||
const options = loadNuxtConfig(argv)
|
||||
|
||||
// Force production mode (no webpack middleware called)
|
||||
options.dev = false
|
||||
|
||||
const nuxt = new Nuxt(options)
|
||||
|
||||
// Setup hooks
|
||||
nuxt.hook('error', err => consola.fatal(err))
|
||||
|
||||
// Check if project is built for production
|
||||
const distDir = resolve(
|
||||
nuxt.options.rootDir,
|
||||
nuxt.options.buildDir || '.nuxt',
|
||||
'dist',
|
||||
'server'
|
||||
)
|
||||
if (!fs.existsSync(distDir)) {
|
||||
consola.fatal(
|
||||
'No build files found, please run `nuxt build` before launching `nuxt start`'
|
||||
)
|
||||
}
|
||||
|
||||
// Check if SSR Bundle is required
|
||||
if (nuxt.options.render.ssr === true) {
|
||||
const ssrBundlePath = resolve(distDir, 'server-bundle.json')
|
||||
if (!fs.existsSync(ssrBundlePath)) {
|
||||
consola.fatal(
|
||||
'No SSR build! Please start with `nuxt start --spa` or build using `nuxt build --universal`'
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
nuxt.listen().then(() => {
|
||||
nuxt.showReady(false)
|
||||
})
|
50
distributions/nuxt-legacy/CHANGELOG.md
Normal file
50
distributions/nuxt-legacy/CHANGELOG.md
Normal file
@ -0,0 +1,50 @@
|
||||
# Change Log
|
||||
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
## 2.3.1 (2018-11-16)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **deps:** update all non-major dependencies ([#4253](https://github.com/nuxt/nuxt.js/issues/4253)) ([f10f860](https://github.com/nuxt/nuxt.js/commit/f10f860))
|
||||
* **deps:** update all non-major dependencies ([#4270](https://github.com/nuxt/nuxt.js/issues/4270)) ([1a154e8](https://github.com/nuxt/nuxt.js/commit/1a154e8))
|
||||
* **deps:** update all non-major dependencies ([#4271](https://github.com/nuxt/nuxt.js/issues/4271)) ([dd114ff](https://github.com/nuxt/nuxt.js/commit/dd114ff))
|
||||
* **deps:** update all non-major dependencies ([#4310](https://github.com/nuxt/nuxt.js/issues/4310)) ([bfb6d6a](https://github.com/nuxt/nuxt.js/commit/bfb6d6a))
|
||||
* **deps:** update dependency consola to ^2.2.0 ([#4269](https://github.com/nuxt/nuxt.js/issues/4269)) ([47f67cc](https://github.com/nuxt/nuxt.js/commit/47f67cc))
|
||||
* **distributions:** add bin to all distributions ([#4336](https://github.com/nuxt/nuxt.js/issues/4336)) ([c9459e7](https://github.com/nuxt/nuxt.js/commit/c9459e7))
|
||||
* **pkg:** stick [@nuxt](https://github.com/nuxt) dependency versions ([#4339](https://github.com/nuxt/nuxt.js/issues/4339)) ([ca5d538](https://github.com/nuxt/nuxt.js/commit/ca5d538))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* dx improvements ([#4259](https://github.com/nuxt/nuxt.js/issues/4259)) ([7c4e77f](https://github.com/nuxt/nuxt.js/commit/7c4e77f))
|
||||
* migrate nuxt into monorepo ([#4051](https://github.com/nuxt/nuxt.js/issues/4051)) ([9c1e0d1](https://github.com/nuxt/nuxt.js/commit/9c1e0d1))
|
||||
* split builder into more refined modules ([#4171](https://github.com/nuxt/nuxt.js/issues/4171)) ([9df5f49](https://github.com/nuxt/nuxt.js/commit/9df5f49))
|
||||
* update to consola 2 ([#4247](https://github.com/nuxt/nuxt.js/issues/4247)) ([1dd32d0](https://github.com/nuxt/nuxt.js/commit/1dd32d0))
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# 2.3.0 (2018-11-16)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **deps:** update all non-major dependencies ([#4253](https://github.com/nuxt/nuxt.js/issues/4253)) ([f10f860](https://github.com/nuxt/nuxt.js/commit/f10f860))
|
||||
* **deps:** update all non-major dependencies ([#4270](https://github.com/nuxt/nuxt.js/issues/4270)) ([1a154e8](https://github.com/nuxt/nuxt.js/commit/1a154e8))
|
||||
* **deps:** update all non-major dependencies ([#4271](https://github.com/nuxt/nuxt.js/issues/4271)) ([dd114ff](https://github.com/nuxt/nuxt.js/commit/dd114ff))
|
||||
* **deps:** update all non-major dependencies ([#4310](https://github.com/nuxt/nuxt.js/issues/4310)) ([bfb6d6a](https://github.com/nuxt/nuxt.js/commit/bfb6d6a))
|
||||
* **deps:** update dependency consola to ^2.2.0 ([#4269](https://github.com/nuxt/nuxt.js/issues/4269)) ([47f67cc](https://github.com/nuxt/nuxt.js/commit/47f67cc))
|
||||
* **distributions:** add bin to all distributions ([#4336](https://github.com/nuxt/nuxt.js/issues/4336)) ([c9459e7](https://github.com/nuxt/nuxt.js/commit/c9459e7))
|
||||
* **pkg:** stick [@nuxt](https://github.com/nuxt) dependency versions ([#4339](https://github.com/nuxt/nuxt.js/issues/4339)) ([ca5d538](https://github.com/nuxt/nuxt.js/commit/ca5d538))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* dx improvements ([#4259](https://github.com/nuxt/nuxt.js/issues/4259)) ([7c4e77f](https://github.com/nuxt/nuxt.js/commit/7c4e77f))
|
||||
* migrate nuxt into monorepo ([#4051](https://github.com/nuxt/nuxt.js/issues/4051)) ([9c1e0d1](https://github.com/nuxt/nuxt.js/commit/9c1e0d1))
|
||||
* split builder into more refined modules ([#4171](https://github.com/nuxt/nuxt.js/issues/4171)) ([9df5f49](https://github.com/nuxt/nuxt.js/commit/9df5f49))
|
||||
* update to consola 2 ([#4247](https://github.com/nuxt/nuxt.js/issues/4247)) ([1dd32d0](https://github.com/nuxt/nuxt.js/commit/1dd32d0))
|
27
distributions/nuxt-legacy/bin/nuxt-legacy.js
Executable file
27
distributions/nuxt-legacy/bin/nuxt-legacy.js
Executable file
@ -0,0 +1,27 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
const register = require('@babel/register')
|
||||
|
||||
require('@babel/polyfill')
|
||||
|
||||
register({
|
||||
presets: [
|
||||
[ '@babel/env', { targets: { node: 'current' } } ]
|
||||
],
|
||||
ignore: [
|
||||
(path) => {
|
||||
// Transpile known packages
|
||||
if (/(@nuxt|@nuxtjs)[\\/]/.test(path)) {
|
||||
return false
|
||||
}
|
||||
// Ignore everything else inside node_modules
|
||||
if (/node_modules/.test(path)) {
|
||||
return true
|
||||
}
|
||||
// Transpile project files
|
||||
return false
|
||||
}
|
||||
]
|
||||
})
|
||||
|
||||
require('@nuxt/cli').run()
|
23
distributions/nuxt-legacy/package.js
Normal file
23
distributions/nuxt-legacy/package.js
Normal file
@ -0,0 +1,23 @@
|
||||
export default {
|
||||
build: false,
|
||||
extend(pkg, { load }) {
|
||||
pkg.on('build:done', () => {
|
||||
const mono = load('../..')
|
||||
const nuxt = load('../nuxt')
|
||||
|
||||
pkg.copyFilesFrom(mono, [
|
||||
'LICENSE'
|
||||
])
|
||||
|
||||
pkg.copyFieldsFrom(nuxt, [
|
||||
'license',
|
||||
'repository',
|
||||
'contributors',
|
||||
'keywords',
|
||||
'collective'
|
||||
])
|
||||
|
||||
pkg.writePackage()
|
||||
})
|
||||
}
|
||||
}
|
66
distributions/nuxt-legacy/package.json
Normal file
66
distributions/nuxt-legacy/package.json
Normal file
@ -0,0 +1,66 @@
|
||||
{
|
||||
"name": "nuxt-legacy",
|
||||
"version": "2.3.1",
|
||||
"description": "Legacy build of Nuxt.js for Node.js < 8.0.0",
|
||||
"keywords": [
|
||||
"nuxt",
|
||||
"nuxt.js",
|
||||
"nuxtjs",
|
||||
"ssr",
|
||||
"vue",
|
||||
"vue isomorphic",
|
||||
"vue server side",
|
||||
"vue ssr",
|
||||
"vue universal",
|
||||
"vue versatile",
|
||||
"vue.js",
|
||||
"vuejs"
|
||||
],
|
||||
"homepage": "https://github.com/nuxt/nuxt.js#readme",
|
||||
"repository": "nuxt/nuxt.js",
|
||||
"license": "MIT",
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Sebastien Chopin (@Atinux)"
|
||||
},
|
||||
{
|
||||
"name": "Alexandre Chopin (@alexchopin)"
|
||||
},
|
||||
{
|
||||
"name": "Pooya Parsa (@pi0)"
|
||||
},
|
||||
{
|
||||
"name": "Clark Du (@clarkdo)"
|
||||
},
|
||||
{
|
||||
"name": "Jonas Galvez (@galvez)"
|
||||
},
|
||||
{
|
||||
"name": "Alexander Lichter (@manniL)"
|
||||
}
|
||||
],
|
||||
"files": [
|
||||
"bin"
|
||||
],
|
||||
"bin": "bin/nuxt-legacy.js",
|
||||
"dependencies": {
|
||||
"@babel/core": "^7.1.6",
|
||||
"@babel/polyfill": "^7.0.0",
|
||||
"@babel/preset-env": "^7.1.6",
|
||||
"@babel/register": "^7.0.0",
|
||||
"@nuxt/builder": "^2.3.1",
|
||||
"@nuxt/cli": "^2.3.1",
|
||||
"@nuxt/common": "^2.3.1",
|
||||
"@nuxt/core": "^2.3.1",
|
||||
"@nuxt/generator": "^2.3.1",
|
||||
"@nuxt/webpack": "^2.3.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6.0.0",
|
||||
"npm": ">=3.0.0"
|
||||
},
|
||||
"collective": {
|
||||
"url": "https://opencollective.com/nuxtjs",
|
||||
"logoUrl": "https://opencollective.com/nuxtjs/logo.txt?reverse=true&variant=variant2"
|
||||
}
|
||||
}
|
44
distributions/nuxt-start/CHANGELOG.md
Normal file
44
distributions/nuxt-start/CHANGELOG.md
Normal file
@ -0,0 +1,44 @@
|
||||
# Change Log
|
||||
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
## 2.3.1 (2018-11-16)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **deps:** update all non-major dependencies ([#4253](https://github.com/nuxt/nuxt.js/issues/4253)) ([f10f860](https://github.com/nuxt/nuxt.js/commit/f10f860))
|
||||
* **deps:** update all non-major dependencies ([#4270](https://github.com/nuxt/nuxt.js/issues/4270)) ([1a154e8](https://github.com/nuxt/nuxt.js/commit/1a154e8))
|
||||
* **deps:** update dependency consola to ^2.2.0 ([#4269](https://github.com/nuxt/nuxt.js/issues/4269)) ([47f67cc](https://github.com/nuxt/nuxt.js/commit/47f67cc))
|
||||
* **distributions:** add bin to all distributions ([#4336](https://github.com/nuxt/nuxt.js/issues/4336)) ([c9459e7](https://github.com/nuxt/nuxt.js/commit/c9459e7))
|
||||
* **pkg:** stick [@nuxt](https://github.com/nuxt) dependency versions ([#4339](https://github.com/nuxt/nuxt.js/issues/4339)) ([ca5d538](https://github.com/nuxt/nuxt.js/commit/ca5d538))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* dx improvements ([#4259](https://github.com/nuxt/nuxt.js/issues/4259)) ([7c4e77f](https://github.com/nuxt/nuxt.js/commit/7c4e77f))
|
||||
* migrate nuxt into monorepo ([#4051](https://github.com/nuxt/nuxt.js/issues/4051)) ([9c1e0d1](https://github.com/nuxt/nuxt.js/commit/9c1e0d1))
|
||||
* update to consola 2 ([#4247](https://github.com/nuxt/nuxt.js/issues/4247)) ([1dd32d0](https://github.com/nuxt/nuxt.js/commit/1dd32d0))
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# 2.3.0 (2018-11-16)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **deps:** update all non-major dependencies ([#4253](https://github.com/nuxt/nuxt.js/issues/4253)) ([f10f860](https://github.com/nuxt/nuxt.js/commit/f10f860))
|
||||
* **deps:** update all non-major dependencies ([#4270](https://github.com/nuxt/nuxt.js/issues/4270)) ([1a154e8](https://github.com/nuxt/nuxt.js/commit/1a154e8))
|
||||
* **deps:** update dependency consola to ^2.2.0 ([#4269](https://github.com/nuxt/nuxt.js/issues/4269)) ([47f67cc](https://github.com/nuxt/nuxt.js/commit/47f67cc))
|
||||
* **distributions:** add bin to all distributions ([#4336](https://github.com/nuxt/nuxt.js/issues/4336)) ([c9459e7](https://github.com/nuxt/nuxt.js/commit/c9459e7))
|
||||
* **pkg:** stick [@nuxt](https://github.com/nuxt) dependency versions ([#4339](https://github.com/nuxt/nuxt.js/issues/4339)) ([ca5d538](https://github.com/nuxt/nuxt.js/commit/ca5d538))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* dx improvements ([#4259](https://github.com/nuxt/nuxt.js/issues/4259)) ([7c4e77f](https://github.com/nuxt/nuxt.js/commit/7c4e77f))
|
||||
* migrate nuxt into monorepo ([#4051](https://github.com/nuxt/nuxt.js/issues/4051)) ([9c1e0d1](https://github.com/nuxt/nuxt.js/commit/9c1e0d1))
|
||||
* update to consola 2 ([#4247](https://github.com/nuxt/nuxt.js/issues/4247)) ([1dd32d0](https://github.com/nuxt/nuxt.js/commit/1dd32d0))
|
@ -32,7 +32,7 @@ const { Nuxt } = require('nuxt-start')
|
||||
// Require nuxt config
|
||||
const config = require('./nuxt.config.js')
|
||||
|
||||
// Create a new nuxt instance
|
||||
// Create a new nuxt instance (config needs dev: false)
|
||||
const nuxt = new Nuxt(config)
|
||||
|
||||
// Start nuxt.js server
|
5
distributions/nuxt-start/bin/nuxt-start.js
Executable file
5
distributions/nuxt-start/bin/nuxt-start.js
Executable file
@ -0,0 +1,5 @@
|
||||
#!/usr/bin/env node
|
||||
const { name } = require('../package.json')
|
||||
const isEdge = name.indexOf('-edge') !== -1
|
||||
const cli = require(isEdge ? '@nuxt/cli-edge' : '@nuxt/cli')
|
||||
cli.run()
|
23
distributions/nuxt-start/package.js
Normal file
23
distributions/nuxt-start/package.js
Normal file
@ -0,0 +1,23 @@
|
||||
export default {
|
||||
build: true,
|
||||
extend(pkg, { load }) {
|
||||
pkg.on('build:done', () => {
|
||||
const mono = load('../..')
|
||||
const nuxt = load('../nuxt')
|
||||
|
||||
pkg.copyFilesFrom(mono, [
|
||||
'LICENSE'
|
||||
])
|
||||
|
||||
pkg.copyFieldsFrom(nuxt, [
|
||||
'license',
|
||||
'repository',
|
||||
'contributors',
|
||||
'keywords',
|
||||
'engines'
|
||||
])
|
||||
|
||||
pkg.writePackage()
|
||||
})
|
||||
}
|
||||
}
|
57
distributions/nuxt-start/package.json
Normal file
57
distributions/nuxt-start/package.json
Normal file
@ -0,0 +1,57 @@
|
||||
{
|
||||
"name": "nuxt-start",
|
||||
"version": "2.3.1",
|
||||
"description": "Starts Nuxt.js Application in production mode",
|
||||
"keywords": [
|
||||
"nuxt",
|
||||
"nuxt.js",
|
||||
"nuxtjs",
|
||||
"ssr",
|
||||
"vue",
|
||||
"vue isomorphic",
|
||||
"vue server side",
|
||||
"vue ssr",
|
||||
"vue universal",
|
||||
"vue versatile",
|
||||
"vue.js",
|
||||
"vuejs"
|
||||
],
|
||||
"homepage": "https://github.com/nuxt/nuxt.js#readme",
|
||||
"repository": "nuxt/nuxt.js",
|
||||
"license": "MIT",
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Sebastien Chopin (@Atinux)"
|
||||
},
|
||||
{
|
||||
"name": "Alexandre Chopin (@alexchopin)"
|
||||
},
|
||||
{
|
||||
"name": "Pooya Parsa (@pi0)"
|
||||
},
|
||||
{
|
||||
"name": "Clark Du (@clarkdo)"
|
||||
},
|
||||
{
|
||||
"name": "Jonas Galvez (@galvez)"
|
||||
},
|
||||
{
|
||||
"name": "Alexander Lichter (@manniL)"
|
||||
}
|
||||
],
|
||||
"files": [
|
||||
"bin",
|
||||
"dist"
|
||||
],
|
||||
"main": "dist/nuxt-start.js",
|
||||
"bin": "bin/nuxt-start.js",
|
||||
"dependencies": {
|
||||
"@nuxt/cli": "^2.3.1",
|
||||
"@nuxt/common": "^2.3.1",
|
||||
"@nuxt/core": "^2.3.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8.0.0",
|
||||
"npm": ">=5.0.0"
|
||||
}
|
||||
}
|
1
distributions/nuxt-start/src/index.js
Normal file
1
distributions/nuxt-start/src/index.js
Normal file
@ -0,0 +1 @@
|
||||
export * from '@nuxt/core'
|
46
distributions/nuxt/CHANGELOG.md
Normal file
46
distributions/nuxt/CHANGELOG.md
Normal file
@ -0,0 +1,46 @@
|
||||
# Change Log
|
||||
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
## 2.3.1 (2018-11-16)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **deps:** update all non-major dependencies ([#4253](https://github.com/nuxt/nuxt.js/issues/4253)) ([f10f860](https://github.com/nuxt/nuxt.js/commit/f10f860))
|
||||
* **deps:** update all non-major dependencies ([#4270](https://github.com/nuxt/nuxt.js/issues/4270)) ([1a154e8](https://github.com/nuxt/nuxt.js/commit/1a154e8))
|
||||
* **deps:** update dependency consola to ^2.2.0 ([#4269](https://github.com/nuxt/nuxt.js/issues/4269)) ([47f67cc](https://github.com/nuxt/nuxt.js/commit/47f67cc))
|
||||
* **distributions:** add bin to all distributions ([#4336](https://github.com/nuxt/nuxt.js/issues/4336)) ([c9459e7](https://github.com/nuxt/nuxt.js/commit/c9459e7))
|
||||
* **pkg:** stick [@nuxt](https://github.com/nuxt) dependency versions ([#4339](https://github.com/nuxt/nuxt.js/issues/4339)) ([ca5d538](https://github.com/nuxt/nuxt.js/commit/ca5d538))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* dx improvements ([#4259](https://github.com/nuxt/nuxt.js/issues/4259)) ([7c4e77f](https://github.com/nuxt/nuxt.js/commit/7c4e77f))
|
||||
* migrate nuxt into monorepo ([#4051](https://github.com/nuxt/nuxt.js/issues/4051)) ([9c1e0d1](https://github.com/nuxt/nuxt.js/commit/9c1e0d1))
|
||||
* split builder into more refined modules ([#4171](https://github.com/nuxt/nuxt.js/issues/4171)) ([9df5f49](https://github.com/nuxt/nuxt.js/commit/9df5f49))
|
||||
* update to consola 2 ([#4247](https://github.com/nuxt/nuxt.js/issues/4247)) ([1dd32d0](https://github.com/nuxt/nuxt.js/commit/1dd32d0))
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# 2.3.0 (2018-11-16)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **deps:** update all non-major dependencies ([#4253](https://github.com/nuxt/nuxt.js/issues/4253)) ([f10f860](https://github.com/nuxt/nuxt.js/commit/f10f860))
|
||||
* **deps:** update all non-major dependencies ([#4270](https://github.com/nuxt/nuxt.js/issues/4270)) ([1a154e8](https://github.com/nuxt/nuxt.js/commit/1a154e8))
|
||||
* **deps:** update dependency consola to ^2.2.0 ([#4269](https://github.com/nuxt/nuxt.js/issues/4269)) ([47f67cc](https://github.com/nuxt/nuxt.js/commit/47f67cc))
|
||||
* **distributions:** add bin to all distributions ([#4336](https://github.com/nuxt/nuxt.js/issues/4336)) ([c9459e7](https://github.com/nuxt/nuxt.js/commit/c9459e7))
|
||||
* **pkg:** stick [@nuxt](https://github.com/nuxt) dependency versions ([#4339](https://github.com/nuxt/nuxt.js/issues/4339)) ([ca5d538](https://github.com/nuxt/nuxt.js/commit/ca5d538))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* dx improvements ([#4259](https://github.com/nuxt/nuxt.js/issues/4259)) ([7c4e77f](https://github.com/nuxt/nuxt.js/commit/7c4e77f))
|
||||
* migrate nuxt into monorepo ([#4051](https://github.com/nuxt/nuxt.js/issues/4051)) ([9c1e0d1](https://github.com/nuxt/nuxt.js/commit/9c1e0d1))
|
||||
* split builder into more refined modules ([#4171](https://github.com/nuxt/nuxt.js/issues/4171)) ([9df5f49](https://github.com/nuxt/nuxt.js/commit/9df5f49))
|
||||
* update to consola 2 ([#4247](https://github.com/nuxt/nuxt.js/issues/4247)) ([1dd32d0](https://github.com/nuxt/nuxt.js/commit/1dd32d0))
|
232
distributions/nuxt/README.md
Normal file
232
distributions/nuxt/README.md
Normal file
@ -0,0 +1,232 @@
|
||||
<p align="center"><img align="center" src="http://imgur.com/V4LtoII.png"/></p>
|
||||
<p align="center">
|
||||
<a href="https://circleci.com/gh/nuxt/nuxt.js"><img src="https://badgen.net/circleci/github/nuxt/nuxt.js/dev" alt="Build Status"></a>
|
||||
<a href="https://dev.azure.com/nuxt/nuxt.js/_build/latest?definitionId=1"><img src="https://dev.azure.com/nuxt/nuxt.js/_apis/build/status/nuxt.js" alt="Azure Build Status"></a>
|
||||
<a href="https://codecov.io/gh/nuxt/nuxt.js"><img src="https://badgen.net/codecov/c/github/nuxt/nuxt.js/dev" alt="Coverage Status"></a>
|
||||
<a href="https://www.npmjs.com/package/nuxt"><img src="https://badgen.net/npm/dm/nuxt" alt="Downloads"></a>
|
||||
<a href="https://www.npmjs.com/package/nuxt"><img src="https://badgen.net/npm/v/nuxt" alt="Version"></a>
|
||||
<a href="https://www.npmjs.com/package/nuxt"><img src="https://badgen.net/npm/license/nuxt" alt="License"></a>
|
||||
<a href="https://discord.nuxtjs.org/"><img src="https://badgen.net/badge/Discord/join-us/7289DA" alt="Discord"></a>
|
||||
</p>
|
||||
<p align="center">
|
||||
<a href="#partners" alt="Partner on Open Collective"><img src="https://opencollective.com/nuxtjs/tiers/partner/badge.svg" /></a>
|
||||
<a href="#sponsors" alt="Sponsors on Open Collective"><img src="https://opencollective.com/nuxtjs/tiers/sponsors/badge.svg" /></a>
|
||||
<a href="#backers" alt="Backers on Open Collective"><img src="https://opencollective.com/nuxtjs/tiers/backers/badge.svg" /></a>
|
||||
<a href="https://oc.nuxtjs.org/"><img src="https://img.shields.io/badge/Support%20us-Open%20Collective-41B883.svg" alt="Support us"></a>
|
||||
|
||||
</p>
|
||||
|
||||
> Vue.js Meta Framework to create complex, fast & universal web applications *quickly*.
|
||||
|
||||
## Links
|
||||
|
||||
- 📘 Documentation: [https://nuxtjs.org](https://nuxtjs.org)
|
||||
- 👥 Community: [cmty.app/nuxt](https://cmty.app/nuxt)
|
||||
- 🎬 Video: [1 minute demo](https://www.youtube.com/watch?v=kmf-p-pTi40)
|
||||
- 🐦 Twitter: [@nuxt_js](https://twitter.nuxtjs.org/)
|
||||
- 💬 Chat: [Discord](https://discord.nuxtjs.org/)
|
||||
- 📦 [Nuxt.js Modules](https://github.com/nuxt-community/modules)
|
||||
- 👉 [Play with Nuxt.js online](https://template.nuxtjs.org)
|
||||
|
||||
## Features
|
||||
|
||||
- Automatic transpilation and bundling (with webpack and babel)
|
||||
- Hot code reloading
|
||||
- Server-side rendering OR Single Page App OR Static Generated, you choose :fire:
|
||||
- Static file serving. `./static/` is mapped to `/`
|
||||
- Configurable with a `nuxt.config.js` file
|
||||
- Custom layouts with the `layouts/` directory
|
||||
- Middleware
|
||||
- Code splitting for every `pages/`
|
||||
|
||||
Learn more at [nuxtjs.org](https://nuxtjs.org).
|
||||
|
||||
## Professional support with TideLift
|
||||
|
||||
Professionally supported Nuxt.js is now available!
|
||||
|
||||
Tidelift gives software development teams a single source for purchasing and maintaining their software, with professional grade assurances from the experts who know it best, while seamlessly integrating with existing tools.
|
||||
|
||||
[Get supported Nuxt with the Tidelift Subscription](https://tidelift.com/subscription/pkg/npm-nuxt?utm_source=npm-nuxt&utm_medium=readme).
|
||||
|
||||
## Partners
|
||||
|
||||
Become a partner and get your logo on our README on GitHub and every page of https://nuxtjs.org website with a link to your site. [[Become a partner](https://opencollective.com/nuxtjs#partner)]
|
||||
|
||||
<a href="https://opencollective.com/nuxtjs#contributors"><img src="https://opencollective.com/nuxtjs/tiers/partner.svg?avatarHeight=96&width=890&button=false" /></a>
|
||||
|
||||
## Sponsors
|
||||
|
||||
Become a sponsor and get your logo on our README on GitHub with a link to your site. [[Become a sponsor](https://opencollective.com/nuxtjs#sponsor)]
|
||||
|
||||
<a href="https://opencollective.com/nuxtjs#contributors"><img src="https://opencollective.com/nuxtjs/tiers/sponsors.svg?avatarHeight=72&width=890&button=false" /></a>
|
||||
|
||||
## Backers
|
||||
|
||||
Support us with a monthly donation and help us continue our activities. [[Become a backer](https://opencollective.com/nuxtjs#backer)]
|
||||
|
||||
<a href="https://opencollective.com/nuxtjs#contributors"><img src="https://opencollective.com/nuxtjs/tiers/backers.svg?width=890&button=false" /></a>
|
||||
|
||||
## Getting started
|
||||
|
||||
```
|
||||
$ npm install nuxt
|
||||
```
|
||||
|
||||
Add a script to your package.json like this:
|
||||
|
||||
```json
|
||||
{
|
||||
"scripts": {
|
||||
"start": "nuxt"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
After that, the file-system is the main API. Every .vue file becomes a route that gets automatically processed and rendered.
|
||||
|
||||
Populate `./pages/index.vue` inside your project:
|
||||
|
||||
```html
|
||||
<template>
|
||||
<h1>Hello {{ name }}!</h1>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data: () => {
|
||||
return { name: 'world' }
|
||||
}
|
||||
}
|
||||
</script>
|
||||
```
|
||||
|
||||
And then run:
|
||||
```bash
|
||||
npm start
|
||||
```
|
||||
|
||||
Go to [http://localhost:3000](http://localhost:3000)
|
||||
|
||||
## Templates
|
||||
|
||||
:point_right: We recommend to start directly with our cli [create-nuxt-app](https://github.com/nuxt-community/create-nuxt-app) for the latest updates.
|
||||
|
||||
Or you can start by using one of our starter templates:
|
||||
- [starter](https://github.com/nuxt-community/starter-template): Basic Nuxt.js project template
|
||||
- [express](https://github.com/nuxt-community/express-template): Nuxt.js + Express
|
||||
- [koa](https://github.com/nuxt-community/koa-template): Nuxt.js + Koa
|
||||
- [adonuxt](https://github.com/nuxt-community/adonuxt-template): Nuxt.js + AdonisJS
|
||||
- [micro](https://github.com/nuxt-community/micro-template): Nuxt.js + Micro
|
||||
- [nuxtent](https://github.com/nuxt-community/nuxtent-template): Nuxt.js + Nuxtent module for content heavy sites
|
||||
|
||||
## Using nuxt.js programmatically
|
||||
|
||||
```js
|
||||
const { Nuxt, Builder } = require('nuxt')
|
||||
|
||||
// Import and set nuxt.js options
|
||||
let config = require('./nuxt.config.js')
|
||||
config.dev = (process.env.NODE_ENV !== 'production')
|
||||
|
||||
let nuxt = new Nuxt(config)
|
||||
|
||||
// Start build process (only in development)
|
||||
if (config.dev) {
|
||||
new Builder(nuxt).build()
|
||||
}
|
||||
|
||||
// You can use nuxt.render(req, res) or nuxt.renderRoute(route, context)
|
||||
```
|
||||
|
||||
Learn more: https://nuxtjs.org/api/nuxt
|
||||
|
||||
## Using nuxt.js as a middleware
|
||||
|
||||
You might want to use your own server with your configurations, your API and everything awesome your created with. That's why you can use nuxt.js as a middleware. It's recommended to use it at the end of your middleware since it will handle the rendering of your web application and won't call next().
|
||||
|
||||
```js
|
||||
app.use(nuxt.render)
|
||||
```
|
||||
|
||||
Learn more: https://nuxtjs.org/api/nuxt-render
|
||||
|
||||
## Render a specific route
|
||||
|
||||
This is mostly used for `nuxt generate` and test purposes but you might find another utility!
|
||||
|
||||
```js
|
||||
nuxt.renderRoute('/about', context)
|
||||
.then(function ({ html, error }) {
|
||||
// You can check error to know if your app displayed the error page for this route
|
||||
// Useful to set the correct status code if an error appended:
|
||||
if (error) {
|
||||
return res.status(error.statusCode || 500).send(html)
|
||||
}
|
||||
res.send(html)
|
||||
})
|
||||
.catch(function (error) {
|
||||
// And error appended while rendering the route
|
||||
})
|
||||
```
|
||||
|
||||
Learn more: https://nuxtjs.org/api/nuxt-render-route
|
||||
|
||||
## Examples
|
||||
|
||||
Please take a look at https://nuxtjs.org/examples or directly in https://github.com/nuxt/nuxt.js/tree/dev/examples.
|
||||
|
||||
## Production deployment
|
||||
|
||||
To deploy, instead of running nuxt, you probably want to build ahead of time. Therefore, building and starting are separate commands:
|
||||
|
||||
```bash
|
||||
nuxt build
|
||||
nuxt start
|
||||
```
|
||||
|
||||
For example, to deploy with [`now`](https://zeit.co/now) a `package.json` like follows is recommended:
|
||||
```json
|
||||
{
|
||||
"name": "my-app",
|
||||
"dependencies": {
|
||||
"nuxt": "latest"
|
||||
},
|
||||
"scripts": {
|
||||
"dev": "nuxt",
|
||||
"build": "nuxt build",
|
||||
"start": "nuxt start"
|
||||
}
|
||||
}
|
||||
```
|
||||
Then run `now` and enjoy!
|
||||
|
||||
Note: we recommend putting `.nuxt` in `.npmignore` or `.gitignore`.
|
||||
|
||||
## Core team
|
||||
|
||||
<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
|
||||
<!-- prettier-ignore -->
|
||||
| [<img src="https://avatars2.githubusercontent.com/u/904724?v=4" width="150px;"/><br /><sub><b>Sébastien Chopin</b></sub>](https://github.com/atinux)<br />[📝](#blog-Atinux "Blogposts") [🐛](https://github.com/Atinux/Nuxt.js/issues?q=author%3AAtinux "Bug reports") [💻](https://github.com/Atinux/Nuxt.js/commits?author=Atinux "Code") [🎨](#design-Atinux "Design") [📖](https://github.com/Atinux/Nuxt.js/commits?author=Atinux "Documentation") [💬](#question-Atinux "Answering Questions") [👀](#review-Atinux "Reviewed Pull Requests") [📢](#talk-Atinux "Talks") | [<img src="https://avatars2.githubusercontent.com/u/4084277?v=4" width="150px;"/><br /><sub><b>Alexandre Chopin</b></sub>](https://github.com/alexchopin)<br />[🎨](#design-alexchopin "Design") [📖](https://github.com/Atinux/Nuxt.js/commits?author=alexchopin "Documentation") [📋](#eventOrganizing-alexchopin "Event Organizing") [📦](#platform-alexchopin "Packaging/porting to new platform") [💬](#question-alexchopin "Answering Questions") [📢](#talk-alexchopin "Talks") | [<img src="https://avatars0.githubusercontent.com/u/5158436?v=4" width="150px;"/><br /><sub><b>Pooya Parsa</b></sub>](https://github.com/pi0)<br />[🐛](https://github.com/Atinux/Nuxt.js/issues?q=author%3Api0 "Bug reports") [💻](https://github.com/Atinux/Nuxt.js/commits?author=pi0 "Code") [🔌](#plugin-pi0 "Plugin/utility libraries") [💬](#question-pi0 "Answering Questions") [👀](#review-pi0 "Reviewed Pull Requests") [🔧](#tool-pi0 "Tools") | [<img src="https://avatars3.githubusercontent.com/u/4312154?v=4" width="150px;"/><br /><sub><b>Clark Du</b></sub>](https://github.com/clarkdo)<br />[🐛](https://github.com/Atinux/Nuxt.js/issues?q=author%3Aclarkdo "Bug reports") [💻](https://github.com/Atinux/Nuxt.js/commits?author=clarkdo "Code") [💡](#example-clarkdo "Examples") [👀](#review-clarkdo "Reviewed Pull Requests") [⚠️](https://github.com/Atinux/Nuxt.js/commits?author=clarkdo "Tests") [🔧](#tool-clarkdo "Tools") | [<img src="https://avatars0.githubusercontent.com/u/640208?s=460&v=4" width="150px;"/><br /><sub><b>Alexander Lichter</b></sub>](https://github.com/manniL)<br />[💬](#question-manniL "Answering Questions") [🐛](https://github.com/Atinux/Nuxt.js/issues?q=author%3AmanniL "Bug reports") [💻](https://github.com/Atinux/Nuxt.js/commits?author=manniL "Code") [💡](#example-manniL "Examples") [👀](#review-manniL "Reviewed Pull Requests") [⚠️](https://github.com/Atinux/Nuxt.js/commits?author=manniL "Tests") | [<img src="https://avatars1.githubusercontent.com/u/12291?s=460&v=4" width="150px;"/><br /><sub><b>Jonas Galvez</b></sub>](https://github.com/galvez)<br />[💬](#question-galvez "Answering Questions") [🐛](https://github.com/Atinux/Nuxt.js/issues?q=author%3Agalvez "Bug reports") [💻](https://github.com/Atinux/Nuxt.js/commits?author=galvez "Code") [💡](#example-galvez "Examples") [👀](#review-galvez "Reviewed Pull Requests") [⚠️](https://github.com/Atinux/Nuxt.js/commits?author=galvez "Tests") |
|
||||
| :---: | :---: | :---: | :---: | :---: | :---: |
|
||||
<!-- ALL-CONTRIBUTORS-LIST:END -->
|
||||
|
||||
## Contributors
|
||||
|
||||
Thank you to all our [contributors](https://github.com/nuxt/nuxt.js/graphs/contributors)!
|
||||
|
||||
<a href="https://github.com/nuxt/nuxt.js/graphs/contributors"><img src="https://opencollective.com/nuxtjs/contributors.svg?width=890&button=false" /></a>
|
||||
|
||||
## Contributing
|
||||
|
||||
Please refer to our [Contribution Guide](https://nuxtjs.org/guide/contribution-guide#codefund_ad)
|
||||
|
||||
## Cross-browser testing
|
||||
|
||||
Thanks to BrowserStack!
|
||||
|
||||
<a href="http://browserstack.com"><img height="70" src="https://p3.zdusercontent.com/attachment/1015988/PWfFdN71Aung2evRkIVQuKJpE?token=eyJhbGciOiJkaXIiLCJlbmMiOiJBMTI4Q0JDLUhTMjU2In0..aUrNFb8clSXsFwgw5BUTcg.IJr5piuCen7PmSSBHSrOnqM9K5YZfxX3lvbp-5LCqoKOi4CjjgdA419iqjofs0nLtm26FMURvZ8JRTuKB4iHer6lGu5f8dXHtIkYAHjP5fXDWkl044Yg2mSdrhF6uPy62GdlBYoYxwvgkNrac8nN_In8GY-qOC7bYmlZyJT7tsTZUTYbNMQiXS86YA5LgdCEWzWreMvc3C6cvZtVXIrcVgpkroIhvsTQPm4vQA-Uq6iCbTPA4oX5cpEtMtrlg4jYBnnAE4BTw5UwU_dY83ep5g.7wpc1IKv0rSRGsvqCG_q3g" alt="BrowserStack"></a>
|
||||
|
||||
## License
|
||||
|
||||
[MIT](https://github.com/nuxt/nuxt.js/blob/dev/LICENSE)
|
5
distributions/nuxt/bin/nuxt.js
Executable file
5
distributions/nuxt/bin/nuxt.js
Executable file
@ -0,0 +1,5 @@
|
||||
#!/usr/bin/env node
|
||||
const { name } = require('../package.json')
|
||||
const isEdge = name.indexOf('-edge') !== -1
|
||||
const cli = require(isEdge ? '@nuxt/cli-edge' : '@nuxt/cli')
|
||||
cli.run()
|
12
distributions/nuxt/package.js
Normal file
12
distributions/nuxt/package.js
Normal file
@ -0,0 +1,12 @@
|
||||
export default {
|
||||
build: true,
|
||||
extend(pkg, { load }) {
|
||||
pkg.on('build:done', () => {
|
||||
const mono = load('../..')
|
||||
|
||||
pkg.copyFilesFrom(mono, [
|
||||
'LICENSE'
|
||||
])
|
||||
})
|
||||
}
|
||||
}
|
66
distributions/nuxt/package.json
Normal file
66
distributions/nuxt/package.json
Normal file
@ -0,0 +1,66 @@
|
||||
{
|
||||
"name": "nuxt",
|
||||
"version": "2.3.1",
|
||||
"description": "A minimalistic framework for server-rendered Vue.js applications (inspired by Next.js)",
|
||||
"keywords": [
|
||||
"nuxt",
|
||||
"nuxt.js",
|
||||
"nuxtjs",
|
||||
"ssr",
|
||||
"vue",
|
||||
"vue isomorphic",
|
||||
"vue server side",
|
||||
"vue ssr",
|
||||
"vue universal",
|
||||
"vue versatile",
|
||||
"vue.js",
|
||||
"vuejs"
|
||||
],
|
||||
"repository": "nuxt/nuxt.js",
|
||||
"license": "MIT",
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Sebastien Chopin (@Atinux)"
|
||||
},
|
||||
{
|
||||
"name": "Alexandre Chopin (@alexchopin)"
|
||||
},
|
||||
{
|
||||
"name": "Pooya Parsa (@pi0)"
|
||||
},
|
||||
{
|
||||
"name": "Clark Du (@clarkdo)"
|
||||
},
|
||||
{
|
||||
"name": "Jonas Galvez (@galvez)"
|
||||
},
|
||||
{
|
||||
"name": "Alexander Lichter (@manniL)"
|
||||
}
|
||||
],
|
||||
"files": [
|
||||
"bin",
|
||||
"dist"
|
||||
],
|
||||
"main": "dist/nuxt.js",
|
||||
"bin": "bin/nuxt.js",
|
||||
"scripts": {
|
||||
"postinstall": "opencollective || exit 0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@nuxt/builder": "^2.3.1",
|
||||
"@nuxt/cli": "^2.3.1",
|
||||
"@nuxt/common": "^2.3.1",
|
||||
"@nuxt/core": "^2.3.1",
|
||||
"@nuxt/generator": "^2.3.1",
|
||||
"@nuxt/webpack": "^2.3.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8.0.0",
|
||||
"npm": ">=5.0.0"
|
||||
},
|
||||
"collective": {
|
||||
"url": "https://opencollective.com/nuxtjs",
|
||||
"logoUrl": "https://opencollective.com/nuxtjs/logo.txt?reverse=true&variant=variant2"
|
||||
}
|
||||
}
|
3
distributions/nuxt/src/index.js
Normal file
3
distributions/nuxt/src/index.js
Normal file
@ -0,0 +1,3 @@
|
||||
export * from '@nuxt/core'
|
||||
export * from '@nuxt/builder'
|
||||
export * from '@nuxt/generator'
|
@ -3,7 +3,7 @@
|
||||
<p>About Page</p>
|
||||
<p>It should take 5 seconds for the loader to disappear</p>
|
||||
<p>It should take 5 seconds for the route to change after you
|
||||
<span class="link" @click="goToFinal">click here</span></p>
|
||||
<span class="link" @click="goToFinal">click here</span></p>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
39
examples/jest-puppeteer/README.md
Executable file
39
examples/jest-puppeteer/README.md
Executable file
@ -0,0 +1,39 @@
|
||||
# Example how to test Nuxt.js app with Jest and Puppeteer
|
||||
|
||||
# Install deps
|
||||
```
|
||||
npm install
|
||||
```
|
||||
|
||||
# Run tests
|
||||
```
|
||||
npm run test
|
||||
```
|
||||
|
||||
## It will
|
||||
- Build app
|
||||
- Run server
|
||||
- Run tests
|
||||
|
||||
### Output
|
||||
```
|
||||
PASS test/index.spec.js
|
||||
Index page
|
||||
√ test index title (53ms)
|
||||
√ test navigate to about page (2ms)
|
||||
|
||||
Test Suites: 1 passed, 1 total
|
||||
Tests: 2 passed, 2 total
|
||||
Snapshots: 2 passed, 2 total
|
||||
Time: 0.992s, estimated 1s
|
||||
Ran all test suites.
|
||||
```
|
||||
|
||||
## Check configuration files:
|
||||
- `jest.config.js`
|
||||
- `jest-puppeteer.config.js`
|
||||
|
||||
## Documentation
|
||||
- [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer)
|
||||
- [jest]()
|
||||
- [puppeteer](https://pptr.dev/)
|
10
examples/jest-puppeteer/jest-puppeteer.config.js
Executable file
10
examples/jest-puppeteer/jest-puppeteer.config.js
Executable file
@ -0,0 +1,10 @@
|
||||
module.exports = {
|
||||
launch: {
|
||||
headless: process.env.HEADLESS !== 'false'
|
||||
},
|
||||
server: {
|
||||
command: 'npm run testServer',
|
||||
port: 3000,
|
||||
launchTimeout: 50000
|
||||
}
|
||||
}
|
4
examples/jest-puppeteer/jest.config.js
Executable file
4
examples/jest-puppeteer/jest.config.js
Executable file
@ -0,0 +1,4 @@
|
||||
module.exports = {
|
||||
verbose: true,
|
||||
preset: 'jest-puppeteer'
|
||||
}
|
18
examples/jest-puppeteer/package.json
Executable file
18
examples/jest-puppeteer/package.json
Executable file
@ -0,0 +1,18 @@
|
||||
{
|
||||
"name": "example-jest-puppeteer",
|
||||
"dependencies": {
|
||||
"nuxt": "latest"
|
||||
},
|
||||
"scripts": {
|
||||
"dev": "nuxt",
|
||||
"build": "nuxt build",
|
||||
"start": "nuxt start",
|
||||
"test": "jest -w=4",
|
||||
"testServer": "nuxt build & nuxt start"
|
||||
},
|
||||
"devDependencies": {
|
||||
"jest": "latest",
|
||||
"jest-puppeteer": "latest",
|
||||
"puppeteer": "latest"
|
||||
}
|
||||
}
|
19
examples/jest-puppeteer/pages/about.vue
Executable file
19
examples/jest-puppeteer/pages/about.vue
Executable file
@ -0,0 +1,19 @@
|
||||
<template>
|
||||
<div>
|
||||
<p id="hello-msg">Hi from {{ name }}</p>
|
||||
<nuxt-link to="/">Home page</nuxt-link>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
asyncData() {
|
||||
return {
|
||||
name: process.static ? 'static' : (process.server ? 'server' : 'client')
|
||||
}
|
||||
},
|
||||
head: {
|
||||
title: 'About page'
|
||||
}
|
||||
}
|
||||
</script>
|
14
examples/jest-puppeteer/pages/index.vue
Executable file
14
examples/jest-puppeteer/pages/index.vue
Executable file
@ -0,0 +1,14 @@
|
||||
<template>
|
||||
<div>
|
||||
<h1>Welcome!</h1>
|
||||
<nuxt-link id="about-link" to="/about">About page</nuxt-link>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
head: {
|
||||
title: 'Home page'
|
||||
}
|
||||
}
|
||||
</script>
|
5
examples/jest-puppeteer/test/__snapshots__/index.spec.js.snap
Executable file
5
examples/jest-puppeteer/test/__snapshots__/index.spec.js.snap
Executable file
@ -0,0 +1,5 @@
|
||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`Index page test index title: index.title 1`] = `"Home page"`;
|
||||
|
||||
exports[`Index page test navigation to about page: about.msg 1`] = `"Hi from client"`;
|
32
examples/jest-puppeteer/test/index.spec.js
Executable file
32
examples/jest-puppeteer/test/index.spec.js
Executable file
@ -0,0 +1,32 @@
|
||||
const devices = require('puppeteer/DeviceDescriptors')
|
||||
const iPhone = devices['iPhone 6']
|
||||
|
||||
const BASE_URL = 'http://127.0.0.1:3000'
|
||||
|
||||
describe('Index page', () => {
|
||||
let page
|
||||
beforeAll(async () => {
|
||||
// eslint-disable-next-line no-undef
|
||||
page = await browser.newPage()
|
||||
await page.emulate(iPhone)
|
||||
await page.goto(BASE_URL)
|
||||
})
|
||||
|
||||
afterAll(async () => {
|
||||
await page.close()
|
||||
})
|
||||
|
||||
it('test index title', async () => {
|
||||
expect.assertions(1)
|
||||
const title = await page.evaluate(() => document.title)
|
||||
expect(title).toMatchSnapshot('index.title')
|
||||
})
|
||||
|
||||
it('test navigation to about page', async () => {
|
||||
expect.assertions(1)
|
||||
await page.click('a#about-link')
|
||||
await page.waitForSelector('p#hello-msg')
|
||||
const msg = await page.$eval('p#hello-msg', e => e.textContent)
|
||||
expect(msg).toMatchSnapshot('about.msg')
|
||||
})
|
||||
})
|
1
examples/jest-vtu-example/.eslintignore
Normal file
1
examples/jest-vtu-example/.eslintignore
Normal file
@ -0,0 +1 @@
|
||||
*.spec.js.snap
|
14
examples/jest-vtu-example/.gitignore
vendored
Normal file
14
examples/jest-vtu-example/.gitignore
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
# dependencies
|
||||
node_modules
|
||||
|
||||
# logs
|
||||
npm-debug.log
|
||||
|
||||
# Nuxt build
|
||||
.nuxt
|
||||
|
||||
# Nuxt generate
|
||||
dist
|
||||
|
||||
# coverage report
|
||||
coverage/
|
9
examples/jest-vtu-example/README.md
Normal file
9
examples/jest-vtu-example/README.md
Normal file
@ -0,0 +1,9 @@
|
||||
# Jest + Vue Test Utils example
|
||||
|
||||
```sh
|
||||
# Install dependencies
|
||||
npm i # or yarn
|
||||
|
||||
# Run tests
|
||||
npm test
|
||||
```
|
7
examples/jest-vtu-example/babel.config.js
Normal file
7
examples/jest-vtu-example/babel.config.js
Normal file
@ -0,0 +1,7 @@
|
||||
module.exports = {
|
||||
env: {
|
||||
test: {
|
||||
presets: ['@babel/preset-env']
|
||||
}
|
||||
}
|
||||
}
|
36
examples/jest-vtu-example/components/Btn/Btn.spec.js
Normal file
36
examples/jest-vtu-example/components/Btn/Btn.spec.js
Normal file
@ -0,0 +1,36 @@
|
||||
import { shallowMount } from '@vue/test-utils'
|
||||
import Btn from './Btn'
|
||||
|
||||
const factory = () => shallowMount(Btn, {
|
||||
propsData: {
|
||||
label: 'click me!'
|
||||
}
|
||||
})
|
||||
|
||||
describe('Btn', () => {
|
||||
test('mounts properly', () => {
|
||||
const wrapper = factory()
|
||||
expect(wrapper.isVueInstance()).toBeTruthy()
|
||||
})
|
||||
|
||||
test('renders properly', () => {
|
||||
const wrapper = factory()
|
||||
expect(wrapper.html()).toMatchSnapshot()
|
||||
})
|
||||
|
||||
test('calls handleClick on click', () => {
|
||||
const wrapper = factory()
|
||||
const handleClickMock = jest.fn()
|
||||
wrapper.setMethods({
|
||||
handleClick: handleClickMock
|
||||
})
|
||||
wrapper.find('button').trigger('click')
|
||||
expect(handleClickMock).toHaveBeenCalled()
|
||||
})
|
||||
|
||||
test('clicked is true after click', () => {
|
||||
const wrapper = factory()
|
||||
wrapper.find('button').trigger('click')
|
||||
expect(wrapper.vm.clicked).toBe(true)
|
||||
})
|
||||
})
|
25
examples/jest-vtu-example/components/Btn/Btn.vue
Normal file
25
examples/jest-vtu-example/components/Btn/Btn.vue
Normal file
@ -0,0 +1,25 @@
|
||||
<template>
|
||||
<button @click="handleClick">
|
||||
{{ label }}
|
||||
</button>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'Button',
|
||||
props: {
|
||||
label: {
|
||||
type: String,
|
||||
required: true
|
||||
}
|
||||
},
|
||||
data: () => ({
|
||||
clicked: false
|
||||
}),
|
||||
methods: {
|
||||
handleClick() {
|
||||
this.clicked = true
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
@ -0,0 +1,7 @@
|
||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`Btn renders properly 1`] = `
|
||||
<button>
|
||||
click me!
|
||||
</button>
|
||||
`;
|
5
examples/jest-vtu-example/layouts/default.vue
Normal file
5
examples/jest-vtu-example/layouts/default.vue
Normal file
@ -0,0 +1,5 @@
|
||||
<template>
|
||||
<div>
|
||||
<nuxt />
|
||||
</div>
|
||||
</template>
|
3
examples/jest-vtu-example/nuxt.config.js
Normal file
3
examples/jest-vtu-example/nuxt.config.js
Normal file
@ -0,0 +1,3 @@
|
||||
export default {
|
||||
mode: 'universal'
|
||||
}
|
46
examples/jest-vtu-example/package.json
Normal file
46
examples/jest-vtu-example/package.json
Normal file
@ -0,0 +1,46 @@
|
||||
{
|
||||
"name": "example-jest-vtu",
|
||||
"scripts": {
|
||||
"dev": "nuxt",
|
||||
"build": "nuxt build",
|
||||
"start": "nuxt start",
|
||||
"generate": "nuxt generate",
|
||||
"test": "jest ."
|
||||
},
|
||||
"dependencies": {
|
||||
"nuxt-edge": "latest"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.1.2",
|
||||
"@vue/test-utils": "^1.0.0-beta.25",
|
||||
"babel-core": "^7.0.0-bridge.0",
|
||||
"babel-jest": "^23.6.0",
|
||||
"jest": "^23.6.0",
|
||||
"jest-serializer-vue": "^2.0.2",
|
||||
"vue-jest": "^2.6.0"
|
||||
},
|
||||
"jest": {
|
||||
"moduleFileExtensions": [
|
||||
"js",
|
||||
"json",
|
||||
"vue"
|
||||
],
|
||||
"watchman": false,
|
||||
"moduleNameMapper": {
|
||||
"^~/(.*)$": "<rootDir>/$1",
|
||||
"^~~/(.*)$": "<rootDir>/$1"
|
||||
},
|
||||
"transform": {
|
||||
"^.+\\.js$": "<rootDir>/node_modules/babel-jest",
|
||||
".*\\.(vue)$": "<rootDir>/node_modules/vue-jest"
|
||||
},
|
||||
"snapshotSerializers": [
|
||||
"<rootDir>/node_modules/jest-serializer-vue"
|
||||
],
|
||||
"collectCoverage": true,
|
||||
"collectCoverageFrom": [
|
||||
"<rootDir>/components/**/*.vue",
|
||||
"<rootDir>/pages/*.vue"
|
||||
]
|
||||
}
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`index renders properly 1`] = `
|
||||
<section class="container">
|
||||
<div>
|
||||
<h1 class="title">
|
||||
jest-vtu-example
|
||||
</h1>
|
||||
<btn-stub label="click me!"></btn-stub>
|
||||
</div>
|
||||
</section>
|
||||
`;
|
14
examples/jest-vtu-example/pages/index.spec.js
Normal file
14
examples/jest-vtu-example/pages/index.spec.js
Normal file
@ -0,0 +1,14 @@
|
||||
import { shallowMount } from '@vue/test-utils'
|
||||
import index from './index'
|
||||
|
||||
describe('index', () => {
|
||||
test('mounts properly', () => {
|
||||
const wrapper = shallowMount(index)
|
||||
expect(wrapper.isVueInstance()).toBeTruthy()
|
||||
})
|
||||
|
||||
test('renders properly', () => {
|
||||
const wrapper = shallowMount(index)
|
||||
expect(wrapper.html()).toMatchSnapshot()
|
||||
})
|
||||
})
|
20
examples/jest-vtu-example/pages/index.vue
Normal file
20
examples/jest-vtu-example/pages/index.vue
Normal file
@ -0,0 +1,20 @@
|
||||
<template>
|
||||
<section class="container">
|
||||
<div>
|
||||
<h1 class="title">
|
||||
jest-vtu-example
|
||||
</h1>
|
||||
<Btn label="click me!" />
|
||||
</div>
|
||||
</section>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import Btn from '~/components/Btn/Btn.vue'
|
||||
|
||||
export default {
|
||||
components: {
|
||||
Btn
|
||||
}
|
||||
}
|
||||
</script>
|
@ -6,7 +6,7 @@
|
||||
meta: {
|
||||
theme: 'dark'
|
||||
}
|
||||
}</pre>
|
||||
}</pre> <!-- eslint-disable-line --> <!-- TODO remove disable lint after https://github.com/vuejs/eslint-plugin-vue/pull/659 -->
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
@ -43,7 +43,8 @@
|
||||
<v-card-text class="px-0"><slot /></v-card-text>
|
||||
</v-card>
|
||||
</v-flex>
|
||||
</v-layout></v-container>
|
||||
</v-layout>
|
||||
</v-container>
|
||||
|
||||
<v-container fluid fill-height>
|
||||
<v-layout justify-center align-center>
|
||||
|
BIN
examples/tailwindcss-purgecss/.github/demo.png
vendored
Normal file
BIN
examples/tailwindcss-purgecss/.github/demo.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 78 KiB |
BIN
examples/tailwindcss-purgecss/.github/pagespeed-desktop.png
vendored
Normal file
BIN
examples/tailwindcss-purgecss/.github/pagespeed-desktop.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 148 KiB |
BIN
examples/tailwindcss-purgecss/.github/pagespeed-mobile.png
vendored
Normal file
BIN
examples/tailwindcss-purgecss/.github/pagespeed-mobile.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 175 KiB |
BIN
examples/tailwindcss-purgecss/.github/tailwind-default.png
vendored
Normal file
BIN
examples/tailwindcss-purgecss/.github/tailwind-default.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 26 KiB |
BIN
examples/tailwindcss-purgecss/.github/tailwind-purgecss.png
vendored
Normal file
BIN
examples/tailwindcss-purgecss/.github/tailwind-purgecss.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 25 KiB |
5
examples/tailwindcss-purgecss/.gitignore
vendored
Normal file
5
examples/tailwindcss-purgecss/.gitignore
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
node_modules
|
||||
.nuxt
|
||||
dist
|
||||
*.log
|
||||
.DS_Store
|
23
examples/tailwindcss-purgecss/README.md
Normal file
23
examples/tailwindcss-purgecss/README.md
Normal file
@ -0,0 +1,23 @@
|
||||
# Nuxt Tailwind CSS + Purgecss
|
||||
|
||||
> Demo of using Nuxt with Tailwind CSS and Purgecss to drastically reduce CSS size.
|
||||
|
||||
## Demo
|
||||
|
||||
[https://nuxt-tailwindcss-purgecss.surge.sh/](https://nuxt-tailwindcss-purgecss.surge.sh/)
|
||||
|
||||
![demo](.github/demo.png)
|
||||
|
||||
### Before and after stats
|
||||
|
||||
The before CSS bundle came out to `299kb`, where as after running it through Purgecss, it dropped to `3kb` (granted I'm only using around a dozen classes).
|
||||
|
||||
![tailwind default](.github/tailwind-default.png)
|
||||
![tailwind purgecss](.github/tailwind-purgecss.png)
|
||||
|
||||
### Performance
|
||||
|
||||
And since the CSS remains inline (due to using Purgecss as a postcss plugin) it scores perfect on Google Page Speed Insights! (This is after running `nuxt generate` and deploying the `dist` folder)
|
||||
|
||||
![pagespeed mobile](.github/pagespeed-mobile.png)
|
||||
![pagespeed desktop](.github/pagespeed-desktop.png)
|
63
examples/tailwindcss-purgecss/assets/css/tailwind.css
Normal file
63
examples/tailwindcss-purgecss/assets/css/tailwind.css
Normal file
@ -0,0 +1,63 @@
|
||||
/**
|
||||
* This injects Tailwind's base styles, which is a combination of
|
||||
* Normalize.css and some additional base styles.
|
||||
*
|
||||
* You can see the styles here:
|
||||
* https://github.com/tailwindcss/tailwindcss/blob/master/css/preflight.css
|
||||
*
|
||||
* If using `postcss-import`, use this import instead:
|
||||
*
|
||||
* @import "tailwindcss/preflight";
|
||||
*/
|
||||
@tailwind preflight;
|
||||
|
||||
/**
|
||||
* This injects any component classes registered by plugins.
|
||||
*
|
||||
* If using `postcss-import`, use this import instead:
|
||||
*
|
||||
* @import "tailwindcss/components";
|
||||
*/
|
||||
@tailwind components;
|
||||
|
||||
/**
|
||||
* Here you would add any of your custom component classes; stuff that you'd
|
||||
* want loaded *before* the utilities so that the utilities could still
|
||||
* override them.
|
||||
*
|
||||
* Example:
|
||||
*
|
||||
* .btn { ... }
|
||||
* .form-input { ... }
|
||||
*
|
||||
* Or if using a preprocessor or `postcss-import`:
|
||||
*
|
||||
* @import "components/buttons";
|
||||
* @import "components/forms";
|
||||
*/
|
||||
|
||||
/**
|
||||
* This injects all of Tailwind's utility classes, generated based on your
|
||||
* config file.
|
||||
*
|
||||
* If using `postcss-import`, use this import instead:
|
||||
*
|
||||
* @import "tailwindcss/utilities";
|
||||
*/
|
||||
@tailwind utilities;
|
||||
|
||||
/**
|
||||
* Here you would add any custom utilities you need that don't come out of the
|
||||
* box with Tailwind.
|
||||
*
|
||||
* Example :
|
||||
*
|
||||
* .bg-pattern-graph-paper { ... }
|
||||
* .skew-45 { ... }
|
||||
*
|
||||
* Or if using a preprocessor or `postcss-import`:
|
||||
*
|
||||
* @import "utilities/background-patterns";
|
||||
* @import "utilities/skew-transforms";
|
||||
*/
|
||||
|
5
examples/tailwindcss-purgecss/components/MyComponent.vue
Normal file
5
examples/tailwindcss-purgecss/components/MyComponent.vue
Normal file
@ -0,0 +1,5 @@
|
||||
<template>
|
||||
<div>
|
||||
<button class="bg-blue hover:bg-blue-dark text-white font-bold py-2 px-4 rounded">My Component Button</button>
|
||||
</div>
|
||||
</template>
|
6
examples/tailwindcss-purgecss/layouts/default.vue
Normal file
6
examples/tailwindcss-purgecss/layouts/default.vue
Normal file
@ -0,0 +1,6 @@
|
||||
<template>
|
||||
<div class="p-10">
|
||||
<h1 class="mb-6">Nuxt Tailwind CSS + Purgecss</h1>
|
||||
<nuxt />
|
||||
</div>
|
||||
</template>
|
16
examples/tailwindcss-purgecss/nuxt.config.js
Normal file
16
examples/tailwindcss-purgecss/nuxt.config.js
Normal file
@ -0,0 +1,16 @@
|
||||
export default {
|
||||
head: {
|
||||
title: 'Nuxt Tailwind CSS + Purgecss',
|
||||
meta: [
|
||||
{ charset: 'utf-8' },
|
||||
{ name: 'viewport', content: 'width=device-width, initial-scale=1' },
|
||||
{
|
||||
hid: 'description',
|
||||
name: 'description',
|
||||
content: 'A static site powered by Nuxt.js'
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
css: ['~/assets/css/tailwind.css']
|
||||
}
|
26
examples/tailwindcss-purgecss/package.json
Normal file
26
examples/tailwindcss-purgecss/package.json
Normal file
@ -0,0 +1,26 @@
|
||||
{
|
||||
"name": "tailwindcss-purgecss",
|
||||
"version": "1.0.0",
|
||||
"main": "index.js",
|
||||
"license": "MIT",
|
||||
"scripts": {
|
||||
"dev": "nuxt",
|
||||
"build": "nuxt build",
|
||||
"start": "nuxt start",
|
||||
"generate": "nuxt generate",
|
||||
"deploy": "surge -p dist/ -d https://nuxt-tailwindcss-purgecss.surge.sh"
|
||||
},
|
||||
"dependencies": {
|
||||
"nuxt": "^2.2.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@fullhuman/postcss-purgecss": "^1.1.0",
|
||||
"autoprefixer": "^9.3.1",
|
||||
"tailwindcss": "^0.6.6"
|
||||
},
|
||||
"prettier": {
|
||||
"semi": false,
|
||||
"singleQuote": true,
|
||||
"trailingComma": "none"
|
||||
}
|
||||
}
|
17
examples/tailwindcss-purgecss/pages/index.vue
Normal file
17
examples/tailwindcss-purgecss/pages/index.vue
Normal file
@ -0,0 +1,17 @@
|
||||
<template>
|
||||
<div>
|
||||
<h2 class="mb-4 text-blue">Homepage</h2>
|
||||
<p class="mb-4 bg-grey-light p-4 text-sm rounded leading-normal">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed ut dolor placerat enim suscipit porttitor et sodales orci. In eget lorem a odio rhoncus finibus vel quis ex. Donec varius nisl ligula, vel finibus velit dignissim in.</p>
|
||||
<my-component />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import MyComponent from '~/components/MyComponent'
|
||||
|
||||
export default {
|
||||
components: {
|
||||
MyComponent
|
||||
}
|
||||
}
|
||||
</script>
|
31
examples/tailwindcss-purgecss/postcss.config.js
Normal file
31
examples/tailwindcss-purgecss/postcss.config.js
Normal file
@ -0,0 +1,31 @@
|
||||
const path = require('path')
|
||||
const purgecss = require('@fullhuman/postcss-purgecss')
|
||||
|
||||
const tailwindConfig = path.join(__dirname, 'tailwind.js')
|
||||
|
||||
class TailwindExtractor {
|
||||
static extract(content) {
|
||||
return content.match(/[A-Za-z0-9-_:\/]+/g) || [] // eslint-disable-line no-useless-escape
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
plugins: [
|
||||
require('tailwindcss')(tailwindConfig),
|
||||
require('autoprefixer'),
|
||||
purgecss({
|
||||
content: [
|
||||
path.join(__dirname, './pages/**/*.vue'),
|
||||
path.join(__dirname, './layouts/**/*.vue'),
|
||||
path.join(__dirname, './components/**/*.vue')
|
||||
],
|
||||
extractors: [
|
||||
{
|
||||
extractor: TailwindExtractor,
|
||||
extensions: ['vue', 'js', 'html']
|
||||
}
|
||||
],
|
||||
whitelist: ['html', 'body', 'nuxt-progress']
|
||||
})
|
||||
]
|
||||
}
|
921
examples/tailwindcss-purgecss/tailwind.js
Normal file
921
examples/tailwindcss-purgecss/tailwind.js
Normal file
@ -0,0 +1,921 @@
|
||||
/*
|
||||
|
||||
Tailwind - The Utility-First CSS Framework
|
||||
|
||||
A project by Adam Wathan (@adamwathan), Jonathan Reinink (@reinink),
|
||||
David Hemphill (@davidhemphill) and Steve Schoger (@steveschoger).
|
||||
|
||||
Welcome to the Tailwind config file. This is where you can customize
|
||||
Tailwind specifically for your project. Don't be intimidated by the
|
||||
length of this file. It's really just a big JavaScript object and
|
||||
we've done our very best to explain each section.
|
||||
|
||||
View the full documentation at https://tailwindcss.com.
|
||||
|
||||
|-------------------------------------------------------------------------------
|
||||
| The default config
|
||||
|-------------------------------------------------------------------------------
|
||||
|
|
||||
| This variable contains the default Tailwind config. You don't have
|
||||
| to use it, but it can sometimes be helpful to have available. For
|
||||
| example, you may choose to merge your custom configuration
|
||||
| values with some of the Tailwind defaults.
|
||||
|
|
||||
*/
|
||||
|
||||
// let defaultConfig = require('tailwindcss/defaultConfig')()
|
||||
|
||||
/*
|
||||
|-------------------------------------------------------------------------------
|
||||
| Colors https://tailwindcss.com/docs/colors
|
||||
|-------------------------------------------------------------------------------
|
||||
|
|
||||
| Here you can specify the colors used in your project. To get you started,
|
||||
| we've provided a generous palette of great looking colors that are perfect
|
||||
| for prototyping, but don't hesitate to change them for your project. You
|
||||
| own these colors, nothing will break if you change everything about them.
|
||||
|
|
||||
| We've used literal color names ("red", "blue", etc.) for the default
|
||||
| palette, but if you'd rather use functional names like "primary" and
|
||||
| "secondary", or even a numeric scale like "100" and "200", go for it.
|
||||
|
|
||||
*/
|
||||
|
||||
const colors = {
|
||||
'transparent': 'transparent',
|
||||
|
||||
'black': '#22292f',
|
||||
'grey-darkest': '#3d4852',
|
||||
'grey-darker': '#606f7b',
|
||||
'grey-dark': '#8795a1',
|
||||
'grey': '#b8c2cc',
|
||||
'grey-light': '#dae1e7',
|
||||
'grey-lighter': '#f1f5f8',
|
||||
'grey-lightest': '#f8fafc',
|
||||
'white': '#ffffff',
|
||||
|
||||
'red-darkest': '#3b0d0c',
|
||||
'red-darker': '#621b18',
|
||||
'red-dark': '#cc1f1a',
|
||||
'red': '#e3342f',
|
||||
'red-light': '#ef5753',
|
||||
'red-lighter': '#f9acaa',
|
||||
'red-lightest': '#fcebea',
|
||||
|
||||
'orange-darkest': '#462a16',
|
||||
'orange-darker': '#613b1f',
|
||||
'orange-dark': '#de751f',
|
||||
'orange': '#f6993f',
|
||||
'orange-light': '#faad63',
|
||||
'orange-lighter': '#fcd9b6',
|
||||
'orange-lightest': '#fff5eb',
|
||||
|
||||
'yellow-darkest': '#453411',
|
||||
'yellow-darker': '#684f1d',
|
||||
'yellow-dark': '#f2d024',
|
||||
'yellow': '#ffed4a',
|
||||
'yellow-light': '#fff382',
|
||||
'yellow-lighter': '#fff9c2',
|
||||
'yellow-lightest': '#fcfbeb',
|
||||
|
||||
'green-darkest': '#0f2f21',
|
||||
'green-darker': '#1a4731',
|
||||
'green-dark': '#1f9d55',
|
||||
'green': '#38c172',
|
||||
'green-light': '#51d88a',
|
||||
'green-lighter': '#a2f5bf',
|
||||
'green-lightest': '#e3fcec',
|
||||
|
||||
'teal-darkest': '#0d3331',
|
||||
'teal-darker': '#20504f',
|
||||
'teal-dark': '#38a89d',
|
||||
'teal': '#4dc0b5',
|
||||
'teal-light': '#64d5ca',
|
||||
'teal-lighter': '#a0f0ed',
|
||||
'teal-lightest': '#e8fffe',
|
||||
|
||||
'blue-darkest': '#12283a',
|
||||
'blue-darker': '#1c3d5a',
|
||||
'blue-dark': '#2779bd',
|
||||
'blue': '#3490dc',
|
||||
'blue-light': '#6cb2eb',
|
||||
'blue-lighter': '#bcdefa',
|
||||
'blue-lightest': '#eff8ff',
|
||||
|
||||
'indigo-darkest': '#191e38',
|
||||
'indigo-darker': '#2f365f',
|
||||
'indigo-dark': '#5661b3',
|
||||
'indigo': '#6574cd',
|
||||
'indigo-light': '#7886d7',
|
||||
'indigo-lighter': '#b2b7ff',
|
||||
'indigo-lightest': '#e6e8ff',
|
||||
|
||||
'purple-darkest': '#21183c',
|
||||
'purple-darker': '#382b5f',
|
||||
'purple-dark': '#794acf',
|
||||
'purple': '#9561e2',
|
||||
'purple-light': '#a779e9',
|
||||
'purple-lighter': '#d6bbfc',
|
||||
'purple-lightest': '#f3ebff',
|
||||
|
||||
'pink-darkest': '#451225',
|
||||
'pink-darker': '#6f213f',
|
||||
'pink-dark': '#eb5286',
|
||||
'pink': '#f66d9b',
|
||||
'pink-light': '#fa7ea8',
|
||||
'pink-lighter': '#ffbbca',
|
||||
'pink-lightest': '#ffebef'
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
|
||||
/*
|
||||
|-----------------------------------------------------------------------------
|
||||
| Colors https://tailwindcss.com/docs/colors
|
||||
|-----------------------------------------------------------------------------
|
||||
|
|
||||
| The color palette defined above is also assigned to the "colors" key of
|
||||
| your Tailwind config. This makes it easy to access them in your CSS
|
||||
| using Tailwind's config helper. For example:
|
||||
|
|
||||
| .error { color: config('colors.red') }
|
||||
|
|
||||
*/
|
||||
|
||||
colors: colors,
|
||||
|
||||
/*
|
||||
|-----------------------------------------------------------------------------
|
||||
| Screens https://tailwindcss.com/docs/responsive-design
|
||||
|-----------------------------------------------------------------------------
|
||||
|
|
||||
| Screens in Tailwind are translated to CSS media queries. They define the
|
||||
| responsive breakpoints for your project. By default Tailwind takes a
|
||||
| "mobile first" approach, where each screen size represents a minimum
|
||||
| viewport width. Feel free to have as few or as many screens as you
|
||||
| want, naming them in whatever way you'd prefer for your project.
|
||||
|
|
||||
| Tailwind also allows for more complex screen definitions, which can be
|
||||
| useful in certain situations. Be sure to see the full responsive
|
||||
| documentation for a complete list of options.
|
||||
|
|
||||
| Class name: .{screen}:{utility}
|
||||
|
|
||||
*/
|
||||
|
||||
screens: {
|
||||
'sm': '576px',
|
||||
'md': '768px',
|
||||
'lg': '992px',
|
||||
'xl': '1200px'
|
||||
},
|
||||
|
||||
/*
|
||||
|-----------------------------------------------------------------------------
|
||||
| Fonts https://tailwindcss.com/docs/fonts
|
||||
|-----------------------------------------------------------------------------
|
||||
|
|
||||
| Here is where you define your project's font stack, or font families.
|
||||
| Keep in mind that Tailwind doesn't actually load any fonts for you.
|
||||
| If you're using custom fonts you'll need to import them prior to
|
||||
| defining them here.
|
||||
|
|
||||
| By default we provide a native font stack that works remarkably well on
|
||||
| any device or OS you're using, since it just uses the default fonts
|
||||
| provided by the platform.
|
||||
|
|
||||
| Class name: .font-{name}
|
||||
|
|
||||
*/
|
||||
|
||||
fonts: {
|
||||
'sans': [
|
||||
'system-ui',
|
||||
'BlinkMacSystemFont',
|
||||
'-apple-system',
|
||||
'Segoe UI',
|
||||
'Roboto',
|
||||
'Oxygen',
|
||||
'Ubuntu',
|
||||
'Cantarell',
|
||||
'Fira Sans',
|
||||
'Droid Sans',
|
||||
'Helvetica Neue',
|
||||
'sans-serif'
|
||||
],
|
||||
'serif': [
|
||||
'Constantia',
|
||||
'Lucida Bright',
|
||||
'Lucidabright',
|
||||
'Lucida Serif',
|
||||
'Lucida',
|
||||
'DejaVu Serif',
|
||||
'Bitstream Vera Serif',
|
||||
'Liberation Serif',
|
||||
'Georgia',
|
||||
'serif'
|
||||
],
|
||||
'mono': [
|
||||
'Menlo',
|
||||
'Monaco',
|
||||
'Consolas',
|
||||
'Liberation Mono',
|
||||
'Courier New',
|
||||
'monospace'
|
||||
]
|
||||
},
|
||||
|
||||
/*
|
||||
|-----------------------------------------------------------------------------
|
||||
| Text sizes https://tailwindcss.com/docs/text-sizing
|
||||
|-----------------------------------------------------------------------------
|
||||
|
|
||||
| Here is where you define your text sizes. Name these in whatever way
|
||||
| makes the most sense to you. We use size names by default, but
|
||||
| you're welcome to use a numeric scale or even something else
|
||||
| entirely.
|
||||
|
|
||||
| By default Tailwind uses the "rem" unit type for most measurements.
|
||||
| This allows you to set a root font size which all other sizes are
|
||||
| then based on. That said, you are free to use whatever units you
|
||||
| prefer, be it rems, ems, pixels or other.
|
||||
|
|
||||
| Class name: .text-{size}
|
||||
|
|
||||
*/
|
||||
|
||||
textSizes: {
|
||||
'xs': '.75rem', // 12px
|
||||
'sm': '.875rem', // 14px
|
||||
'base': '1rem', // 16px
|
||||
'lg': '1.125rem', // 18px
|
||||
'xl': '1.25rem', // 20px
|
||||
'2xl': '1.5rem', // 24px
|
||||
'3xl': '1.875rem', // 30px
|
||||
'4xl': '2.25rem', // 36px
|
||||
'5xl': '3rem' // 48px
|
||||
},
|
||||
|
||||
/*
|
||||
|-----------------------------------------------------------------------------
|
||||
| Font weights https://tailwindcss.com/docs/font-weight
|
||||
|-----------------------------------------------------------------------------
|
||||
|
|
||||
| Here is where you define your font weights. We've provided a list of
|
||||
| common font weight names with their respective numeric scale values
|
||||
| to get you started. It's unlikely that your project will require
|
||||
| all of these, so we recommend removing those you don't need.
|
||||
|
|
||||
| Class name: .font-{weight}
|
||||
|
|
||||
*/
|
||||
|
||||
fontWeights: {
|
||||
'hairline': 100,
|
||||
'thin': 200,
|
||||
'light': 300,
|
||||
'normal': 400,
|
||||
'medium': 500,
|
||||
'semibold': 600,
|
||||
'bold': 700,
|
||||
'extrabold': 800,
|
||||
'black': 900
|
||||
},
|
||||
|
||||
/*
|
||||
|-----------------------------------------------------------------------------
|
||||
| Leading (line height) https://tailwindcss.com/docs/line-height
|
||||
|-----------------------------------------------------------------------------
|
||||
|
|
||||
| Here is where you define your line height values, or as we call
|
||||
| them in Tailwind, leadings.
|
||||
|
|
||||
| Class name: .leading-{size}
|
||||
|
|
||||
*/
|
||||
|
||||
leading: {
|
||||
'none': 1,
|
||||
'tight': 1.25,
|
||||
'normal': 1.5,
|
||||
'loose': 2
|
||||
},
|
||||
|
||||
/*
|
||||
|-----------------------------------------------------------------------------
|
||||
| Tracking (letter spacing) https://tailwindcss.com/docs/letter-spacing
|
||||
|-----------------------------------------------------------------------------
|
||||
|
|
||||
| Here is where you define your letter spacing values, or as we call
|
||||
| them in Tailwind, tracking.
|
||||
|
|
||||
| Class name: .tracking-{size}
|
||||
|
|
||||
*/
|
||||
|
||||
tracking: {
|
||||
'tight': '-0.05em',
|
||||
'normal': '0',
|
||||
'wide': '0.05em'
|
||||
},
|
||||
|
||||
/*
|
||||
|-----------------------------------------------------------------------------
|
||||
| Text colors https://tailwindcss.com/docs/text-color
|
||||
|-----------------------------------------------------------------------------
|
||||
|
|
||||
| Here is where you define your text colors. By default these use the
|
||||
| color palette we defined above, however you're welcome to set these
|
||||
| independently if that makes sense for your project.
|
||||
|
|
||||
| Class name: .text-{color}
|
||||
|
|
||||
*/
|
||||
|
||||
textColors: colors,
|
||||
|
||||
/*
|
||||
|-----------------------------------------------------------------------------
|
||||
| Background colors https://tailwindcss.com/docs/background-color
|
||||
|-----------------------------------------------------------------------------
|
||||
|
|
||||
| Here is where you define your background colors. By default these use
|
||||
| the color palette we defined above, however you're welcome to set
|
||||
| these independently if that makes sense for your project.
|
||||
|
|
||||
| Class name: .bg-{color}
|
||||
|
|
||||
*/
|
||||
|
||||
backgroundColors: colors,
|
||||
|
||||
/*
|
||||
|-----------------------------------------------------------------------------
|
||||
| Background sizes https://tailwindcss.com/docs/background-size
|
||||
|-----------------------------------------------------------------------------
|
||||
|
|
||||
| Here is where you define your background sizes. We provide some common
|
||||
| values that are useful in most projects, but feel free to add other sizes
|
||||
| that are specific to your project here as well.
|
||||
|
|
||||
| Class name: .bg-{size}
|
||||
|
|
||||
*/
|
||||
|
||||
backgroundSize: {
|
||||
'auto': 'auto',
|
||||
'cover': 'cover',
|
||||
'contain': 'contain'
|
||||
},
|
||||
|
||||
/*
|
||||
|-----------------------------------------------------------------------------
|
||||
| Border widths https://tailwindcss.com/docs/border-width
|
||||
|-----------------------------------------------------------------------------
|
||||
|
|
||||
| Here is where you define your border widths. Take note that border
|
||||
| widths require a special "default" value set as well. This is the
|
||||
| width that will be used when you do not specify a border width.
|
||||
|
|
||||
| Class name: .border{-side?}{-width?}
|
||||
|
|
||||
*/
|
||||
|
||||
borderWidths: {
|
||||
default: '1px',
|
||||
'0': '0',
|
||||
'2': '2px',
|
||||
'4': '4px',
|
||||
'8': '8px'
|
||||
},
|
||||
|
||||
/*
|
||||
|-----------------------------------------------------------------------------
|
||||
| Border colors https://tailwindcss.com/docs/border-color
|
||||
|-----------------------------------------------------------------------------
|
||||
|
|
||||
| Here is where you define your border colors. By default these use the
|
||||
| color palette we defined above, however you're welcome to set these
|
||||
| independently if that makes sense for your project.
|
||||
|
|
||||
| Take note that border colors require a special "default" value set
|
||||
| as well. This is the color that will be used when you do not
|
||||
| specify a border color.
|
||||
|
|
||||
| Class name: .border-{color}
|
||||
|
|
||||
*/
|
||||
|
||||
borderColors: global.Object.assign({ default: colors['grey-light'] }, colors),
|
||||
|
||||
/*
|
||||
|-----------------------------------------------------------------------------
|
||||
| Border radius https://tailwindcss.com/docs/border-radius
|
||||
|-----------------------------------------------------------------------------
|
||||
|
|
||||
| Here is where you define your border radius values. If a `default` radius
|
||||
| is provided, it will be made available as the non-suffixed `.rounded`
|
||||
| utility.
|
||||
|
|
||||
| If your scale includes a `0` value to reset already rounded corners, it's
|
||||
| a good idea to put it first so other values are able to override it.
|
||||
|
|
||||
| Class name: .rounded{-side?}{-size?}
|
||||
|
|
||||
*/
|
||||
|
||||
borderRadius: {
|
||||
'none': '0',
|
||||
'sm': '.125rem',
|
||||
default: '.25rem',
|
||||
'lg': '.5rem',
|
||||
'full': '9999px'
|
||||
},
|
||||
|
||||
/*
|
||||
|-----------------------------------------------------------------------------
|
||||
| Width https://tailwindcss.com/docs/width
|
||||
|-----------------------------------------------------------------------------
|
||||
|
|
||||
| Here is where you define your width utility sizes. These can be
|
||||
| percentage based, pixels, rems, or any other units. By default
|
||||
| we provide a sensible rem based numeric scale, a percentage
|
||||
| based fraction scale, plus some other common use-cases. You
|
||||
| can, of course, modify these values as needed.
|
||||
|
|
||||
|
|
||||
| It's also worth mentioning that Tailwind automatically escapes
|
||||
| invalid CSS class name characters, which allows you to have
|
||||
| awesome classes like .w-2/3.
|
||||
|
|
||||
| Class name: .w-{size}
|
||||
|
|
||||
*/
|
||||
|
||||
width: {
|
||||
'auto': 'auto',
|
||||
'px': '1px',
|
||||
'1': '0.25rem',
|
||||
'2': '0.5rem',
|
||||
'3': '0.75rem',
|
||||
'4': '1rem',
|
||||
'5': '1.25rem',
|
||||
'6': '1.5rem',
|
||||
'8': '2rem',
|
||||
'10': '2.5rem',
|
||||
'12': '3rem',
|
||||
'16': '4rem',
|
||||
'24': '6rem',
|
||||
'32': '8rem',
|
||||
'48': '12rem',
|
||||
'64': '16rem',
|
||||
'1/2': '50%',
|
||||
'1/3': '33.33333%',
|
||||
'2/3': '66.66667%',
|
||||
'1/4': '25%',
|
||||
'3/4': '75%',
|
||||
'1/5': '20%',
|
||||
'2/5': '40%',
|
||||
'3/5': '60%',
|
||||
'4/5': '80%',
|
||||
'1/6': '16.66667%',
|
||||
'5/6': '83.33333%',
|
||||
'full': '100%',
|
||||
'screen': '100vw'
|
||||
},
|
||||
|
||||
/*
|
||||
|-----------------------------------------------------------------------------
|
||||
| Height https://tailwindcss.com/docs/height
|
||||
|-----------------------------------------------------------------------------
|
||||
|
|
||||
| Here is where you define your height utility sizes. These can be
|
||||
| percentage based, pixels, rems, or any other units. By default
|
||||
| we provide a sensible rem based numeric scale plus some other
|
||||
| common use-cases. You can, of course, modify these values as
|
||||
| needed.
|
||||
|
|
||||
| Class name: .h-{size}
|
||||
|
|
||||
*/
|
||||
|
||||
height: {
|
||||
'auto': 'auto',
|
||||
'px': '1px',
|
||||
'1': '0.25rem',
|
||||
'2': '0.5rem',
|
||||
'3': '0.75rem',
|
||||
'4': '1rem',
|
||||
'5': '1.25rem',
|
||||
'6': '1.5rem',
|
||||
'8': '2rem',
|
||||
'10': '2.5rem',
|
||||
'12': '3rem',
|
||||
'16': '4rem',
|
||||
'24': '6rem',
|
||||
'32': '8rem',
|
||||
'48': '12rem',
|
||||
'64': '16rem',
|
||||
'full': '100%',
|
||||
'screen': '100vh'
|
||||
},
|
||||
|
||||
/*
|
||||
|-----------------------------------------------------------------------------
|
||||
| Minimum width https://tailwindcss.com/docs/min-width
|
||||
|-----------------------------------------------------------------------------
|
||||
|
|
||||
| Here is where you define your minimum width utility sizes. These can
|
||||
| be percentage based, pixels, rems, or any other units. We provide a
|
||||
| couple common use-cases by default. You can, of course, modify
|
||||
| these values as needed.
|
||||
|
|
||||
| Class name: .min-w-{size}
|
||||
|
|
||||
*/
|
||||
|
||||
minWidth: {
|
||||
'0': '0',
|
||||
'full': '100%'
|
||||
},
|
||||
|
||||
/*
|
||||
|-----------------------------------------------------------------------------
|
||||
| Minimum height https://tailwindcss.com/docs/min-height
|
||||
|-----------------------------------------------------------------------------
|
||||
|
|
||||
| Here is where you define your minimum height utility sizes. These can
|
||||
| be percentage based, pixels, rems, or any other units. We provide a
|
||||
| few common use-cases by default. You can, of course, modify these
|
||||
| values as needed.
|
||||
|
|
||||
| Class name: .min-h-{size}
|
||||
|
|
||||
*/
|
||||
|
||||
minHeight: {
|
||||
'0': '0',
|
||||
'full': '100%',
|
||||
'screen': '100vh'
|
||||
},
|
||||
|
||||
/*
|
||||
|-----------------------------------------------------------------------------
|
||||
| Maximum width https://tailwindcss.com/docs/max-width
|
||||
|-----------------------------------------------------------------------------
|
||||
|
|
||||
| Here is where you define your maximum width utility sizes. These can
|
||||
| be percentage based, pixels, rems, or any other units. By default
|
||||
| we provide a sensible rem based scale and a "full width" size,
|
||||
| which is basically a reset utility. You can, of course,
|
||||
| modify these values as needed.
|
||||
|
|
||||
| Class name: .max-w-{size}
|
||||
|
|
||||
*/
|
||||
|
||||
maxWidth: {
|
||||
'xs': '20rem',
|
||||
'sm': '30rem',
|
||||
'md': '40rem',
|
||||
'lg': '50rem',
|
||||
'xl': '60rem',
|
||||
'2xl': '70rem',
|
||||
'3xl': '80rem',
|
||||
'4xl': '90rem',
|
||||
'5xl': '100rem',
|
||||
'full': '100%'
|
||||
},
|
||||
|
||||
/*
|
||||
|-----------------------------------------------------------------------------
|
||||
| Maximum height https://tailwindcss.com/docs/max-height
|
||||
|-----------------------------------------------------------------------------
|
||||
|
|
||||
| Here is where you define your maximum height utility sizes. These can
|
||||
| be percentage based, pixels, rems, or any other units. We provide a
|
||||
| couple common use-cases by default. You can, of course, modify
|
||||
| these values as needed.
|
||||
|
|
||||
| Class name: .max-h-{size}
|
||||
|
|
||||
*/
|
||||
|
||||
maxHeight: {
|
||||
'full': '100%',
|
||||
'screen': '100vh'
|
||||
},
|
||||
|
||||
/*
|
||||
|-----------------------------------------------------------------------------
|
||||
| Padding https://tailwindcss.com/docs/padding
|
||||
|-----------------------------------------------------------------------------
|
||||
|
|
||||
| Here is where you define your padding utility sizes. These can be
|
||||
| percentage based, pixels, rems, or any other units. By default we
|
||||
| provide a sensible rem based numeric scale plus a couple other
|
||||
| common use-cases like "1px". You can, of course, modify these
|
||||
| values as needed.
|
||||
|
|
||||
| Class name: .p{side?}-{size}
|
||||
|
|
||||
*/
|
||||
|
||||
padding: {
|
||||
'px': '1px',
|
||||
'0': '0',
|
||||
'1': '0.25rem',
|
||||
'2': '0.5rem',
|
||||
'3': '0.75rem',
|
||||
'4': '1rem',
|
||||
'5': '1.25rem',
|
||||
'6': '1.5rem',
|
||||
'8': '2rem',
|
||||
'10': '2.5rem',
|
||||
'12': '3rem',
|
||||
'16': '4rem',
|
||||
'20': '5rem',
|
||||
'24': '6rem',
|
||||
'32': '8rem'
|
||||
},
|
||||
|
||||
/*
|
||||
|-----------------------------------------------------------------------------
|
||||
| Margin https://tailwindcss.com/docs/margin
|
||||
|-----------------------------------------------------------------------------
|
||||
|
|
||||
| Here is where you define your margin utility sizes. These can be
|
||||
| percentage based, pixels, rems, or any other units. By default we
|
||||
| provide a sensible rem based numeric scale plus a couple other
|
||||
| common use-cases like "1px". You can, of course, modify these
|
||||
| values as needed.
|
||||
|
|
||||
| Class name: .m{side?}-{size}
|
||||
|
|
||||
*/
|
||||
|
||||
margin: {
|
||||
'auto': 'auto',
|
||||
'px': '1px',
|
||||
'0': '0',
|
||||
'1': '0.25rem',
|
||||
'2': '0.5rem',
|
||||
'3': '0.75rem',
|
||||
'4': '1rem',
|
||||
'5': '1.25rem',
|
||||
'6': '1.5rem',
|
||||
'8': '2rem',
|
||||
'10': '2.5rem',
|
||||
'12': '3rem',
|
||||
'16': '4rem',
|
||||
'20': '5rem',
|
||||
'24': '6rem',
|
||||
'32': '8rem'
|
||||
},
|
||||
|
||||
/*
|
||||
|-----------------------------------------------------------------------------
|
||||
| Negative margin https://tailwindcss.com/docs/negative-margin
|
||||
|-----------------------------------------------------------------------------
|
||||
|
|
||||
| Here is where you define your negative margin utility sizes. These can
|
||||
| be percentage based, pixels, rems, or any other units. By default we
|
||||
| provide matching values to the padding scale since these utilities
|
||||
| generally get used together. You can, of course, modify these
|
||||
| values as needed.
|
||||
|
|
||||
| Class name: .-m{side?}-{size}
|
||||
|
|
||||
*/
|
||||
|
||||
negativeMargin: {
|
||||
'px': '1px',
|
||||
'0': '0',
|
||||
'1': '0.25rem',
|
||||
'2': '0.5rem',
|
||||
'3': '0.75rem',
|
||||
'4': '1rem',
|
||||
'5': '1.25rem',
|
||||
'6': '1.5rem',
|
||||
'8': '2rem',
|
||||
'10': '2.5rem',
|
||||
'12': '3rem',
|
||||
'16': '4rem',
|
||||
'20': '5rem',
|
||||
'24': '6rem',
|
||||
'32': '8rem'
|
||||
},
|
||||
|
||||
/*
|
||||
|-----------------------------------------------------------------------------
|
||||
| Shadows https://tailwindcss.com/docs/shadows
|
||||
|-----------------------------------------------------------------------------
|
||||
|
|
||||
| Here is where you define your shadow utilities. As you can see from
|
||||
| the defaults we provide, it's possible to apply multiple shadows
|
||||
| per utility using comma separation.
|
||||
|
|
||||
| If a `default` shadow is provided, it will be made available as the non-
|
||||
| suffixed `.shadow` utility.
|
||||
|
|
||||
| Class name: .shadow-{size?}
|
||||
|
|
||||
*/
|
||||
|
||||
shadows: {
|
||||
default: '0 2px 4px 0 rgba(0,0,0,0.10)',
|
||||
'md': '0 4px 8px 0 rgba(0,0,0,0.12), 0 2px 4px 0 rgba(0,0,0,0.08)',
|
||||
'lg': '0 15px 30px 0 rgba(0,0,0,0.11), 0 5px 15px 0 rgba(0,0,0,0.08)',
|
||||
'inner': 'inset 0 2px 4px 0 rgba(0,0,0,0.06)',
|
||||
'outline': '0 0 0 3px rgba(52,144,220,0.5)',
|
||||
'none': 'none'
|
||||
},
|
||||
|
||||
/*
|
||||
|-----------------------------------------------------------------------------
|
||||
| Z-index https://tailwindcss.com/docs/z-index
|
||||
|-----------------------------------------------------------------------------
|
||||
|
|
||||
| Here is where you define your z-index utility values. By default we
|
||||
| provide a sensible numeric scale. You can, of course, modify these
|
||||
| values as needed.
|
||||
|
|
||||
| Class name: .z-{index}
|
||||
|
|
||||
*/
|
||||
|
||||
zIndex: {
|
||||
'auto': 'auto',
|
||||
'0': 0,
|
||||
'10': 10,
|
||||
'20': 20,
|
||||
'30': 30,
|
||||
'40': 40,
|
||||
'50': 50
|
||||
},
|
||||
|
||||
/*
|
||||
|-----------------------------------------------------------------------------
|
||||
| Opacity https://tailwindcss.com/docs/opacity
|
||||
|-----------------------------------------------------------------------------
|
||||
|
|
||||
| Here is where you define your opacity utility values. By default we
|
||||
| provide a sensible numeric scale. You can, of course, modify these
|
||||
| values as needed.
|
||||
|
|
||||
| Class name: .opacity-{name}
|
||||
|
|
||||
*/
|
||||
|
||||
opacity: {
|
||||
'0': '0',
|
||||
'25': '.25',
|
||||
'50': '.5',
|
||||
'75': '.75',
|
||||
'100': '1'
|
||||
},
|
||||
|
||||
/*
|
||||
|-----------------------------------------------------------------------------
|
||||
| SVG fill https://tailwindcss.com/docs/svg
|
||||
|-----------------------------------------------------------------------------
|
||||
|
|
||||
| Here is where you define your SVG fill colors. By default we just provide
|
||||
| `fill-current` which sets the fill to the current text color. This lets you
|
||||
| specify a fill color using existing text color utilities and helps keep the
|
||||
| generated CSS file size down.
|
||||
|
|
||||
| Class name: .fill-{name}
|
||||
|
|
||||
*/
|
||||
|
||||
svgFill: {
|
||||
'current': 'currentColor'
|
||||
},
|
||||
|
||||
/*
|
||||
|-----------------------------------------------------------------------------
|
||||
| SVG stroke https://tailwindcss.com/docs/svg
|
||||
|-----------------------------------------------------------------------------
|
||||
|
|
||||
| Here is where you define your SVG stroke colors. By default we just provide
|
||||
| `stroke-current` which sets the stroke to the current text color. This lets
|
||||
| you specify a stroke color using existing text color utilities and helps
|
||||
| keep the generated CSS file size down.
|
||||
|
|
||||
| Class name: .stroke-{name}
|
||||
|
|
||||
*/
|
||||
|
||||
svgStroke: {
|
||||
'current': 'currentColor'
|
||||
},
|
||||
|
||||
/*
|
||||
|-----------------------------------------------------------------------------
|
||||
| Modules https://tailwindcss.com/docs/configuration#modules
|
||||
|-----------------------------------------------------------------------------
|
||||
|
|
||||
| Here is where you control which modules are generated and what variants are
|
||||
| generated for each of those modules.
|
||||
|
|
||||
| Currently supported variants:
|
||||
| - responsive
|
||||
| - hover
|
||||
| - focus
|
||||
| - active
|
||||
| - group-hover
|
||||
|
|
||||
| To disable a module completely, use `false` instead of an array.
|
||||
|
|
||||
*/
|
||||
|
||||
modules: {
|
||||
appearance: ['responsive'],
|
||||
backgroundAttachment: ['responsive'],
|
||||
backgroundColors: ['responsive', 'hover', 'focus'],
|
||||
backgroundPosition: ['responsive'],
|
||||
backgroundRepeat: ['responsive'],
|
||||
backgroundSize: ['responsive'],
|
||||
borderCollapse: [],
|
||||
borderColors: ['responsive', 'hover', 'focus'],
|
||||
borderRadius: ['responsive'],
|
||||
borderStyle: ['responsive'],
|
||||
borderWidths: ['responsive'],
|
||||
cursor: ['responsive'],
|
||||
display: ['responsive'],
|
||||
flexbox: ['responsive'],
|
||||
float: ['responsive'],
|
||||
fonts: ['responsive'],
|
||||
fontWeights: ['responsive', 'hover', 'focus'],
|
||||
height: ['responsive'],
|
||||
leading: ['responsive'],
|
||||
lists: ['responsive'],
|
||||
margin: ['responsive'],
|
||||
maxHeight: ['responsive'],
|
||||
maxWidth: ['responsive'],
|
||||
minHeight: ['responsive'],
|
||||
minWidth: ['responsive'],
|
||||
negativeMargin: ['responsive'],
|
||||
opacity: ['responsive'],
|
||||
outline: ['focus'],
|
||||
overflow: ['responsive'],
|
||||
padding: ['responsive'],
|
||||
pointerEvents: ['responsive'],
|
||||
position: ['responsive'],
|
||||
resize: ['responsive'],
|
||||
shadows: ['responsive', 'hover', 'focus'],
|
||||
svgFill: [],
|
||||
svgStroke: [],
|
||||
tableLayout: ['responsive'],
|
||||
textAlign: ['responsive'],
|
||||
textColors: ['responsive', 'hover', 'focus'],
|
||||
textSizes: ['responsive'],
|
||||
textStyle: ['responsive', 'hover', 'focus'],
|
||||
tracking: ['responsive'],
|
||||
userSelect: ['responsive'],
|
||||
verticalAlign: ['responsive'],
|
||||
visibility: ['responsive'],
|
||||
whitespace: ['responsive'],
|
||||
width: ['responsive'],
|
||||
zIndex: ['responsive']
|
||||
},
|
||||
|
||||
/*
|
||||
|-----------------------------------------------------------------------------
|
||||
| Plugins https://tailwindcss.com/docs/plugins
|
||||
|-----------------------------------------------------------------------------
|
||||
|
|
||||
| Here is where you can register any plugins you'd like to use in your
|
||||
| project. Tailwind's built-in `container` plugin is enabled by default to
|
||||
| give you a Bootstrap-style responsive container component out of the box.
|
||||
|
|
||||
| Be sure to view the complete plugin documentation to learn more about how
|
||||
| the plugin system works.
|
||||
|
|
||||
*/
|
||||
|
||||
plugins: [
|
||||
require('tailwindcss/plugins/container')({
|
||||
// center: true,
|
||||
// padding: '1rem',
|
||||
})
|
||||
],
|
||||
|
||||
/*
|
||||
|-----------------------------------------------------------------------------
|
||||
| Advanced Options https://tailwindcss.com/docs/configuration#options
|
||||
|-----------------------------------------------------------------------------
|
||||
|
|
||||
| Here is where you can tweak advanced configuration options. We recommend
|
||||
| leaving these options alone unless you absolutely need to change them.
|
||||
|
|
||||
*/
|
||||
|
||||
options: {
|
||||
prefix: '',
|
||||
important: false,
|
||||
separator: ':'
|
||||
}
|
||||
|
||||
}
|
@ -15,20 +15,20 @@ test.before(async () => {
|
||||
}
|
||||
nuxt = new Nuxt(config)
|
||||
await new Builder(nuxt).build()
|
||||
await nuxt.listen(4000, 'localhost')
|
||||
await nuxt.server.listen(4000, 'localhost')
|
||||
}, 30000)
|
||||
|
||||
// Example of testing only generated html
|
||||
test('Route / exits and render HTML', async (t) => {
|
||||
const context = {}
|
||||
const { html } = await nuxt.renderRoute('/', context)
|
||||
const { html } = await nuxt.server.renderRoute('/', context)
|
||||
t.true(html.includes('<h1 class="red">Hello world!</h1>'))
|
||||
})
|
||||
|
||||
// Example of testing via dom checking
|
||||
test('Route / exits and render HTML with CSS applied', async (t) => {
|
||||
const context = {}
|
||||
const { html } = await nuxt.renderRoute('/', context)
|
||||
const { html } = await nuxt.server.renderRoute('/', context)
|
||||
const { window } = new JSDOM(html).window
|
||||
const element = window.document.querySelector('.red')
|
||||
t.not(element, null)
|
||||
|
@ -5,8 +5,8 @@ const server = http.createServer(this.nuxt.renderer.app)
|
||||
const io = socketIO(server)
|
||||
|
||||
export default function () {
|
||||
// overwrite nuxt.listen()
|
||||
this.nuxt.listen = (port, host) => new Promise(resolve => server.listen(port || 3000, host || 'localhost', resolve))
|
||||
// overwrite nuxt.server.listen()
|
||||
this.nuxt.server.listen = (port, host) => new Promise(resolve => server.listen(port || 3000, host || 'localhost', resolve))
|
||||
// close this server on 'close' event
|
||||
this.nuxt.hook('close', () => new Promise(server.close))
|
||||
|
||||
|
@ -1,3 +1,5 @@
|
||||
import VuetifyLoaderPlugin from 'vuetify-loader/lib/plugin'
|
||||
|
||||
export default {
|
||||
/*
|
||||
** Head elements
|
||||
@ -14,7 +16,9 @@ export default {
|
||||
},
|
||||
|
||||
build: {
|
||||
extractCSS: true
|
||||
plugins: [new VuetifyLoaderPlugin()],
|
||||
extractCSS: true,
|
||||
transpile: ['vuetify/lib']
|
||||
},
|
||||
/*
|
||||
** Load Vuetify into the app
|
||||
|
@ -2,7 +2,8 @@
|
||||
"name": "example-with-vuetify",
|
||||
"dependencies": {
|
||||
"nuxt-edge": "latest",
|
||||
"vuetify": "latest"
|
||||
"vuetify": "latest",
|
||||
"vuetify-loader": "latest"
|
||||
},
|
||||
"scripts": {
|
||||
"dev": "nuxt",
|
||||
|
@ -1,5 +1,5 @@
|
||||
import Vue from 'vue'
|
||||
import Vuetify from 'vuetify'
|
||||
import Vuetify from 'vuetify/lib'
|
||||
import colors from 'vuetify/es5/util/colors'
|
||||
|
||||
// You can also specify those components you are going to use for "a la carte" build:
|
||||
|
18
index.js
18
index.js
@ -1,18 +0,0 @@
|
||||
/*!
|
||||
* Nuxt.js
|
||||
* (c) 2016-2018 Chopin Brothers
|
||||
* Core maintainers: Pooya Parsa (@pi0) - Clark Du (@clarkdo)
|
||||
* Released under the MIT License.
|
||||
*/
|
||||
|
||||
const fs = require('fs')
|
||||
const path = require('path')
|
||||
|
||||
if (fs.existsSync(path.resolve(__dirname, '.babelrc'))) {
|
||||
// Use esm version when using linked repository to prevent builds
|
||||
const requireModule = require('esm')(module, {})
|
||||
module.exports = requireModule('./lib/index.js').default
|
||||
} else {
|
||||
// Use production bundle by default
|
||||
module.exports = require('./dist/nuxt.js')
|
||||
}
|
@ -1,17 +1,48 @@
|
||||
module.exports = {
|
||||
testEnvironment: 'node',
|
||||
coverageDirectory: './coverage/',
|
||||
collectCoverageFrom: [
|
||||
'lib/!(app)/**',
|
||||
'!lib/builder/webpack/plugins/vue/**'
|
||||
],
|
||||
setupTestFrameworkScriptFile: './test/utils/setup',
|
||||
testPathIgnorePatterns: ['test/fixtures/.*/.*?/'],
|
||||
transformIgnorePatterns: ['<rootDir>/node_modules/'],
|
||||
moduleFileExtensions: ['js', 'mjs', 'json'],
|
||||
|
||||
expand: true,
|
||||
forceExit: true
|
||||
|
||||
forceExit: true,
|
||||
|
||||
// https://github.com/facebook/jest/pull/6747 fix warning here
|
||||
// But its performance overhead is pretty bad (30+%).
|
||||
// detectOpenHandles: true
|
||||
|
||||
setupTestFrameworkScriptFile: './test/utils/setup',
|
||||
|
||||
coverageDirectory: './coverage',
|
||||
|
||||
collectCoverageFrom: [
|
||||
'**/packages/*/src/**/*.js'
|
||||
],
|
||||
|
||||
coveragePathIgnorePatterns: [
|
||||
'node_modules/(?!(@nuxt|nuxt))',
|
||||
'packages/webpack/src/config/plugins/vue'
|
||||
],
|
||||
|
||||
testPathIgnorePatterns: [
|
||||
'node_modules/(?!(@nuxt|nuxt))',
|
||||
'test/fixtures/.*/.*?/',
|
||||
'examples/.*'
|
||||
],
|
||||
|
||||
transformIgnorePatterns: [
|
||||
'node_modules/(?!(@nuxt|nuxt))'
|
||||
],
|
||||
|
||||
transform: {
|
||||
'^.+\\.js$': 'babel-jest',
|
||||
'.*\\.(vue)$': 'vue-jest'
|
||||
},
|
||||
|
||||
moduleFileExtensions: [
|
||||
'js',
|
||||
'json'
|
||||
],
|
||||
|
||||
reporters: [
|
||||
'default'
|
||||
].concat(process.env.JEST_JUNIT_OUTPUT ? ['jest-junit'] : [])
|
||||
}
|
||||
|
27
lerna.json
Normal file
27
lerna.json
Normal file
@ -0,0 +1,27 @@
|
||||
{
|
||||
"version": "independent",
|
||||
"npmClient": "yarn",
|
||||
"useWorkspaces": true,
|
||||
"conventionalCommits": true,
|
||||
"yes": true,
|
||||
"noPush": true,
|
||||
"gitTagVersion": false,
|
||||
"packages": [
|
||||
"packages/*",
|
||||
"distributions/*"
|
||||
],
|
||||
"command": {
|
||||
"publish": {
|
||||
"npmClient": "npm"
|
||||
}
|
||||
},
|
||||
"changelog": {
|
||||
"labels": {
|
||||
"feat": "New Feature",
|
||||
"fix": "Bug Fix",
|
||||
"docs": "Documentation",
|
||||
"perf": "Performance",
|
||||
"refactor": "Code Refactoring"
|
||||
}
|
||||
}
|
||||
}
|
@ -1,112 +0,0 @@
|
||||
<template>
|
||||
<div class="nuxt-progress" :style="{
|
||||
'width': percent + '%',
|
||||
'height': height,
|
||||
'background-color': canSuccess ? color : failedColor,
|
||||
'opacity': show ? 1 : 0
|
||||
}"></div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import Vue from 'vue'
|
||||
|
||||
export default {
|
||||
name: 'nuxt-loading',
|
||||
data () {
|
||||
return {
|
||||
percent: 0,
|
||||
show: false,
|
||||
canSuccess: true,
|
||||
throttle: <%= loading.throttle %>,
|
||||
duration: <%= loading.duration %>,
|
||||
height: '<%= loading.height %>',
|
||||
color: '<%= loading.color %>',
|
||||
failedColor: '<%= loading.failedColor %>',
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
start () {
|
||||
this.canSuccess = true
|
||||
if (this._throttle) {
|
||||
clearTimeout(this._throttle)
|
||||
}
|
||||
if (this._timer) {
|
||||
clearInterval(this._timer)
|
||||
this._timer = null
|
||||
this.percent = 0
|
||||
}
|
||||
this._throttle = setTimeout(() => {
|
||||
this.show = true
|
||||
this._cut = 10000 / Math.floor(this.duration)
|
||||
this._timer = setInterval(() => {
|
||||
this.increase(this._cut * Math.random())
|
||||
if (this.percent > 95) {
|
||||
this.finish()
|
||||
}
|
||||
}, 100)
|
||||
}, this.throttle)
|
||||
return this
|
||||
},
|
||||
set (num) {
|
||||
this.show = true
|
||||
this.canSuccess = true
|
||||
this.percent = Math.floor(num)
|
||||
return this
|
||||
},
|
||||
get () {
|
||||
return Math.floor(this.percent)
|
||||
},
|
||||
increase (num) {
|
||||
this.percent = this.percent + Math.floor(num)
|
||||
return this
|
||||
},
|
||||
decrease (num) {
|
||||
this.percent = this.percent - Math.floor(num)
|
||||
return this
|
||||
},
|
||||
finish () {
|
||||
this.percent = 100
|
||||
this.hide()
|
||||
return this
|
||||
},
|
||||
pause () {
|
||||
clearInterval(this._timer)
|
||||
return this
|
||||
},
|
||||
hide () {
|
||||
clearInterval(this._timer)
|
||||
this._timer = null
|
||||
clearTimeout(this._throttle)
|
||||
this._throttle = null
|
||||
setTimeout(() => {
|
||||
this.show = false
|
||||
Vue.nextTick(() => {
|
||||
setTimeout(() => {
|
||||
this.percent = 0
|
||||
}, 200)
|
||||
})
|
||||
}, 500)
|
||||
return this
|
||||
},
|
||||
fail () {
|
||||
this.canSuccess = false
|
||||
return this
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.nuxt-progress {
|
||||
position: fixed;
|
||||
top: 0px;
|
||||
left: <%= loading.rtl === true ? 'auto' : '0px' %>;
|
||||
right: 0px;
|
||||
height: 2px;
|
||||
width: 0%;
|
||||
transition: width 0.2s, opacity 0.4s;
|
||||
opacity: 1;
|
||||
background-color: #efc14e;
|
||||
z-index: 999999;
|
||||
}
|
||||
</style>
|
@ -1,7 +0,0 @@
|
||||
import Builder from './builder'
|
||||
import Generator from './generator'
|
||||
|
||||
export default {
|
||||
Builder,
|
||||
Generator
|
||||
}
|
@ -1,16 +0,0 @@
|
||||
|
||||
export default class StatsPlugin {
|
||||
constructor(statsOptions) {
|
||||
this.statsOptions = statsOptions
|
||||
}
|
||||
|
||||
apply(compiler) {
|
||||
compiler.hooks.done.tap('stats-plugin', (stats) => {
|
||||
process.stdout.write(
|
||||
'\n' +
|
||||
stats.toString(this.statsOptions) +
|
||||
'\n'
|
||||
)
|
||||
})
|
||||
}
|
||||
}
|
@ -1 +0,0 @@
|
||||
Temporary fork until vuejs/vue#7839 arrives.
|
@ -1,60 +0,0 @@
|
||||
import path from 'path'
|
||||
|
||||
import { warmup } from 'thread-loader'
|
||||
|
||||
// https://github.com/webpack-contrib/thread-loader
|
||||
// https://github.com/webpack-contrib/cache-loader
|
||||
|
||||
export default class PerfLoader {
|
||||
constructor(options) {
|
||||
this.options = options
|
||||
this.warmup = warmup
|
||||
this.workerPools = {
|
||||
js: {
|
||||
name: 'js',
|
||||
poolTimeout: this.options.dev ? Infinity : 2000
|
||||
},
|
||||
css: {
|
||||
name: 'css',
|
||||
poolTimeout: this.options.dev ? Infinity : 2000
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
warmupAll() {
|
||||
this.warmup(this.workerPools.js, ['babel-loader', '@babel/preset-env'])
|
||||
this.warmup(this.workerPools.css, ['css-loader'])
|
||||
}
|
||||
|
||||
pool(poolName, _loaders) {
|
||||
const loaders = [].concat(_loaders)
|
||||
|
||||
if (this.options.build.parallel) {
|
||||
const pool = this.workerPools[poolName]
|
||||
|
||||
if (pool) {
|
||||
loaders.unshift({
|
||||
loader: 'thread-loader',
|
||||
options: pool
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
if (this.options.build.cache) {
|
||||
loaders.unshift({
|
||||
loader: 'cache-loader',
|
||||
options: {
|
||||
cacheDirectory: path.resolve('node_modules/.cache/cache-loader')
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
return loaders
|
||||
}
|
||||
|
||||
poolOneOf(poolName, oneOfRules) {
|
||||
return oneOfRules.map(rule => Object.assign({}, rule, {
|
||||
use: this.pool(poolName, rule.use)
|
||||
}))
|
||||
}
|
||||
}
|
@ -1,281 +0,0 @@
|
||||
import path from 'path'
|
||||
import fs from 'fs'
|
||||
import _ from 'lodash'
|
||||
import env from 'std-env'
|
||||
|
||||
const nuxtDir = fs.existsSync(path.resolve(__dirname, '..', 'package.json'))
|
||||
? path.resolve(__dirname, '..') // dist
|
||||
: path.resolve(__dirname, '..', '..') // src
|
||||
|
||||
export default {
|
||||
// Information about running environment
|
||||
dev: Boolean(env.dev),
|
||||
debug: undefined, // = dev
|
||||
|
||||
// Mode
|
||||
mode: 'universal',
|
||||
|
||||
// Global name
|
||||
globalName: `nuxt`,
|
||||
globals: {
|
||||
id: globalName => `__${globalName}`,
|
||||
nuxt: globalName => `$${globalName}`,
|
||||
context: globalName => `__${globalName.toUpperCase()}__`,
|
||||
pluginPrefix: globalName => globalName,
|
||||
readyCallback: globalName => `on${_.capitalize(globalName)}Ready`,
|
||||
loadedCallback: globalName => `_on${_.capitalize(globalName)}Loaded`
|
||||
},
|
||||
|
||||
// Server options
|
||||
server: {
|
||||
https: false,
|
||||
port: process.env.NUXT_PORT ||
|
||||
process.env.PORT ||
|
||||
process.env.npm_package_config_nuxt_port,
|
||||
host: process.env.NUXT_HOST ||
|
||||
process.env.HOST ||
|
||||
process.env.npm_package_config_nuxt_host
|
||||
},
|
||||
|
||||
// Dirs
|
||||
srcDir: undefined,
|
||||
buildDir: '.nuxt',
|
||||
nuxtDir,
|
||||
nuxtAppDir: path.resolve(nuxtDir, 'lib', 'app'),
|
||||
modulesDir: ['node_modules'], // ~> relative to options.rootDir
|
||||
|
||||
// Ignore
|
||||
ignorePrefix: '-',
|
||||
ignore: [
|
||||
'**/*.test.*',
|
||||
'**/*.spec.*'
|
||||
],
|
||||
|
||||
extensions: [],
|
||||
|
||||
build: {
|
||||
quiet: Boolean(env.ci || env.test),
|
||||
analyze: false,
|
||||
profile: process.argv.includes('--profile'),
|
||||
extractCSS: false,
|
||||
cssSourceMap: undefined,
|
||||
ssr: undefined,
|
||||
parallel: false,
|
||||
cache: false,
|
||||
publicPath: '/_nuxt/',
|
||||
filenames: {
|
||||
// { isDev, isClient, isServer }
|
||||
app: ({ isDev }) => isDev ? '[name].js' : '[chunkhash].js',
|
||||
chunk: ({ isDev }) => isDev ? '[name].js' : '[chunkhash].js',
|
||||
css: ({ isDev }) => isDev ? '[name].css' : '[contenthash].css',
|
||||
img: ({ isDev }) => isDev ? '[path][name].[ext]' : 'img/[hash:7].[ext]',
|
||||
font: ({ isDev }) => isDev ? '[path][name].[ext]' : 'fonts/[hash:7].[ext]',
|
||||
video: ({ isDev }) => isDev ? '[path][name].[ext]' : 'videos/[hash:7].[ext]'
|
||||
},
|
||||
loaders: {
|
||||
file: {},
|
||||
fontUrl: { limit: 1000 },
|
||||
imgUrl: { limit: 1000 },
|
||||
pugPlain: {},
|
||||
vue: {
|
||||
transformAssetUrls: {
|
||||
video: 'src',
|
||||
source: 'src',
|
||||
object: 'src',
|
||||
embed: 'src'
|
||||
}
|
||||
},
|
||||
css: {},
|
||||
cssModules: {
|
||||
localIdentName: '[local]_[hash:base64:5]'
|
||||
},
|
||||
less: {},
|
||||
sass: {
|
||||
indentedSyntax: true
|
||||
},
|
||||
scss: {},
|
||||
stylus: {},
|
||||
vueStyle: {}
|
||||
},
|
||||
styleResources: {},
|
||||
plugins: [],
|
||||
terser: {},
|
||||
optimizeCSS: undefined,
|
||||
optimization: {
|
||||
runtimeChunk: 'single',
|
||||
minimize: undefined,
|
||||
minimizer: undefined,
|
||||
splitChunks: {
|
||||
chunks: 'all',
|
||||
automaticNameDelimiter: '.',
|
||||
name: undefined,
|
||||
cacheGroups: {}
|
||||
}
|
||||
},
|
||||
splitChunks: {
|
||||
layouts: false,
|
||||
pages: true,
|
||||
commons: true
|
||||
},
|
||||
babel: {
|
||||
babelrc: false,
|
||||
cacheDirectory: undefined
|
||||
},
|
||||
transpile: [], // Name of NPM packages to be transpiled
|
||||
postcss: {
|
||||
preset: {
|
||||
// https://cssdb.org/#staging-process
|
||||
stage: 2
|
||||
}
|
||||
},
|
||||
html: {
|
||||
minify: {
|
||||
collapseBooleanAttributes: true,
|
||||
decodeEntities: true,
|
||||
minifyCSS: true,
|
||||
minifyJS: true,
|
||||
processConditionalComments: true,
|
||||
removeEmptyAttributes: true,
|
||||
removeRedundantAttributes: true,
|
||||
trimCustomFragments: true,
|
||||
useShortDoctype: true
|
||||
}
|
||||
},
|
||||
|
||||
templates: [],
|
||||
watch: [],
|
||||
devMiddleware: {},
|
||||
hotMiddleware: {},
|
||||
stats: {
|
||||
chunks: false,
|
||||
children: false,
|
||||
modules: false,
|
||||
colors: true,
|
||||
warnings: true,
|
||||
errors: true,
|
||||
excludeAssets: [
|
||||
/.map$/,
|
||||
/index\..+\.html$/,
|
||||
/vue-ssr-client-manifest.json/
|
||||
]
|
||||
}
|
||||
},
|
||||
generate: {
|
||||
dir: 'dist',
|
||||
routes: [],
|
||||
concurrency: 500,
|
||||
interval: 0,
|
||||
subFolders: true,
|
||||
fallback: '200.html'
|
||||
},
|
||||
env: {},
|
||||
head: {
|
||||
meta: [],
|
||||
link: [],
|
||||
style: [],
|
||||
script: []
|
||||
},
|
||||
plugins: [],
|
||||
css: [],
|
||||
modules: [],
|
||||
layouts: {},
|
||||
serverMiddleware: [],
|
||||
ErrorPage: null,
|
||||
loading: {
|
||||
color: 'black',
|
||||
failedColor: 'red',
|
||||
height: '2px',
|
||||
throttle: 200,
|
||||
duration: 5000,
|
||||
rtl: false
|
||||
},
|
||||
loadingIndicator: 'default',
|
||||
transition: {
|
||||
name: 'page',
|
||||
mode: 'out-in',
|
||||
appear: false,
|
||||
appearClass: 'appear',
|
||||
appearActiveClass: 'appear-active',
|
||||
appearToClass: 'appear-to'
|
||||
},
|
||||
layoutTransition: {
|
||||
name: 'layout',
|
||||
mode: 'out-in'
|
||||
},
|
||||
dir: {
|
||||
assets: 'assets',
|
||||
layouts: 'layouts',
|
||||
middleware: 'middleware',
|
||||
pages: 'pages',
|
||||
static: 'static',
|
||||
store: 'store'
|
||||
},
|
||||
vue: {
|
||||
config: {
|
||||
silent: undefined, // = !dev
|
||||
performance: undefined // = dev
|
||||
}
|
||||
},
|
||||
router: {
|
||||
mode: 'history',
|
||||
base: '/',
|
||||
routes: [],
|
||||
middleware: [],
|
||||
linkActiveClass: 'nuxt-link-active',
|
||||
linkExactActiveClass: 'nuxt-link-exact-active',
|
||||
extendRoutes: null,
|
||||
scrollBehavior: null,
|
||||
parseQuery: false,
|
||||
stringifyQuery: false,
|
||||
fallback: false
|
||||
},
|
||||
render: {
|
||||
bundleRenderer: {
|
||||
shouldPrefetch: () => false
|
||||
},
|
||||
resourceHints: true,
|
||||
ssr: undefined,
|
||||
http2: {
|
||||
push: false,
|
||||
shouldPush: null
|
||||
},
|
||||
static: {
|
||||
prefix: true
|
||||
},
|
||||
compressor: {
|
||||
threshold: 0
|
||||
},
|
||||
etag: {
|
||||
weak: false
|
||||
},
|
||||
csp: false,
|
||||
dist: {
|
||||
// Don't serve index.html template
|
||||
index: false,
|
||||
// 1 year in production
|
||||
maxAge: '1y'
|
||||
}
|
||||
},
|
||||
// User-defined changes
|
||||
watch: [],
|
||||
watchers: {
|
||||
webpack: {},
|
||||
chokidar: {
|
||||
ignoreInitial: true
|
||||
}
|
||||
},
|
||||
editor: undefined,
|
||||
hooks: null,
|
||||
messages: {
|
||||
loading: 'Loading...',
|
||||
error_404: 'This page could not be found',
|
||||
server_error: 'Server error',
|
||||
nuxtjs: 'Nuxt.js',
|
||||
back_to_home: 'Back to the home page',
|
||||
server_error_details:
|
||||
'An error occurred in the application and your page could not be served. If you are the application owner, check your logs for details.',
|
||||
client_error: 'Error',
|
||||
client_error_details:
|
||||
'An error occurred while rendering the page. Check developer tools console for details.'
|
||||
}
|
||||
}
|
@ -1,9 +0,0 @@
|
||||
import Module from './module'
|
||||
import Nuxt from './nuxt'
|
||||
import Renderer from './renderer'
|
||||
|
||||
export default {
|
||||
Nuxt,
|
||||
Module,
|
||||
Renderer
|
||||
}
|
298
lib/core/nuxt.js
298
lib/core/nuxt.js
@ -1,298 +0,0 @@
|
||||
import Module from 'module'
|
||||
import { resolve, join } from 'path'
|
||||
import https from 'https'
|
||||
|
||||
import enableDestroy from 'server-destroy'
|
||||
import _ from 'lodash'
|
||||
import fs from 'fs-extra'
|
||||
import consola from 'consola'
|
||||
import chalk from 'chalk'
|
||||
import esm from 'esm'
|
||||
import ip from 'ip'
|
||||
|
||||
import Options from '../common/options'
|
||||
import { sequence, startsWithRootAlias, startsWithSrcAlias } from '../common/utils'
|
||||
import packageJSON from '../../package.json'
|
||||
|
||||
import ModuleContainer from './module'
|
||||
import Renderer from './renderer'
|
||||
|
||||
export default class Nuxt {
|
||||
constructor(options = {}) {
|
||||
this.options = Options.from(options)
|
||||
|
||||
this.readyMessage = null
|
||||
this.initialized = false
|
||||
|
||||
// Hooks
|
||||
this._hooks = {}
|
||||
this.hook = this.hook.bind(this)
|
||||
|
||||
// Create instance of core components
|
||||
this.moduleContainer = new ModuleContainer(this)
|
||||
this.renderer = new Renderer(this)
|
||||
|
||||
// Backward compatibility
|
||||
this.render = this.renderer.app
|
||||
this.renderRoute = this.renderer.renderRoute.bind(this.renderer)
|
||||
this.renderAndGetWindow = this.renderer.renderAndGetWindow.bind(
|
||||
this.renderer
|
||||
)
|
||||
this.resolvePath = this.resolvePath.bind(this)
|
||||
this.resolveAlias = this.resolveAlias.bind(this)
|
||||
|
||||
// ESM Loader
|
||||
this.esm = esm(module, {})
|
||||
|
||||
this._ready = this.ready().catch((err) => {
|
||||
consola.fatal(err)
|
||||
})
|
||||
}
|
||||
|
||||
static get version() {
|
||||
return packageJSON.version
|
||||
}
|
||||
|
||||
async ready() {
|
||||
if (this._ready) {
|
||||
return this._ready
|
||||
}
|
||||
|
||||
// Add hooks
|
||||
if (_.isPlainObject(this.options.hooks)) {
|
||||
this.addHooks(this.options.hooks)
|
||||
} else if (typeof this.options.hooks === 'function') {
|
||||
this.options.hooks(this.hook)
|
||||
}
|
||||
|
||||
// Await for modules
|
||||
await this.moduleContainer.ready()
|
||||
|
||||
// Await for renderer to be ready
|
||||
await this.renderer.ready()
|
||||
|
||||
this.initialized = true
|
||||
|
||||
// Call ready hook
|
||||
await this.callHook('ready', this)
|
||||
|
||||
return this
|
||||
}
|
||||
|
||||
hook(name, fn) {
|
||||
if (!name || typeof fn !== 'function') {
|
||||
return
|
||||
}
|
||||
if (name === 'render:context') {
|
||||
name = 'render:routeContext'
|
||||
consola.warn('render:context hook has been deprecated, please use render:routeContext')
|
||||
}
|
||||
this._hooks[name] = this._hooks[name] || []
|
||||
this._hooks[name].push(fn)
|
||||
}
|
||||
|
||||
async callHook(name, ...args) {
|
||||
if (!this._hooks[name]) {
|
||||
return
|
||||
}
|
||||
consola.debug(`Call ${name} hooks (${this._hooks[name].length})`)
|
||||
try {
|
||||
await sequence(this._hooks[name], fn => fn(...args))
|
||||
} catch (err) {
|
||||
consola.error(err)
|
||||
this.callHook('error', err)
|
||||
}
|
||||
}
|
||||
|
||||
clearHook(name) {
|
||||
if (name) {
|
||||
delete this._hooks[name]
|
||||
}
|
||||
}
|
||||
|
||||
flatHooks(configHooks, hooks = {}, parentName) {
|
||||
Object.keys(configHooks).forEach((key) => {
|
||||
const subHook = configHooks[key]
|
||||
const name = parentName ? `${parentName}:${key}` : key
|
||||
if (typeof subHook === 'object' && subHook !== null) {
|
||||
this.flatHooks(subHook, hooks, name)
|
||||
} else {
|
||||
hooks[name] = subHook
|
||||
}
|
||||
})
|
||||
return hooks
|
||||
}
|
||||
|
||||
addHooks(configHooks) {
|
||||
const hooks = this.flatHooks(configHooks)
|
||||
Object.keys(hooks).filter(Boolean).forEach((key) => {
|
||||
[].concat(hooks[key]).forEach(h => this.hook(key, h))
|
||||
})
|
||||
}
|
||||
|
||||
showReady(clear = true) {
|
||||
if (!this.readyMessage) {
|
||||
return
|
||||
}
|
||||
consola.ready({
|
||||
message: this.readyMessage,
|
||||
badge: true,
|
||||
clear
|
||||
})
|
||||
this.readyMessage = null
|
||||
}
|
||||
|
||||
listen(port, host, socket) {
|
||||
return this.ready().then(() => new Promise((resolve, reject) => {
|
||||
if (!socket && typeof this.options.server.socket === 'string') {
|
||||
socket = this.options.server.socket
|
||||
}
|
||||
|
||||
const args = { exclusive: false }
|
||||
|
||||
if (socket) {
|
||||
args.path = socket
|
||||
} else {
|
||||
args.port = port || this.options.server.port
|
||||
args.host = host || this.options.server.host
|
||||
}
|
||||
|
||||
let appServer
|
||||
const isHttps = Boolean(this.options.server.https)
|
||||
|
||||
if (isHttps) {
|
||||
let httpsOptions
|
||||
|
||||
if (this.options.server.https === true) {
|
||||
httpsOptions = {}
|
||||
} else {
|
||||
httpsOptions = this.options.server.https
|
||||
}
|
||||
|
||||
appServer = https.createServer(httpsOptions, this.renderer.app)
|
||||
} else {
|
||||
appServer = this.renderer.app
|
||||
}
|
||||
|
||||
const server = appServer.listen(
|
||||
args,
|
||||
(err) => {
|
||||
/* istanbul ignore if */
|
||||
if (err) {
|
||||
return reject(err)
|
||||
}
|
||||
|
||||
let listenURL
|
||||
|
||||
if (!socket) {
|
||||
({ address: host, port } = server.address())
|
||||
if (host === '127.0.0.1') {
|
||||
host = 'localhost'
|
||||
} else if (host === '0.0.0.0') {
|
||||
host = ip.address()
|
||||
}
|
||||
|
||||
listenURL = chalk.underline.blue(`http${isHttps ? 's' : ''}://${host}:${port}`)
|
||||
this.readyMessage = `Listening on ${listenURL}`
|
||||
} else {
|
||||
listenURL = chalk.underline.blue(`unix+http://${socket}`)
|
||||
this.readyMessage = `Listening on ${listenURL}`
|
||||
}
|
||||
|
||||
// Close server on nuxt close
|
||||
this.hook(
|
||||
'close',
|
||||
() =>
|
||||
new Promise((resolve, reject) => {
|
||||
// Destroy server by forcing every connection to be closed
|
||||
server.listening && server.destroy((err) => {
|
||||
consola.debug('server closed')
|
||||
/* istanbul ignore if */
|
||||
if (err) {
|
||||
return reject(err)
|
||||
}
|
||||
resolve()
|
||||
})
|
||||
})
|
||||
)
|
||||
|
||||
if (socket) {
|
||||
this.callHook('listen', server, { path: socket }).then(resolve)
|
||||
} else {
|
||||
this.callHook('listen', server, { port, host }).then(resolve)
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
// Add server.destroy(cb) method
|
||||
enableDestroy(server)
|
||||
}))
|
||||
}
|
||||
|
||||
resolveModule(path) {
|
||||
try {
|
||||
const resolvedPath = Module._resolveFilename(path, {
|
||||
paths: this.options.modulesDir
|
||||
})
|
||||
|
||||
return resolvedPath
|
||||
} catch (error) {
|
||||
if (error.code === 'MODULE_NOT_FOUND') {
|
||||
return null
|
||||
} else {
|
||||
throw error
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
resolveAlias(path) {
|
||||
const modulePath = this.resolveModule(path)
|
||||
|
||||
// Try to resolve it as if it were a regular node_module
|
||||
// Package first. Fixes issue with @<org> scoped packages
|
||||
if (modulePath != null) {
|
||||
return modulePath
|
||||
}
|
||||
|
||||
if (startsWithRootAlias(path)) {
|
||||
return join(this.options.rootDir, path.substr(2))
|
||||
}
|
||||
|
||||
if (startsWithSrcAlias(path)) {
|
||||
return join(this.options.srcDir, path.substr(1))
|
||||
}
|
||||
|
||||
return resolve(this.options.srcDir, path)
|
||||
}
|
||||
|
||||
resolvePath(path) {
|
||||
const _path = this.resolveAlias(path)
|
||||
|
||||
if (fs.existsSync(_path)) {
|
||||
return _path
|
||||
}
|
||||
|
||||
for (const ext of this.options.extensions) {
|
||||
if (fs.existsSync(_path + '.' + ext)) {
|
||||
return _path + '.' + ext
|
||||
}
|
||||
}
|
||||
|
||||
throw new Error(`Cannot resolve "${path}" from "${_path}"`)
|
||||
}
|
||||
|
||||
requireModule(_path, opts = {}) {
|
||||
const _resolvedPath = this.resolvePath(_path)
|
||||
const m = opts.esm === false ? require(_resolvedPath) : this.esm(_resolvedPath)
|
||||
return (m && m.default) || m
|
||||
}
|
||||
|
||||
async close(callback) {
|
||||
await this.callHook('close', this)
|
||||
|
||||
/* istanbul ignore if */
|
||||
if (typeof callback === 'function') {
|
||||
await callback()
|
||||
}
|
||||
}
|
||||
}
|
@ -1,482 +0,0 @@
|
||||
import path from 'path'
|
||||
import crypto from 'crypto'
|
||||
|
||||
import devalue from '@nuxtjs/devalue'
|
||||
import serveStatic from 'serve-static'
|
||||
import _ from 'lodash'
|
||||
import fs from 'fs-extra'
|
||||
import { createBundleRenderer } from 'vue-server-renderer'
|
||||
import connect from 'connect'
|
||||
import launchMiddleware from 'launch-editor-middleware'
|
||||
import consola from 'consola'
|
||||
|
||||
import { isUrl, timeout, waitFor, determineGlobals } from '../common/utils'
|
||||
import defaults from '../common/nuxt.config'
|
||||
|
||||
import MetaRenderer from './meta'
|
||||
import errorMiddleware from './middleware/error'
|
||||
import nuxtMiddleware from './middleware/nuxt'
|
||||
|
||||
let jsdom = null
|
||||
|
||||
export default class Renderer {
|
||||
constructor(nuxt) {
|
||||
this.nuxt = nuxt
|
||||
this.options = nuxt.options
|
||||
this.globals = determineGlobals(nuxt.options.globalName, nuxt.options.globals)
|
||||
|
||||
// Will be set by createRenderer
|
||||
this.bundleRenderer = null
|
||||
this.metaRenderer = null
|
||||
|
||||
// Will be available on dev
|
||||
this.webpackDevMiddleware = null
|
||||
this.webpackHotMiddleware = null
|
||||
|
||||
// Create new connect instance
|
||||
this.app = connect()
|
||||
|
||||
// Renderer runtime resources
|
||||
this.resources = {
|
||||
clientManifest: null,
|
||||
serverBundle: null,
|
||||
ssrTemplate: null,
|
||||
spaTemplate: null,
|
||||
errorTemplate: parseTemplate('Nuxt.js Internal Server Error')
|
||||
}
|
||||
}
|
||||
|
||||
async ready() {
|
||||
await this.nuxt.callHook('render:before', this, this.options.render)
|
||||
// Setup nuxt middleware
|
||||
await this.setupMiddleware()
|
||||
|
||||
// Production: Load SSR resources from fs
|
||||
if (!this.options.dev) {
|
||||
await this.loadResources()
|
||||
}
|
||||
|
||||
// Call done hook
|
||||
await this.nuxt.callHook('render:done', this)
|
||||
}
|
||||
|
||||
async loadResources(_fs = fs) {
|
||||
const distPath = path.resolve(this.options.buildDir, 'dist', 'server')
|
||||
const updated = []
|
||||
|
||||
resourceMap.forEach(({ key, fileName, transform }) => {
|
||||
const rawKey = '$$' + key
|
||||
const _path = path.join(distPath, fileName)
|
||||
|
||||
if (!_fs.existsSync(_path)) {
|
||||
return // Resource not exists
|
||||
}
|
||||
const rawData = _fs.readFileSync(_path, 'utf8')
|
||||
if (!rawData || rawData === this.resources[rawKey]) {
|
||||
return // No changes
|
||||
}
|
||||
this.resources[rawKey] = rawData
|
||||
const data = transform(rawData)
|
||||
/* istanbul ignore if */
|
||||
if (!data) {
|
||||
return // Invalid data ?
|
||||
}
|
||||
this.resources[key] = data
|
||||
updated.push(key)
|
||||
})
|
||||
|
||||
// Reload error template
|
||||
const errorTemplatePath = path.resolve(this.options.buildDir, 'views/error.html')
|
||||
if (fs.existsSync(errorTemplatePath)) {
|
||||
this.resources.errorTemplate = parseTemplate(
|
||||
fs.readFileSync(errorTemplatePath, 'utf8')
|
||||
)
|
||||
}
|
||||
|
||||
// Load loading template
|
||||
const loadingHTMLPath = path.resolve(this.options.buildDir, 'loading.html')
|
||||
if (fs.existsSync(loadingHTMLPath)) {
|
||||
this.resources.loadingHTML = fs.readFileSync(loadingHTMLPath, 'utf8')
|
||||
this.resources.loadingHTML = this.resources.loadingHTML
|
||||
.replace(/\r|\n|[\t\s]{3,}/g, '')
|
||||
} else {
|
||||
this.resources.loadingHTML = ''
|
||||
}
|
||||
|
||||
// Call resourcesLoaded plugin
|
||||
await this.nuxt.callHook('render:resourcesLoaded', this.resources)
|
||||
|
||||
if (updated.length > 0) {
|
||||
this.createRenderer()
|
||||
}
|
||||
}
|
||||
|
||||
get noSSR() {
|
||||
return this.options.render.ssr === false
|
||||
}
|
||||
|
||||
get isReady() {
|
||||
if (this.noSSR) {
|
||||
return Boolean(this.resources.spaTemplate)
|
||||
}
|
||||
|
||||
return Boolean(this.bundleRenderer && this.resources.ssrTemplate)
|
||||
}
|
||||
|
||||
get isResourcesAvailable() {
|
||||
// Required for both
|
||||
/* istanbul ignore if */
|
||||
if (!this.resources.clientManifest) {
|
||||
return false
|
||||
}
|
||||
|
||||
// Required for SPA rendering
|
||||
if (this.noSSR) {
|
||||
return Boolean(this.resources.spaTemplate)
|
||||
}
|
||||
|
||||
// Required for bundle renderer
|
||||
return Boolean(this.resources.ssrTemplate && this.resources.serverBundle)
|
||||
}
|
||||
|
||||
createRenderer() {
|
||||
// Ensure resources are available
|
||||
if (!this.isResourcesAvailable) {
|
||||
return
|
||||
}
|
||||
|
||||
// Create Meta Renderer
|
||||
this.metaRenderer = new MetaRenderer(this.nuxt, this)
|
||||
|
||||
// Skip following steps if noSSR mode
|
||||
if (this.noSSR) {
|
||||
return
|
||||
}
|
||||
|
||||
const hasModules = fs.existsSync(path.resolve(this.options.rootDir, 'node_modules'))
|
||||
// Create bundle renderer for SSR
|
||||
this.bundleRenderer = createBundleRenderer(
|
||||
this.resources.serverBundle,
|
||||
Object.assign(
|
||||
{
|
||||
clientManifest: this.resources.clientManifest,
|
||||
runInNewContext: false,
|
||||
// for globally installed nuxt command, search dependencies in global dir
|
||||
basedir: hasModules ? this.options.rootDir : __dirname
|
||||
},
|
||||
this.options.render.bundleRenderer
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
useMiddleware(m) {
|
||||
// Resolve
|
||||
const $m = m
|
||||
if (typeof m === 'string') {
|
||||
m = this.nuxt.requireModule(m)
|
||||
}
|
||||
if (typeof m.handler === 'string') {
|
||||
m.handler = this.nuxt.requireModule(m.handler)
|
||||
}
|
||||
|
||||
const handler = m.handler || m
|
||||
const path = (
|
||||
(m.prefix !== false ? this.options.router.base : '') +
|
||||
(typeof m.path === 'string' ? m.path : '')
|
||||
).replace(/\/\//g, '/')
|
||||
|
||||
handler.$m = $m
|
||||
|
||||
// Use middleware
|
||||
this.app.use(path, handler)
|
||||
}
|
||||
|
||||
get publicPath() {
|
||||
return isUrl(this.options.build.publicPath)
|
||||
? defaults.build.publicPath
|
||||
: this.options.build.publicPath
|
||||
}
|
||||
|
||||
async setupMiddleware() {
|
||||
// Apply setupMiddleware from modules first
|
||||
await this.nuxt.callHook('render:setupMiddleware', this.app)
|
||||
|
||||
// Compression middleware for production
|
||||
if (!this.options.dev) {
|
||||
const compressor = this.options.render.compressor
|
||||
if (typeof compressor === 'object') {
|
||||
// If only setting for `compression` are provided, require the module and insert
|
||||
// Prefer require instead of requireModule to keep dependency in nuxt-start
|
||||
const compression = require('compression')
|
||||
this.useMiddleware(compression(compressor))
|
||||
} else {
|
||||
// Else, require own compression middleware
|
||||
this.useMiddleware(compressor)
|
||||
}
|
||||
}
|
||||
|
||||
// Add webpack middleware only for development
|
||||
if (this.options.dev) {
|
||||
this.useMiddleware(async (req, res, next) => {
|
||||
if (this.webpackDevMiddleware) {
|
||||
await this.webpackDevMiddleware(req, res)
|
||||
}
|
||||
if (this.webpackHotMiddleware) {
|
||||
await this.webpackHotMiddleware(req, res)
|
||||
}
|
||||
next()
|
||||
})
|
||||
}
|
||||
|
||||
// open in editor for debug mode only
|
||||
if (this.options.debug && this.options.dev) {
|
||||
this.useMiddleware({
|
||||
path: '__open-in-editor',
|
||||
handler: launchMiddleware(this.options.editor)
|
||||
})
|
||||
}
|
||||
|
||||
// For serving static/ files to /
|
||||
const staticMiddleware = serveStatic(
|
||||
path.resolve(this.options.srcDir, this.options.dir.static),
|
||||
this.options.render.static
|
||||
)
|
||||
staticMiddleware.prefix = this.options.render.static.prefix
|
||||
this.useMiddleware(staticMiddleware)
|
||||
|
||||
// Serve .nuxt/dist/ files only for production
|
||||
// For dev they will be served with devMiddleware
|
||||
if (!this.options.dev) {
|
||||
const distDir = path.resolve(this.options.buildDir, 'dist', 'client')
|
||||
this.useMiddleware({
|
||||
path: this.publicPath,
|
||||
handler: serveStatic(
|
||||
distDir,
|
||||
this.options.render.dist
|
||||
)
|
||||
})
|
||||
}
|
||||
|
||||
// Add User provided middleware
|
||||
this.options.serverMiddleware.forEach((m) => {
|
||||
this.useMiddleware(m)
|
||||
})
|
||||
|
||||
// Finally use nuxtMiddleware
|
||||
this.useMiddleware(nuxtMiddleware.bind(this))
|
||||
|
||||
// Error middleware for errors that occurred in middleware that declared above
|
||||
// Middleware should exactly take 4 arguments
|
||||
// https://github.com/senchalabs/connect#error-middleware
|
||||
|
||||
// Apply errorMiddleware from modules first
|
||||
await this.nuxt.callHook('render:errorMiddleware', this.app)
|
||||
|
||||
// Apply errorMiddleware from Nuxt
|
||||
this.useMiddleware(errorMiddleware.bind(this))
|
||||
}
|
||||
|
||||
renderTemplate(ssr, opts) {
|
||||
// Fix problem with HTMLPlugin's minify option (#3392)
|
||||
opts.html_attrs = opts.HTML_ATTRS
|
||||
opts.body_attrs = opts.BODY_ATTRS
|
||||
|
||||
const fn = ssr ? this.resources.ssrTemplate : this.resources.spaTemplate
|
||||
|
||||
return fn(opts)
|
||||
}
|
||||
|
||||
async renderRoute(url, context = {}) {
|
||||
/* istanbul ignore if */
|
||||
if (!this.isReady) {
|
||||
await waitFor(1000)
|
||||
return this.renderRoute(url, context)
|
||||
}
|
||||
|
||||
// Log rendered url
|
||||
consola.debug(`Rendering url ${url}`)
|
||||
|
||||
// Add url and isSever to the context
|
||||
context.url = url
|
||||
|
||||
// Basic response if SSR is disabled or spa data provided
|
||||
const spa = context.spa || (context.res && context.res.spa)
|
||||
const ENV = this.options.env
|
||||
|
||||
if (this.noSSR || spa) {
|
||||
const {
|
||||
HTML_ATTRS,
|
||||
BODY_ATTRS,
|
||||
HEAD,
|
||||
BODY_SCRIPTS,
|
||||
getPreloadFiles
|
||||
} = await this.metaRenderer.render(context)
|
||||
const APP =
|
||||
`<div id="${this.globals.id}">${this.resources.loadingHTML}</div>` + BODY_SCRIPTS
|
||||
|
||||
// Detect 404 errors
|
||||
if (
|
||||
url.includes(this.options.build.publicPath) ||
|
||||
url.includes('__webpack')
|
||||
) {
|
||||
const err = {
|
||||
statusCode: 404,
|
||||
message: this.options.messages.error_404,
|
||||
name: 'ResourceNotFound'
|
||||
}
|
||||
throw err
|
||||
}
|
||||
|
||||
const html = this.renderTemplate(false, {
|
||||
HTML_ATTRS,
|
||||
BODY_ATTRS,
|
||||
HEAD,
|
||||
APP,
|
||||
ENV
|
||||
})
|
||||
|
||||
return { html, getPreloadFiles }
|
||||
}
|
||||
|
||||
// Call renderToString from the bundleRenderer and generate the HTML (will update the context as well)
|
||||
let APP = await this.bundleRenderer.renderToString(context)
|
||||
|
||||
if (!context.nuxt.serverRendered) {
|
||||
APP = `<div id="${this.globals.id}"></div>`
|
||||
}
|
||||
const m = context.meta.inject()
|
||||
let HEAD =
|
||||
m.title.text() +
|
||||
m.meta.text() +
|
||||
m.link.text() +
|
||||
m.style.text() +
|
||||
m.script.text() +
|
||||
m.noscript.text()
|
||||
if (this.options._routerBaseSpecified) {
|
||||
HEAD += `<base href="${this.options.router.base}">`
|
||||
}
|
||||
|
||||
if (this.options.render.resourceHints) {
|
||||
HEAD += context.renderResourceHints()
|
||||
}
|
||||
|
||||
await this.nuxt.callHook('render:routeContext', context.nuxt)
|
||||
|
||||
const serializedSession = `window.${this.globals.context}=${devalue(context.nuxt)};`
|
||||
|
||||
const cspScriptSrcHashSet = new Set()
|
||||
if (this.options.render.csp) {
|
||||
const { hashAlgorithm } = this.options.render.csp
|
||||
const hash = crypto.createHash(hashAlgorithm)
|
||||
hash.update(serializedSession)
|
||||
cspScriptSrcHashSet.add(`'${hashAlgorithm}-${hash.digest('base64')}'`)
|
||||
}
|
||||
|
||||
APP += `<script>${serializedSession}</script>`
|
||||
APP += context.renderScripts()
|
||||
APP += m.script.text({ body: true })
|
||||
APP += m.noscript.text({ body: true })
|
||||
|
||||
HEAD += context.renderStyles()
|
||||
|
||||
const html = this.renderTemplate(true, {
|
||||
HTML_ATTRS: 'data-n-head-ssr ' + m.htmlAttrs.text(),
|
||||
BODY_ATTRS: m.bodyAttrs.text(),
|
||||
HEAD,
|
||||
APP,
|
||||
ENV
|
||||
})
|
||||
|
||||
return {
|
||||
html,
|
||||
cspScriptSrcHashSet,
|
||||
getPreloadFiles: context.getPreloadFiles,
|
||||
error: context.nuxt.error,
|
||||
redirected: context.redirected
|
||||
}
|
||||
}
|
||||
|
||||
async renderAndGetWindow(url, opts = {}) {
|
||||
/* istanbul ignore if */
|
||||
if (!jsdom) {
|
||||
try {
|
||||
jsdom = require('jsdom')
|
||||
} catch (e) /* istanbul ignore next */ {
|
||||
consola.error(`
|
||||
Fail when calling nuxt.renderAndGetWindow(url)
|
||||
jsdom module is not installed
|
||||
Please install jsdom with: npm install --save-dev jsdom
|
||||
`)
|
||||
throw e
|
||||
}
|
||||
}
|
||||
const options = Object.assign({
|
||||
resources: 'usable', // load subresources (https://github.com/tmpvar/jsdom#loading-subresources)
|
||||
runScripts: 'dangerously',
|
||||
virtualConsole: true,
|
||||
beforeParse(window) {
|
||||
// Mock window.scrollTo
|
||||
window.scrollTo = () => {}
|
||||
}
|
||||
}, opts)
|
||||
const jsdomErrHandler = (err) => { throw err }
|
||||
if (options.virtualConsole) {
|
||||
if (options.virtualConsole === true) {
|
||||
options.virtualConsole = new jsdom.VirtualConsole().sendTo(consola)
|
||||
}
|
||||
// throw error when window creation failed
|
||||
options.virtualConsole.on('jsdomError', jsdomErrHandler)
|
||||
}
|
||||
url = url || 'http://localhost:3000'
|
||||
const { window } = await jsdom.JSDOM.fromURL(url, options)
|
||||
// If Nuxt could not be loaded (error from the server-side)
|
||||
const nuxtExists = window.document.body.innerHTML.includes(
|
||||
this.options.render.ssr ? `window.${this.globals.context}` : `<div id="${this.globals.id}">`
|
||||
)
|
||||
/* istanbul ignore if */
|
||||
if (!nuxtExists) {
|
||||
const error = new Error('Could not load the nuxt app')
|
||||
error.body = window.document.body.innerHTML
|
||||
throw error
|
||||
}
|
||||
// Used by nuxt.js to say when the components are loaded and the app ready
|
||||
const onNuxtLoaded = this.globals.loadedCallback
|
||||
await timeout(new Promise((resolve) => {
|
||||
window[onNuxtLoaded] = () => resolve(window)
|
||||
}), 20000, 'Components loading in renderAndGetWindow was not completed in 20s')
|
||||
if (options.virtualConsole) {
|
||||
// after window initialized successfully
|
||||
options.virtualConsole.removeListener('jsdomError', jsdomErrHandler)
|
||||
}
|
||||
// Send back window object
|
||||
return window
|
||||
}
|
||||
}
|
||||
|
||||
const parseTemplate = templateStr =>
|
||||
_.template(templateStr, {
|
||||
interpolate: /{{([\s\S]+?)}}/g
|
||||
})
|
||||
|
||||
export const resourceMap = [
|
||||
{
|
||||
key: 'clientManifest',
|
||||
fileName: 'vue-ssr-client-manifest.json',
|
||||
transform: JSON.parse
|
||||
},
|
||||
{
|
||||
key: 'serverBundle',
|
||||
fileName: 'server-bundle.json',
|
||||
transform: JSON.parse
|
||||
},
|
||||
{
|
||||
key: 'ssrTemplate',
|
||||
fileName: 'index.ssr.html',
|
||||
transform: parseTemplate
|
||||
},
|
||||
{
|
||||
key: 'spaTemplate',
|
||||
fileName: 'index.spa.html',
|
||||
transform: parseTemplate
|
||||
}
|
||||
]
|
@ -1,6 +0,0 @@
|
||||
import core from './core'
|
||||
import builder from './builder'
|
||||
import * as Utils from './common/utils'
|
||||
import Options from './common/options'
|
||||
|
||||
export default Object.assign({ Utils, Options }, core, builder)
|
@ -1,4 +0,0 @@
|
||||
export default (pkg) => {
|
||||
pkg.sortDependencies()
|
||||
pkg.writePackage()
|
||||
}
|
186
package.json
186
package.json
@ -1,179 +1,81 @@
|
||||
{
|
||||
"name": "nuxt",
|
||||
"version": "2.2.0",
|
||||
"description": "A minimalistic framework for server-rendered Vue.js applications (inspired by Next.js)",
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Sebastien Chopin (@Atinux)"
|
||||
},
|
||||
{
|
||||
"name": "Alexandre Chopin (@alexchopin)"
|
||||
},
|
||||
{
|
||||
"name": "Pooya Parsa (@pi0)"
|
||||
},
|
||||
{
|
||||
"name": "Clark Du (@clarkdo)"
|
||||
},
|
||||
{
|
||||
"name": "Jonas Galvez (@galvez)"
|
||||
},
|
||||
{
|
||||
"name": "Alexander Lichter (@manniL}"
|
||||
}
|
||||
"private": true,
|
||||
"workspaces": [
|
||||
"packages/*",
|
||||
"distributions/*"
|
||||
],
|
||||
"main": "index.js",
|
||||
"module": "./lib/nuxt.js",
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/nuxt/nuxt.js"
|
||||
},
|
||||
"files": [
|
||||
"bin",
|
||||
"lib",
|
||||
"dist",
|
||||
"index.js"
|
||||
],
|
||||
"keywords": [
|
||||
"nuxt",
|
||||
"nuxt.js",
|
||||
"nuxtjs",
|
||||
"vue",
|
||||
"vue.js",
|
||||
"vuejs",
|
||||
"vue universal",
|
||||
"vue ssr",
|
||||
"vue server side",
|
||||
"ssr",
|
||||
"vue isomorphic",
|
||||
"vue versatile"
|
||||
],
|
||||
"homepage": "https://github.com/nuxt/nuxt.js#readme",
|
||||
"bin": {
|
||||
"nuxt": "./bin/nuxt"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "node -r esm ./packages/nuxt-pack/build.js",
|
||||
"build": "yarn clean && node -r esm ./scripts/package",
|
||||
"clean": "yarn clean:build && yarn clean:examples && yarn clean:test",
|
||||
"clean:build": "rimraf distributions/*/dist packages/*/dist",
|
||||
"clean:examples": "rimraf examples/*/dist examples/*/.nuxt",
|
||||
"clean:test": "rimraf test/fixtures/*/dist test/fixtures/*/.nuxt*",
|
||||
"dev": "node -r esm ./scripts/dev",
|
||||
"coverage": "codecov",
|
||||
"lint": "eslint --ext .js,.mjs,.vue bin/** benchmarks examples lib packages test",
|
||||
"postinstall": "opencollective || exit 0",
|
||||
"lint": "eslint --ext .js,.mjs,.vue .",
|
||||
"lint:app": "eslint-multiplexer eslint --ignore-path packages/app/template/.eslintignore 'test/fixtures/!(missing-plugin)/.nuxt!(-dev)/**' | eslint-multiplexer -b",
|
||||
"nuxt": "node -r esm ./packages/cli/bin/nuxt.js",
|
||||
"test": "yarn test:fixtures && yarn test:unit",
|
||||
"test:fixtures": "jest test/fixtures",
|
||||
"test:e2e": "jest -i test/e2e",
|
||||
"test:lint": "yarn lint",
|
||||
"test:unit": "jest test/unit"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8.0.0",
|
||||
"npm": ">=5.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@babel/core": "^7.1.2",
|
||||
"@babel/polyfill": "^7.0.0",
|
||||
"@nuxtjs/babel-preset-app": "^0.7.0",
|
||||
"@nuxtjs/devalue": "^1.0.0",
|
||||
"@nuxtjs/friendly-errors-webpack-plugin": "^2.0.2",
|
||||
"@nuxtjs/opencollective": "^0.1.0",
|
||||
"@nuxtjs/youch": "^4.2.3",
|
||||
"babel-loader": "^8.0.4",
|
||||
"cache-loader": "^1.2.2",
|
||||
"caniuse-lite": "^1.0.30000890",
|
||||
"chalk": "^2.4.1",
|
||||
"chokidar": "^2.0.4",
|
||||
"compression": "^1.7.3",
|
||||
"connect": "^3.6.6",
|
||||
"consola": "^1.4.4",
|
||||
"css-loader": "^1.0.0",
|
||||
"cssnano": "^4.1.4",
|
||||
"debug": "^4.1.0",
|
||||
"esm": "^3.0.84",
|
||||
"etag": "^1.8.1",
|
||||
"file-loader": "^2.0.0",
|
||||
"fresh": "^0.5.2",
|
||||
"fs-extra": "^7.0.0",
|
||||
"glob": "^7.1.3",
|
||||
"hash-sum": "^1.0.2",
|
||||
"html-minifier": "^3.5.20",
|
||||
"html-webpack-plugin": "^3.2.0",
|
||||
"ip": "^1.1.5",
|
||||
"launch-editor-middleware": "^2.2.1",
|
||||
"lodash": "^4.17.11",
|
||||
"lru-cache": "^4.1.3",
|
||||
"memory-fs": "^0.4.1",
|
||||
"mini-css-extract-plugin": "^0.4.4",
|
||||
"minimist": "^1.2.0",
|
||||
"optimize-css-assets-webpack-plugin": "^5.0.1",
|
||||
"pify": "^4.0.0",
|
||||
"postcss": "^7.0.5",
|
||||
"postcss-import": "^12.0.0",
|
||||
"postcss-import-resolver": "^1.1.0",
|
||||
"postcss-loader": "^3.0.0",
|
||||
"postcss-preset-env": "^6.1.1",
|
||||
"postcss-url": "^8.0.0",
|
||||
"semver": "^5.6.0",
|
||||
"serialize-javascript": "^1.5.0",
|
||||
"serve-static": "^1.13.2",
|
||||
"server-destroy": "^1.0.1",
|
||||
"std-env": "^2.0.2",
|
||||
"style-resources-loader": "^1.2.1",
|
||||
"terser-webpack-plugin": "^1.1.0",
|
||||
"thread-loader": "^1.2.0",
|
||||
"time-fix-plugin": "^2.0.3",
|
||||
"upath": "^1.1.0",
|
||||
"url-loader": "^1.1.2",
|
||||
"vue": "^2.5.17",
|
||||
"vue-loader": "^15.4.2",
|
||||
"vue-meta": "^1.5.5",
|
||||
"vue-no-ssr": "^1.0.0",
|
||||
"vue-router": "^3.0.1",
|
||||
"vue-server-renderer": "^2.5.17",
|
||||
"vue-template-compiler": "^2.5.17",
|
||||
"vuex": "^3.0.1",
|
||||
"webpack": "^4.20.2",
|
||||
"webpack-bundle-analyzer": "^3.0.2",
|
||||
"webpack-dev-middleware": "^3.4.0",
|
||||
"webpack-hot-middleware": "^2.24.3",
|
||||
"webpack-node-externals": "^1.7.2",
|
||||
"webpackbar": "^2.6.3"
|
||||
"test:unit": "jest test/unit",
|
||||
"postinstall": "lerna link && yarn dev"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/preset-env": "^7.1.0",
|
||||
"@babel/core": "^7.1.6",
|
||||
"@babel/preset-env": "^7.1.6",
|
||||
"@nuxtjs/eslint-config": "^0.0.1",
|
||||
"babel-core": "^7.0.0-bridge",
|
||||
"babel-eslint": "^10.0.1",
|
||||
"babel-jest": "^23.6.0",
|
||||
"babel-plugin-dynamic-import-node": "^2.2.0",
|
||||
"cheerio": "^1.0.0-rc.2",
|
||||
"codecov": "^3.1.0",
|
||||
"consola": "^2.2.6",
|
||||
"cross-env": "^5.2.0",
|
||||
"cross-spawn": "^6.0.5",
|
||||
"eslint": "^5.7.0",
|
||||
"eslint": "^5.9.0",
|
||||
"eslint-config-standard": "^12.0.0",
|
||||
"eslint-multiplexer": "^1.0.2",
|
||||
"eslint-plugin-import": "^2.14.0",
|
||||
"eslint-plugin-jest": "^21.24.1",
|
||||
"eslint-plugin-node": "^7.0.1",
|
||||
"eslint-plugin-jest": "^22.0.0",
|
||||
"eslint-plugin-node": "^8.0.0",
|
||||
"eslint-plugin-promise": "^4.0.1",
|
||||
"eslint-plugin-standard": "^4.0.0",
|
||||
"eslint-plugin-vue": "^5.0.0-beta.3",
|
||||
"eslint-plugin-vue": "^5.0.0-beta.4",
|
||||
"esm": "^3.0.84",
|
||||
"express": "^4.16.4",
|
||||
"finalhandler": "^1.1.1",
|
||||
"fs-extra": "^7.0.1",
|
||||
"get-port": "^4.0.0",
|
||||
"glob": "^7.1.3",
|
||||
"jest": "^23.6.0",
|
||||
"jsdom": "^12.2.0",
|
||||
"jest-junit": "^5.2.0",
|
||||
"jsdom": "^13.0.0",
|
||||
"klaw-sync": "^6.0.0",
|
||||
"lerna": "^3.4.3",
|
||||
"lodash": "^4.17.11",
|
||||
"node-fetch": "^2.3.0",
|
||||
"pug": "^2.0.3",
|
||||
"pug-plain-loader": "^1.0.0",
|
||||
"puppeteer": "^1.9.0",
|
||||
"puppeteer": "^1.10.0",
|
||||
"request": "^2.88.0",
|
||||
"request-promise-native": "^1.0.5",
|
||||
"rimraf": "^2.6.2",
|
||||
"rollup": "^0.66.6",
|
||||
"rollup": "^0.67.1",
|
||||
"rollup-plugin-alias": "^1.4.0",
|
||||
"rollup-plugin-babel": "^4.0.3",
|
||||
"rollup-plugin-commonjs": "^9.2.0",
|
||||
"rollup-plugin-json": "^3.1.0",
|
||||
"rollup-plugin-license": "^0.7.0"
|
||||
"rollup-plugin-license": "^0.7.0",
|
||||
"rollup-plugin-node-resolve": "^3.4.0",
|
||||
"rollup-plugin-replace": "^2.1.0",
|
||||
"sort-package-json": "^1.16.0",
|
||||
"vue-jest": "^3.0.0"
|
||||
},
|
||||
"collective": {
|
||||
"url": "https://opencollective.com/nuxtjs",
|
||||
"logoUrl": "https://opencollective.com/nuxtjs/logo.txt?reverse=true&variant=variant2"
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/nuxt/nuxt.js.git"
|
||||
}
|
||||
}
|
||||
|
38
packages/babel-preset-app/CHANGELOG.md
Normal file
38
packages/babel-preset-app/CHANGELOG.md
Normal file
@ -0,0 +1,38 @@
|
||||
# Change Log
|
||||
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
## 2.3.1 (2018-11-16)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **deps:** update all non-major dependencies ([#4200](https://github.com/nuxt/nuxt.js/issues/4200)) ([930f8b2](https://github.com/nuxt/nuxt.js/commit/930f8b2))
|
||||
* **deps:** update all non-major dependencies ([#4271](https://github.com/nuxt/nuxt.js/issues/4271)) ([dd114ff](https://github.com/nuxt/nuxt.js/commit/dd114ff))
|
||||
* **deps:** update all non-major dependencies ([#4310](https://github.com/nuxt/nuxt.js/issues/4310)) ([bfb6d6a](https://github.com/nuxt/nuxt.js/commit/bfb6d6a))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* add --modern to nuxt start ([#4254](https://github.com/nuxt/nuxt.js/issues/4254)) ([12151d8](https://github.com/nuxt/nuxt.js/commit/12151d8))
|
||||
* move [@nuxtjs](https://github.com/nuxtjs)/babel-preset-app into nuxt mono-repo ([#4205](https://github.com/nuxt/nuxt.js/issues/4205)) ([ae9de93](https://github.com/nuxt/nuxt.js/commit/ae9de93))
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# 2.3.0 (2018-11-16)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **deps:** update all non-major dependencies ([#4200](https://github.com/nuxt/nuxt.js/issues/4200)) ([930f8b2](https://github.com/nuxt/nuxt.js/commit/930f8b2))
|
||||
* **deps:** update all non-major dependencies ([#4271](https://github.com/nuxt/nuxt.js/issues/4271)) ([dd114ff](https://github.com/nuxt/nuxt.js/commit/dd114ff))
|
||||
* **deps:** update all non-major dependencies ([#4310](https://github.com/nuxt/nuxt.js/issues/4310)) ([bfb6d6a](https://github.com/nuxt/nuxt.js/commit/bfb6d6a))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* add --modern to nuxt start ([#4254](https://github.com/nuxt/nuxt.js/issues/4254)) ([12151d8](https://github.com/nuxt/nuxt.js/commit/12151d8))
|
||||
* move [@nuxtjs](https://github.com/nuxtjs)/babel-preset-app into nuxt mono-repo ([#4205](https://github.com/nuxt/nuxt.js/issues/4205)) ([ae9de93](https://github.com/nuxt/nuxt.js/commit/ae9de93))
|
27
packages/babel-preset-app/package.json
Normal file
27
packages/babel-preset-app/package.json
Normal file
@ -0,0 +1,27 @@
|
||||
{
|
||||
"name": "@nuxt/babel-preset-app",
|
||||
"version": "2.3.1",
|
||||
"description": "babel-preset-app for nuxt.js",
|
||||
"repository": "nuxt/nuxt.js",
|
||||
"license": "MIT",
|
||||
"author": "Evan You",
|
||||
"contributors": [
|
||||
"Clark Du"
|
||||
],
|
||||
"main": "src/index.js",
|
||||
"dependencies": {
|
||||
"@babel/core": "^7.1.6",
|
||||
"@babel/plugin-proposal-class-properties": "^7.1.0",
|
||||
"@babel/plugin-proposal-decorators": "^7.1.6",
|
||||
"@babel/plugin-syntax-dynamic-import": "^7.0.0",
|
||||
"@babel/plugin-syntax-jsx": "^7.0.0",
|
||||
"@babel/plugin-transform-runtime": "^7.1.0",
|
||||
"@babel/preset-env": "^7.1.6",
|
||||
"@babel/runtime": "^7.1.5",
|
||||
"babel-helper-vue-jsx-merge-props": "^2.0.3",
|
||||
"babel-plugin-transform-vue-jsx": "^4.0.1"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
}
|
||||
}
|
97
packages/babel-preset-app/src/index.js
Normal file
97
packages/babel-preset-app/src/index.js
Normal file
@ -0,0 +1,97 @@
|
||||
const defaultPolyfills = [
|
||||
// Promise polyfill alone doesn't work in IE,
|
||||
// Needs this as well. see: #1642
|
||||
'es6.array.iterator',
|
||||
// This is required for webpack code splitting, vuex etc.
|
||||
'es6.promise',
|
||||
// #2012 es6.promise replaces native Promise in FF and causes missing finally
|
||||
'es7.promise.finally'
|
||||
]
|
||||
|
||||
function getPolyfills(targets, includes, { ignoreBrowserslistConfig, configPath }) {
|
||||
const { isPluginRequired } = require('@babel/preset-env')
|
||||
const builtInsList = require('@babel/preset-env/data/built-ins.json')
|
||||
const getTargets = require('@babel/preset-env/lib/targets-parser').default
|
||||
const builtInTargets = getTargets(targets, {
|
||||
ignoreBrowserslistConfig,
|
||||
configPath
|
||||
})
|
||||
|
||||
return includes.filter(item => isPluginRequired(builtInTargets, builtInsList[item]))
|
||||
}
|
||||
|
||||
module.exports = (context, options = {}) => {
|
||||
const presets = []
|
||||
const plugins = []
|
||||
|
||||
// JSX
|
||||
if (options.jsx !== false) {
|
||||
plugins.push(
|
||||
require('@babel/plugin-syntax-jsx'),
|
||||
require('babel-plugin-transform-vue-jsx')
|
||||
// require('babel-plugin-jsx-event-modifiers'),
|
||||
// require('babel-plugin-jsx-v-model')
|
||||
)
|
||||
}
|
||||
|
||||
const modern = !!options.modern
|
||||
|
||||
const {
|
||||
buildTarget,
|
||||
loose = false,
|
||||
useBuiltIns = (modern ? false : 'usage'),
|
||||
modules = false,
|
||||
polyfills: userPolyfills,
|
||||
ignoreBrowserslistConfig = modern,
|
||||
configPath,
|
||||
forceAllTransforms,
|
||||
decoratorsLegacy
|
||||
} = options
|
||||
|
||||
let targets = options.targets
|
||||
if (modern === true) {
|
||||
targets = { esmodules: true }
|
||||
} else if (targets === undefined) {
|
||||
targets = buildTarget === 'server' ? { node: 'current' } : { ie: 9 }
|
||||
}
|
||||
|
||||
let polyfills
|
||||
if (modern === false && useBuiltIns === 'usage' && buildTarget === 'client') {
|
||||
polyfills = getPolyfills(targets, userPolyfills || defaultPolyfills, {
|
||||
ignoreBrowserslistConfig,
|
||||
configPath
|
||||
})
|
||||
plugins.push([require('./polyfills-plugin'), { polyfills }])
|
||||
} else {
|
||||
polyfills = []
|
||||
}
|
||||
|
||||
// Pass options along to babel-preset-env
|
||||
presets.push([
|
||||
require('@babel/preset-env'), {
|
||||
loose,
|
||||
modules,
|
||||
targets,
|
||||
useBuiltIns,
|
||||
forceAllTransforms,
|
||||
ignoreBrowserslistConfig,
|
||||
exclude: polyfills
|
||||
}
|
||||
])
|
||||
|
||||
plugins.push(
|
||||
require('@babel/plugin-syntax-dynamic-import'),
|
||||
[require('@babel/plugin-proposal-decorators'), { legacy: decoratorsLegacy !== false }],
|
||||
[require('@babel/plugin-proposal-class-properties'), { loose }]
|
||||
)
|
||||
|
||||
// Transform runtime, but only for helpers
|
||||
plugins.push([require('@babel/plugin-transform-runtime'), {
|
||||
regenerator: useBuiltIns !== 'usage'
|
||||
}])
|
||||
|
||||
return {
|
||||
presets,
|
||||
plugins
|
||||
}
|
||||
}
|
24
packages/babel-preset-app/src/polyfills-plugin.js
Normal file
24
packages/babel-preset-app/src/polyfills-plugin.js
Normal file
@ -0,0 +1,24 @@
|
||||
// Add polyfill imports to the first file encountered.
|
||||
module.exports = ({ types }) => {
|
||||
let entryFile
|
||||
return {
|
||||
name: 'inject-polyfills',
|
||||
visitor: {
|
||||
Program(path, state) {
|
||||
if (!entryFile) {
|
||||
entryFile = state.filename
|
||||
} else if (state.filename !== entryFile) {
|
||||
return
|
||||
}
|
||||
|
||||
const { polyfills } = state.opts
|
||||
const { createImport } = require('@babel/preset-env/lib/utils')
|
||||
|
||||
// Imports are injected in reverse order
|
||||
polyfills.slice().reverse().forEach((p) => {
|
||||
createImport(path, p)
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
74
packages/builder/CHANGELOG.md
Normal file
74
packages/builder/CHANGELOG.md
Normal file
@ -0,0 +1,74 @@
|
||||
# Change Log
|
||||
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
## 2.3.1 (2018-11-16)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **app:** lint all templates ([#4175](https://github.com/nuxt/nuxt.js/issues/4175)) ([96bdcab](https://github.com/nuxt/nuxt.js/commit/96bdcab))
|
||||
* **builder:** use require.resolve to get the path of babel-loader ([#4150](https://github.com/nuxt/nuxt.js/issues/4150)) ([60dbc6d](https://github.com/nuxt/nuxt.js/commit/60dbc6d))
|
||||
* **deps:** update all non-major dependencies ([#4156](https://github.com/nuxt/nuxt.js/issues/4156)) ([ff6385f](https://github.com/nuxt/nuxt.js/commit/ff6385f))
|
||||
* **deps:** update all non-major dependencies ([#4172](https://github.com/nuxt/nuxt.js/issues/4172)) ([1cb7ce5](https://github.com/nuxt/nuxt.js/commit/1cb7ce5))
|
||||
* **deps:** update all non-major dependencies ([#4253](https://github.com/nuxt/nuxt.js/issues/4253)) ([f10f860](https://github.com/nuxt/nuxt.js/commit/f10f860))
|
||||
* **deps:** update all non-major dependencies ([#4270](https://github.com/nuxt/nuxt.js/issues/4270)) ([1a154e8](https://github.com/nuxt/nuxt.js/commit/1a154e8))
|
||||
* **deps:** update all non-major dependencies ([#4271](https://github.com/nuxt/nuxt.js/issues/4271)) ([dd114ff](https://github.com/nuxt/nuxt.js/commit/dd114ff))
|
||||
* **deps:** update all non-major dependencies ([#4310](https://github.com/nuxt/nuxt.js/issues/4310)) ([bfb6d6a](https://github.com/nuxt/nuxt.js/commit/bfb6d6a))
|
||||
* **deps:** update dependency consola to ^2.2.0 ([#4269](https://github.com/nuxt/nuxt.js/issues/4269)) ([47f67cc](https://github.com/nuxt/nuxt.js/commit/47f67cc))
|
||||
* **deps:** update dependency consola to ^2.2.3 ([#4293](https://github.com/nuxt/nuxt.js/issues/4293)) ([b290c07](https://github.com/nuxt/nuxt.js/commit/b290c07))
|
||||
* **pkg:** stick [@nuxt](https://github.com/nuxt) dependency versions ([#4339](https://github.com/nuxt/nuxt.js/issues/4339)) ([ca5d538](https://github.com/nuxt/nuxt.js/commit/ca5d538))
|
||||
* **publish:** set each package's publishConfig to public ([28b246d](https://github.com/nuxt/nuxt.js/commit/28b246d)), closes [lerna/lerna#178](https://github.com/lerna/lerna/issues/178)
|
||||
* check styleResources for existence ([#4155](https://github.com/nuxt/nuxt.js/issues/4155)) ([a3ba6e9](https://github.com/nuxt/nuxt.js/commit/a3ba6e9))
|
||||
* Duplicate declaration plugin when add/remove file in dev mode ([#4278](https://github.com/nuxt/nuxt.js/issues/4278)) ([3f2b10e](https://github.com/nuxt/nuxt.js/commit/3f2b10e))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* dx improvements ([#4259](https://github.com/nuxt/nuxt.js/issues/4259)) ([7c4e77f](https://github.com/nuxt/nuxt.js/commit/7c4e77f))
|
||||
* migrate nuxt into monorepo ([#4051](https://github.com/nuxt/nuxt.js/issues/4051)) ([9c1e0d1](https://github.com/nuxt/nuxt.js/commit/9c1e0d1))
|
||||
* split builder into more refined modules ([#4171](https://github.com/nuxt/nuxt.js/issues/4171)) ([9df5f49](https://github.com/nuxt/nuxt.js/commit/9df5f49))
|
||||
* update to consola 2 ([#4247](https://github.com/nuxt/nuxt.js/issues/4247)) ([1dd32d0](https://github.com/nuxt/nuxt.js/commit/1dd32d0))
|
||||
|
||||
|
||||
### Performance Improvements
|
||||
|
||||
* cherry-pick only used lodash imports ([#4099](https://github.com/nuxt/nuxt.js/issues/4099)) ([ab5af54](https://github.com/nuxt/nuxt.js/commit/ab5af54))
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# 2.3.0 (2018-11-16)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **app:** lint all templates ([#4175](https://github.com/nuxt/nuxt.js/issues/4175)) ([96bdcab](https://github.com/nuxt/nuxt.js/commit/96bdcab))
|
||||
* **builder:** use require.resolve to get the path of babel-loader ([#4150](https://github.com/nuxt/nuxt.js/issues/4150)) ([60dbc6d](https://github.com/nuxt/nuxt.js/commit/60dbc6d))
|
||||
* **deps:** update all non-major dependencies ([#4156](https://github.com/nuxt/nuxt.js/issues/4156)) ([ff6385f](https://github.com/nuxt/nuxt.js/commit/ff6385f))
|
||||
* **deps:** update all non-major dependencies ([#4172](https://github.com/nuxt/nuxt.js/issues/4172)) ([1cb7ce5](https://github.com/nuxt/nuxt.js/commit/1cb7ce5))
|
||||
* **deps:** update all non-major dependencies ([#4253](https://github.com/nuxt/nuxt.js/issues/4253)) ([f10f860](https://github.com/nuxt/nuxt.js/commit/f10f860))
|
||||
* **deps:** update all non-major dependencies ([#4270](https://github.com/nuxt/nuxt.js/issues/4270)) ([1a154e8](https://github.com/nuxt/nuxt.js/commit/1a154e8))
|
||||
* **deps:** update all non-major dependencies ([#4271](https://github.com/nuxt/nuxt.js/issues/4271)) ([dd114ff](https://github.com/nuxt/nuxt.js/commit/dd114ff))
|
||||
* **deps:** update all non-major dependencies ([#4310](https://github.com/nuxt/nuxt.js/issues/4310)) ([bfb6d6a](https://github.com/nuxt/nuxt.js/commit/bfb6d6a))
|
||||
* **deps:** update dependency consola to ^2.2.0 ([#4269](https://github.com/nuxt/nuxt.js/issues/4269)) ([47f67cc](https://github.com/nuxt/nuxt.js/commit/47f67cc))
|
||||
* **deps:** update dependency consola to ^2.2.3 ([#4293](https://github.com/nuxt/nuxt.js/issues/4293)) ([b290c07](https://github.com/nuxt/nuxt.js/commit/b290c07))
|
||||
* **pkg:** stick [@nuxt](https://github.com/nuxt) dependency versions ([#4339](https://github.com/nuxt/nuxt.js/issues/4339)) ([ca5d538](https://github.com/nuxt/nuxt.js/commit/ca5d538))
|
||||
* **publish:** set each package's publishConfig to public ([28b246d](https://github.com/nuxt/nuxt.js/commit/28b246d)), closes [lerna/lerna#178](https://github.com/lerna/lerna/issues/178)
|
||||
* check styleResources for existence ([#4155](https://github.com/nuxt/nuxt.js/issues/4155)) ([a3ba6e9](https://github.com/nuxt/nuxt.js/commit/a3ba6e9))
|
||||
* Duplicate declaration plugin when add/remove file in dev mode ([#4278](https://github.com/nuxt/nuxt.js/issues/4278)) ([3f2b10e](https://github.com/nuxt/nuxt.js/commit/3f2b10e))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* dx improvements ([#4259](https://github.com/nuxt/nuxt.js/issues/4259)) ([7c4e77f](https://github.com/nuxt/nuxt.js/commit/7c4e77f))
|
||||
* migrate nuxt into monorepo ([#4051](https://github.com/nuxt/nuxt.js/issues/4051)) ([9c1e0d1](https://github.com/nuxt/nuxt.js/commit/9c1e0d1))
|
||||
* split builder into more refined modules ([#4171](https://github.com/nuxt/nuxt.js/issues/4171)) ([9df5f49](https://github.com/nuxt/nuxt.js/commit/9df5f49))
|
||||
* update to consola 2 ([#4247](https://github.com/nuxt/nuxt.js/issues/4247)) ([1dd32d0](https://github.com/nuxt/nuxt.js/commit/1dd32d0))
|
||||
|
||||
|
||||
### Performance Improvements
|
||||
|
||||
* cherry-pick only used lodash imports ([#4099](https://github.com/nuxt/nuxt.js/issues/4099)) ([ab5af54](https://github.com/nuxt/nuxt.js/commit/ab5af54))
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user