前端代码

This commit is contained in:
ChloeChen0423
2025-05-12 16:42:36 +09:00
commit 7c63f2f07b
4531 changed files with 656010 additions and 0 deletions

191
node_modules/lite-server/.eslintrc generated vendored Normal file
View File

@ -0,0 +1,191 @@
{
"env": {
"node": true,
"es6": true
},
"extends": ["eslint:recommended"],
"rules": {
"accessor-pairs": "error",
"array-bracket-spacing": ["error", "never"],
"array-callback-return": "error",
"arrow-body-style": "error",
"arrow-parens": "error",
"arrow-spacing": "error",
"block-scoped-var": "error",
"block-spacing": "error",
"brace-style": ["error", "1tbs"],
"callback-return": "error",
"camelcase": "error",
"comma-spacing": [
"error",
{
"after": true,
"before": false
}
],
"comma-style": ["error", "last"],
"complexity": ["error", 20],
"computed-property-spacing": "error",
"consistent-return": "error",
"consistent-this": "error",
"curly": "error",
"default-case": "error",
"dot-location": "error",
"dot-notation": "error",
"eol-last": "error",
"eqeqeq": "error",
"func-names": "error",
"func-style": "off",
"generator-star-spacing": "error",
"global-require": "off",
"guard-for-in": "error",
"handle-callback-err": "error",
"id-blacklist": "error",
"id-length": "off",
"id-match": "error",
"indent": ["error", 2],
"init-declarations": "off",
"jsx-quotes": "error",
"key-spacing": "error",
"keyword-spacing": [
"error",
{
"after": true,
"before": true
}
],
"linebreak-style": "off",
"lines-around-comment": "off",
"max-depth": "error",
"max-len": [
2,
{
"code": 100,
"tabWidth": 2,
"ignoreUrls": true
}
],
"max-nested-callbacks": "error",
"max-params": "error",
"max-statements": "off",
"new-cap": "error",
"new-parens": "error",
"newline-after-var": "off",
"newline-before-return": "error",
"newline-per-chained-call": "error",
"no-alert": "error",
"no-array-constructor": "error",
"no-bitwise": "error",
"no-caller": "error",
"no-catch-shadow": "error",
"no-confusing-arrow": "error",
"no-continue": "error",
"no-div-regex": "error",
"no-else-return": "error",
"no-empty-function": "off",
"no-eq-null": "error",
"no-eval": "error",
"no-extend-native": "error",
"no-extra-bind": "error",
"no-extra-label": "error",
"no-extra-parens": "off",
"no-floating-decimal": "error",
"no-implicit-coercion": "error",
"no-implicit-globals": "error",
"no-implied-eval": "error",
"no-inline-comments": "off",
"no-invalid-this": "error",
"no-iterator": "error",
"no-label-var": "error",
"no-labels": "error",
"no-lone-blocks": "error",
"no-lonely-if": "error",
"no-loop-func": "error",
"no-magic-numbers": "off",
"no-mixed-requires": "error",
"no-multi-spaces": "error",
"no-multi-str": "error",
"no-multiple-empty-lines": "error",
"no-native-reassign": "error",
"no-negated-condition": "error",
"no-nested-ternary": "error",
"no-new": "error",
"no-new-func": "error",
"no-new-object": "error",
"no-new-require": "error",
"no-new-wrappers": "error",
"no-octal-escape": "error",
"no-param-reassign": "off",
"no-path-concat": "error",
"no-plusplus": "error",
"no-process-env": "error",
"no-process-exit": "error",
"no-proto": "error",
"no-restricted-globals": "error",
"no-restricted-imports": "error",
"no-restricted-modules": "error",
"no-restricted-syntax": "error",
"no-return-assign": "error",
"no-script-url": "error",
"no-self-compare": "error",
"no-sequences": "error",
"no-shadow": "error",
"no-shadow-restricted-names": "error",
"no-spaced-func": "error",
"no-sync": "error",
"no-ternary": "error",
"no-throw-literal": "error",
"no-trailing-spaces": "error",
"no-undef-init": "error",
"no-undefined": "error",
"no-underscore-dangle": "error",
"no-unmodified-loop-condition": "error",
"no-unneeded-ternary": "error",
"no-unused-expressions": "error",
"no-use-before-define": "off",
"no-useless-call": "error",
"no-useless-concat": "error",
"no-useless-constructor": "error",
"no-var": "off",
"no-void": "error",
"no-warning-comments": "error",
"no-whitespace-before-property": "error",
"no-with": "error",
"object-curly-spacing": ["error", "always"],
"object-shorthand": "error",
"one-var": "off",
"one-var-declaration-per-line": "error",
"operator-assignment": "error",
"operator-linebreak": "error",
"padded-blocks": "off",
"prefer-arrow-callback": "error",
"prefer-const": "error",
"prefer-reflect": "error",
"prefer-rest-params": "error",
"prefer-spread": "error",
"prefer-template": "error",
"quote-props": "off",
"quotes": ["error", "single"],
"radix": "error",
"require-jsdoc": "off",
"require-yield": "error",
"semi": "error",
"semi-spacing": "error",
"sort-imports": "error",
"sort-vars": "error",
"space-before-blocks": "error",
"space-before-function-paren": "off",
"space-in-parens": ["error", "never"],
"space-infix-ops": "error",
"space-unary-ops": "error",
"spaced-comment": ["error", "always"],
"strict": "error",
"template-curly-spacing": "error",
"valid-jsdoc": "error",
"vars-on-top": "off",
"wrap-iife": "error",
"wrap-regex": "error",
"yield-star-spacing": "error",
"yoda": ["error", "never"]
}
}

5
node_modules/lite-server/.travis.yml generated vendored Normal file
View File

@ -0,0 +1,5 @@
language: node_js
node_js: stable
script:
- npm test

27
node_modules/lite-server/CHANGELOG.md generated vendored Normal file
View File

@ -0,0 +1,27 @@
# Change Log
All notable changes to the code will be documented in this file.
## 2.6.1
- Fixed npm audit's reported security vulnerabilities
- Fixed npm outdated packages
- Updated to 2.6.1
- Updated default branch to `main`
- update tests to use node 12 and 14
## 2.5.4
- Fixed npm audit's reported security vulnerabilities
- [audit fixes](https://github.com/johnpapa/lite-server/commit/14f718f204f0305490166ec4e07fda6813996703)
- [ws](https://github.com/johnpapa/lite-server/commit/7de85f2393ce17f493fc2f375820662cae421526)
- [js yaml](https://github.com/johnpapa/lite-server/commit/a1f81830069970845dde7a0fbbb3449f1a20afc8)
- [handlebars](https://github.com/johnpapa/lite-server/commit/b66952cf8911b41a30b0b9626eeb4db793bc813b
- [moment](https://github.com/johnpapa/lite-server/commit/cdef287b088b3488473cdaf9cfadba2a8d9af935)
## 2.5.3
- Fixed npm audit's reported security vulnerabilities
- Updated `var` to `let` and `const`
- Updated scripts for testing
- Added to Azure DevOps pipelines

19
node_modules/lite-server/ISSUE_TEMPLATE.md generated vendored Normal file
View File

@ -0,0 +1,19 @@
Before you open an issue, please check if a similar issue already exists or has been closed before.
### A descriptive title
The behavior you expect to see, and the actual behavior...
For feature requests, a description of the problem you're trying to solve, including *why* you think this is a problem.
### Bug repro steps
Please give us an isolated way to reproduce the behavior (example: GitHub repository with code that anyone can clone to observe the problem, or a Dockerfile that replicates your environment):
1.
2.
3.
### Environment
- `lite-server` version:
- `nodejs` version:
- `npm` version:
- OS type/version:

21
node_modules/lite-server/LICENSE generated vendored Normal file
View File

@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) 2015-2016 John Papa
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

181
node_modules/lite-server/README.md generated vendored Normal file
View File

@ -0,0 +1,181 @@
# lite-server
Lightweight _development only_ node server that serves a web app, opens it in the browser, refreshes when html or javascript change, injects CSS changes using sockets, and has a fallback page when a route is not found.
[![Dependency Status](https://david-dm.org/johnpapa/lite-server.svg)](https://david-dm.org/johnpapa/lite-server)
[![npm version](https://badge.fury.io/js/lite-server.svg)](http://badge.fury.io/js/lite-server)
[![Build Status](https://travis-ci.org/johnpapa/lite-server.svg?branch=main)](https://travis-ci.org/johnpapa/lite-server) [![Greenkeeper badge](https://badges.greenkeeper.io/johnpapa/lite-server.svg)](https://greenkeeper.io/)
[![Build Status](https://dev.azure.com/johnpapa/lite-server/_apis/build/status/johnpapa.lite-server?branchName=main)](https://dev.azure.com/johnpapa/lite-server/_build/latest?definitionId=4&branchName=main&WT.mc_id=liteserver-github-jopapa)
## Why
BrowserSync does most of what we want in a super fast lightweight development server. It serves the static content, detects changes, refreshes the browser, and offers many customizations.
When creating a SPA there are routes that are only known to the browser. For example, `/customer/21` may be a client side route for an Angular app. If this route is entered manually or linked to directly as the entry point of the Angular app (aka a deep link) the static server will receive the request, because Angular is not loaded yet. The server will not find a match for the route and thus return a 404. The desired behavior in this case is to return the `index.html` (or whatever starting page of the app we have defined). BrowserSync does not automatically allow for a fallback page. But it does allow for custom middleware. This is where `lite-server` steps in.
`lite-server` is a simple customized wrapper around BrowserSync to make it easy to serve SPAs.
## Installation and Usage
The recommended installation method is a local NPM install for your project:
```bash
npm install lite-server --save-dev
yarn add lite-server --dev # or yarn
```
...and add a "script" entry within your project's `package.json` file:
```json
# Inside package.json...
"scripts": {
"dev": "lite-server"
},
```
With the above script entry, you can then start `lite-server` via:
```bash
npm run dev
```
Other options for running locally installed NPM binaries is discussed in this Stack Overflow question: [How to use package installed locally in node_modules](http://stackoverflow.com/q/9679932)
### Using on the fly
lite-server can be used with `npx`
```bash
npx lite-server
```
### Global Installation
lite-server can be also installed globally, if preferred:
```bash
npm install --global lite-server
# To run:
lite-server
```
## Custom Configuration
The default behavior serves from the current folder, opens a browser, and applies a HTML5 route fallback to `./index.html`.
lite-server uses [BrowserSync](https://www.browsersync.io/), and allows for configuration overrides via a local `bs-config.json` or `bs-config.js` file in your project.
You can provide custom path to your config file via `-c` or `--config=` run time options:
```bash
lite-server -c configs/my-bs-config.js
```
For example, to change the server port, watched file paths, and base directory for your project, create a `bs-config.json` in your project's folder:
```json
{
"port": 8000,
"files": ["./src/**/*.{html,htm,css,js}"],
"server": { "baseDir": "./src" }
}
```
You can also provide custom path to your base directory `--baseDir=` run time options:
```bash
lite-server --baseDir="dist"
```
A more complicated example with modifications to the server middleware can be done with a `bs-config.js` file, which requires the `module.exports = { ... };` syntax:
```js
module.exports = {
server: {
middleware: {
// overrides the second middleware default with new settings
1: require('connect-history-api-fallback')({
index: '/index.html',
verbose: true,
}),
},
},
};
```
The `bs-config.js` file may also export a function that receives the lite-server Browsersync instance as its only argument. While not required, the return value of this function will be used to extend the default lite-server configuration.
```js
module.exports = function (bs) {
return {
server: {
middleware: {
// overrides the second middleware default with new settings
1: require('connect-history-api-fallback')({
index: '/index.html',
verbose: true,
}),
},
},
};
};
```
**NOTE:** Keep in mind that when using middleware overrides the specific middleware module must be installed in your project. For the above example, you'll need to do:
```bash
npm install connect-history-api-fallback --save-dev
```
...otherwise you'll get an error similar to:
```bash
Error: Cannot find module 'connect-history-api-fallback'
```
Another example: To remove one of the [default middlewares](./lib/config-defaults.js), such as `connect-logger`, you can set it's array index to `null`:
```js
module.exports = {
server: {
middleware: {
0: null, // removes default `connect-logger` middleware
},
},
};
```
A list of the entire set of BrowserSync options can be found in its docs: <http://www.browsersync.io/docs/options/>
## Testing
When using `lite-server` to run end to end tests, we may not want to log verbosely. We may also want to prevent the browser from opening. These options in the `bs-config.js` will silence all logging from `lite-server`:
```js
open: false
logLevel: "silent",
server: {
middleware: {
0: null
}
}
```
## Known Issues
CSS with Angular 2 is embedded thus even though BrowserSync detects the file change to CSS, it does not inject the file via sockets. As a workaround, `injectChanges` defaults to `false`.
## Contributing
1. Fork and clone it
1. Install dependencies: `npm install`
1. Create a feature branch: `git checkout -b new-feature`
1. Commit changes: `git commit -am 'Added a feature'`
1. Run static code analysis and unit tests: `npm test`
1. Push to the remote branch: `git push origin new-feature`
1. Create a new [Pull Request](https://github.com/johnpapa/lite-server/pull/new/main)
## License
Code released under the [MIT license](./LICENSE).

67
node_modules/lite-server/azure-pipelines.yml generated vendored Normal file
View File

@ -0,0 +1,67 @@
trigger:
branches:
include:
- main
pr:
- main
jobs:
- job: Linux
pool:
# https://docs.microsoft.com/en-us/azure/devops/pipelines/agents/hosted?view=azure-devops&tabs=yaml#use-a-microsoft-hosted-agent
name: Hosted Ubuntu 1604
demands: npm
strategy:
matrix:
node_12_x:
node_version: 12.x
node_14_x:
node_version: 14.x
steps:
- task: NodeTool@0
displayName: 'Use $(node_version)'
inputs:
versionSpec: $(node_version)
- task: Npm@1
displayName: 'Install dependencies'
inputs:
verbose: false
command: install
- task: Npm@1
displayName: 'Run tests'
inputs:
command: custom
verbose: false
customCommand: 'run test'
- job: macOS
pool:
# https://docs.microsoft.com/en-us/azure/devops/pipelines/agents/hosted?view=azure-devops&tabs=yaml#use-a-microsoft-hosted-agent
name: Hosted macOS
demands: npm
strategy:
matrix:
node_12_x:
node_version: 12.x
node_14_x:
node_version: 14.x
steps:
- task: NodeTool@0
displayName: 'Use $(node_version)'
inputs:
versionSpec: $(node_version)
- task: Npm@1
displayName: 'Install dependencies'
inputs:
verbose: false
command: install
- task: Npm@1
displayName: 'Run tests'
inputs:
command: custom
verbose: false
customCommand: 'run test'

7
node_modules/lite-server/bin/lite-server generated vendored Normal file
View File

@ -0,0 +1,7 @@
#!/usr/bin/env node
'use strict';
// Provide a title to the process in `ps`
process.title = 'lite-server';
require('../lib/lite-server')();

5
node_modules/lite-server/index.js generated vendored Normal file
View File

@ -0,0 +1,5 @@
'use strict';
module.exports = {
server: require('./lib/lite-server.js'),
defaults: require('./lib/config-defaults')
};

24
node_modules/lite-server/lib/config-defaults.js generated vendored Normal file
View File

@ -0,0 +1,24 @@
'use strict';
var fallback = require('connect-history-api-fallback');
var log = require('connect-logger');
/*
| For up-to-date information about the options:
| http://www.browsersync.io/docs/options/
*/
module.exports = {
injectChanges: false, // workaround for Angular 2 styleUrls loading
files: ['./**/*.{html,htm,css,js}'],
watchOptions: {
ignored: 'node_modules'
},
server: {
baseDir: './',
middleware: [
log({ format: '%date %status %method %url' }),
fallback({
index: '/index.html',
htmlAcceptHeaders: ['text/html', 'application/xhtml+xml'] // systemjs workaround
})
]
}
};

77
node_modules/lite-server/lib/lite-server.js generated vendored Normal file
View File

@ -0,0 +1,77 @@
'use strict';
/**
* lite-server : Simple server for angular/SPA projects
*
* Simply loads some default browser-sync config that apply to SPAs,
* applies custom config overrides from user's own local `bs-config.{js|json}` file,
* and launches browser-sync.
*/
const browserSync = require('browser-sync').create('lite-server');
const path = require('path');
const _ = require('lodash');
const config = require('./config-defaults');
module.exports = function start(opts, cb) {
opts = opts || {};
opts.argv = opts.argv || process.argv;
opts.console = opts.console || console;
cb = cb || function noop() {};
// Load configuration
const argv = require('minimist')(opts.argv.slice(2));
const bsConfigName = argv.c || argv.config || 'bs-config';
// Load optional browser-sync config file from user's project dir
const bsConfigPath = path.resolve(bsConfigName);
let overrides = {};
try {
overrides = require(bsConfigPath);
} catch (err) {
if (err.code && err.code === 'MODULE_NOT_FOUND') {
logMissingConfigFile();
} else {
throw err;
}
}
// Set optional baseDir
config.server.baseDir = argv.baseDir || config.server.baseDir;
if (typeof overrides === 'function') {
overrides = overrides(browserSync);
}
_.merge(config, overrides);
// Fixes browsersync error when overriding middleware array
if (config.server.middleware) {
config.server.middleware = _.compact(config.server.middleware);
}
logConfig();
// Run browser-sync
browserSync.init(config, cb);
return browserSync;
function logEnabled() {
return config.logLevel !== 'silent';
}
function logConfig() {
if (logEnabled()) {
opts.console.log('** browser-sync config **');
opts.console.log(config);
}
}
function logMissingConfigFile() {
if (logEnabled()) {
opts.console.info(
'Did not detect a `bs-config.json` or `bs-config.js` override file.' +
' Using lite-server defaults...'
);
}
}
};

View File

@ -0,0 +1,15 @@
#!/bin/sh
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
case `uname` in
*CYGWIN*) basedir=`cygpath -w "$basedir"`;;
esac
if [ -x "$basedir/node" ]; then
"$basedir/node" "$basedir/../../../browser-sync/dist/bin.js" "$@"
ret=$?
else
node "$basedir/../../../browser-sync/dist/bin.js" "$@"
ret=$?
fi
exit $ret

View File

@ -0,0 +1,7 @@
@IF EXIST "%~dp0\node.exe" (
"%~dp0\node.exe" "%~dp0\..\..\..\browser-sync\dist\bin.js" %*
) ELSE (
@SETLOCAL
@SET PATHEXT=%PATHEXT:;.JS;=;%
node "%~dp0\..\..\..\browser-sync\dist\bin.js" %*
)

43
node_modules/lite-server/package.json generated vendored Normal file
View File

@ -0,0 +1,43 @@
{
"name": "lite-server",
"version": "2.6.1",
"description": "Lightweight development node server for serving a web app, providing a fallback for browser history API, loading in the browser, and injecting scripts on the fly.",
"main": "index.js",
"scripts": {
"test": "eslint *.js lib/*.js && istanbul cover _mocha -- -R spec"
},
"repository": {
"type": "git",
"url": "git+https://github.com/johnpapa/lite-server.git"
},
"keywords": [
"angular",
"spa",
"static",
"server",
"development"
],
"contributors": [
"John Papa <john@johnpapa.net>",
"Christopher Martin <cgmartin@gmail.com>"
],
"license": "MIT",
"bin": {
"lite-server": "./bin/lite-server"
},
"homepage": "https://github.com/johnpapa/lite-server#readme",
"dependencies": {
"browser-sync": "^2.26.13",
"connect-history-api-fallback": "^1.6.0",
"connect-logger": "^0.0.1",
"lodash": "^4.17.20",
"minimist": "^1.2.5"
},
"devDependencies": {
"eslint": "^7.13.0",
"istanbul": "^0.4.5",
"mocha": "^8.2.1",
"mockery": "^2.1.0",
"sinon": "^9.2.1"
}
}

49
node_modules/lite-server/test/config-defaults.spec.js generated vendored Normal file
View File

@ -0,0 +1,49 @@
/* global it, describe, beforeEach, afterEach */
'use strict';
const assert = require('assert');
const mockery = require('mockery');
const sinon = require('sinon');
describe('config-defaults', () => {
let fallbackMock;
let loggerMock;
beforeEach(() => {
mockery.enable({ useCleanCache: true });
fallbackMock = sinon.stub();
mockery.registerMock('connect-history-api-fallback', fallbackMock);
loggerMock = sinon.stub();
mockery.registerMock('connect-logger', loggerMock);
mockery.registerAllowable('../lib/config-defaults');
});
afterEach(() => {
mockery.deregisterAll();
mockery.disable();
});
it('should provide defaults', () => {
fallbackMock.returns('fallback-middleware');
loggerMock.returns('logger-middleware');
const configDefaults = require('../lib/config-defaults');
assert.strictEqual(configDefaults.injectChanges, false, 'includes NG2 styleUrls workaround');
assert.ok(configDefaults.files.length, 'includes files array');
assert.strictEqual(
configDefaults.watchOptions.ignored,
'node_modules',
'ignores node_modules from watchlist'
);
assert.ok(configDefaults.server.baseDir, 'includes basedir');
assert.deepEqual(
configDefaults.server.middleware,
['logger-middleware', 'fallback-middleware'],
'includes middleware'
);
assert.ok(loggerMock.called, 'logger middleware initialized');
assert.ok(fallbackMock.called, 'fallback middleware initialized');
});
});

108
node_modules/lite-server/test/lite-server.spec.js generated vendored Normal file
View File

@ -0,0 +1,108 @@
/* global it, describe, beforeEach, afterEach */
'use strict';
const assert = require('assert');
const mockery = require('mockery');
const sinon = require('sinon');
const path = require('path');
describe('lite-server', () => {
let browserSyncMock;
let browserSyncMethodStubs;
let configDefaultsMock;
let consoleStubs;
let callbackStub;
beforeEach(() => {
mockery.enable({ useCleanCache: true });
browserSyncMethodStubs = { init: sinon.stub() };
browserSyncMock = sinon.stub().returns(browserSyncMethodStubs);
mockery.registerMock('browser-sync', { create: browserSyncMock });
consoleStubs = {
log: sinon.stub(),
info: sinon.stub()
};
configDefaultsMock = {
server: { middleware: ['m1', 'm2'] }
};
mockery.registerMock('./config-defaults', configDefaultsMock);
callbackStub = sinon.stub();
mockery.registerAllowables(['path', 'lodash', 'minimist', '../lib/lite-server']);
});
afterEach(() => {
mockery.deregisterAll();
mockery.disable();
});
it('should merge configs', () => {
browserSyncMethodStubs.init.yields();
configDefaultsMock.a = 1;
const bsConfigMock = {
b: 2,
server: {
middleware: {
0: null
}
}
};
mockery.registerMock(path.resolve('./bs-config'), bsConfigMock);
const liteServer = require('../lib/lite-server');
const bs = liteServer({ console: consoleStubs, argv: [] }, callbackStub);
assert.ok(bs.init, 'returns browsersync');
assert.ok(
browserSyncMethodStubs.init.calledWithMatch({
server: {
middleware: ['m2']
},
a: 1,
b: 2
}),
'configs were merged'
);
assert.ok(callbackStub.called, 'callback was called');
});
it('should handle missing bs-config', () => {
mockery.registerAllowable(path.resolve('missing-config'));
const liteServer = require('../lib/lite-server');
const bs = liteServer(
{
console: consoleStubs,
argv: [null, null, '-c', 'missing-config']
},
callbackStub
);
assert.ok(bs.init, 'returns browsersync');
assert.ok(consoleStubs.info.calledWithMatch('Did not detect'));
});
it('should support bs-config as function', () => {
const bsConfigMock = sinon.stub().returns({ b: 2 });
mockery.registerMock(path.resolve('./bs-config'), bsConfigMock);
const liteServer = require('../lib/lite-server');
const bs = liteServer({ console: consoleStubs, argv: [] }, callbackStub);
assert.ok(bs.init, 'returns browsersync');
assert.ok(
browserSyncMethodStubs.init.calledWithMatch({
server: {
middleware: ['m1', 'm2']
},
b: 2
}),
'configs were merged'
);
assert.ok(bsConfigMock.calledWith(bs), 'browsersync passed into bsconfig fn');
});
});