Example #1
0
// On Windows a backslash acts as a path separator.
assert.equal(path.win32.basename('\\dir\\basename.ext'), 'basename.ext');
assert.equal(path.win32.basename('\\basename.ext'), 'basename.ext');
assert.equal(path.win32.basename('basename.ext'), 'basename.ext');
assert.equal(path.win32.basename('basename.ext\\'), 'basename.ext');
assert.equal(path.win32.basename('basename.ext\\\\'), 'basename.ext');
assert.equal(path.win32.basename('foo'), 'foo');
assert.equal(path.win32.basename(null), 'null');
assert.equal(path.win32.basename(true), 'true');
assert.equal(path.win32.basename(1), '1');
assert.equal(path.win32.basename(), 'undefined');
assert.equal(path.win32.basename({}), '[object Object]');

// On unix a backslash is just treated as any other character.
assert.equal(path.posix.basename('\\dir\\basename.ext'), '\\dir\\basename.ext');
assert.equal(path.posix.basename('\\basename.ext'), '\\basename.ext');
assert.equal(path.posix.basename('basename.ext'), 'basename.ext');
assert.equal(path.posix.basename('basename.ext\\'), 'basename.ext\\');
assert.equal(path.posix.basename('basename.ext\\\\'), 'basename.ext\\\\');
assert.equal(path.posix.basename('foo'), 'foo');
assert.equal(path.posix.basename(null), 'null');
assert.equal(path.posix.basename(true), 'true');
assert.equal(path.posix.basename(1), '1');
assert.equal(path.posix.basename(), 'undefined');
assert.equal(path.posix.basename({}), '[object Object]');

// POSIX filenames may include control characters
// c.f. http://www.dwheeler.com/essays/fixing-unix-linux-filenames.html
const controlCharFilename = 'Icon' + String.fromCharCode(13);
assert.equal(path.posix.basename('/a/b/' + controlCharFilename),
Example #2
0
exports.assetsPath = function (_path) {
  var assetsSubDirectory = process.env.NODE_ENV === 'production'
    ? config.build.assetsSubDirectory
    : config.dev.assetsSubDirectory
  return path.posix.join(assetsSubDirectory, _path)
}
assert.equal(path.basename(''), '');
assert.equal(path.basename('/dir/basename.ext'), 'basename.ext');
assert.equal(path.basename('/basename.ext'), 'basename.ext');
assert.equal(path.basename('basename.ext'), 'basename.ext');
assert.equal(path.basename('basename.ext/'), 'basename.ext');
assert.equal(path.basename('basename.ext//'), 'basename.ext');

// On Windows a backslash acts as a path separator.
assert.equal(path.win32.basename('\\dir\\basename.ext'), 'basename.ext');
assert.equal(path.win32.basename('\\basename.ext'), 'basename.ext');
assert.equal(path.win32.basename('basename.ext'), 'basename.ext');
assert.equal(path.win32.basename('basename.ext\\'), 'basename.ext');
assert.equal(path.win32.basename('basename.ext\\\\'), 'basename.ext');

// On unix a backslash is just treated as any other character.
assert.equal(path.posix.basename('\\dir\\basename.ext'), '\\dir\\basename.ext');
assert.equal(path.posix.basename('\\basename.ext'), '\\basename.ext');
assert.equal(path.posix.basename('basename.ext'), 'basename.ext');
assert.equal(path.posix.basename('basename.ext\\'), 'basename.ext\\');
assert.equal(path.posix.basename('basename.ext\\\\'), 'basename.ext\\\\');

// POSIX filenames may include control characters
// c.f. http://www.dwheeler.com/essays/fixing-unix-linux-filenames.html
if (!isWindows) {
  var controlCharFilename = 'Icon' + String.fromCharCode(13);
  assert.equal(path.basename('/a/b/' + controlCharFilename),
               controlCharFilename);
}

assert.equal(path.extname(f), '.js');
          }
        },
        canPrint: true
      })
    ]
  }
}

 */

const webpackConfig = {
	mode: isDev ? 'development' : 'production',
	target: 'web',
	entry: entries,//path.join(__dirname, '../app/index.js'),
	output: {
		filename: path.posix.join('static/scripts', '[name].[hash:8].js'),
		chunkFilename: path.posix.join('static/scripts', '[name].[id].[hash:8].js'),
		publicPath: isDev ? '/' : 'http://www.omoideo.com',
		path: path.join(__dirname, '../dist')
	},
	resolve: {
	    extensions: ['.js', '.vue', '.json'],
	    alias: {
	      	'@': path.resolve(__dirname, '../app'),
	      	'server': path.resolve(__dirname, '../server'),
	      	'app': path.resolve(__dirname, '../app'),
	      	'src': path.resolve(__dirname, '../app'),
	      	'components': path.resolve(__dirname, '../app/components')
	    }
	},
	module: {
 function getReference(symbolOrDec, isModule) {
     var containerFactory;
     var isGlobal = false;
     var dec;
     var name;
     if (symbolOrDec.kind) {
         dec = symbolOrDec;
         name = getName(dec.name);
         var globalSymbol = globals.types[name];
         isGlobal = !isModule && globalSymbol && globalSymbol.declarations[0] === dec;
     }
     else {
         var symbol = symbolOrDec;
         var i = 0;
         dec = symbol.declarations[0];
         while ((dec.kind === 209 || dec.kind === 211) && (i + 1) < symbol.declarations.length) {
             i++;
             dec = symbol.declarations[i];
         }
         name = symbol.name;
         isGlobal = !isModule && globals.types[name] === symbol;
     }
     if (isGlobal) {
         containerFactory = moduleFactories[''];
         if (!containerFactory) {
             containerFactory = new s.ModuleFactory('');
             moduleFactories[''] = containerFactory;
         }
     }
     else {
         var moduleName;
         var names = [];
         var previousName;
         var node = isModule ? dec : dec.parent;
         while (node.kind !== 246) {
             switch (node.kind) {
                 case 216:
                     var mod = node;
                     var forName = namespacesAsModules[mod.name.text];
                     if (forName) {
                         var shouldBreak = false;
                         var modSymbol = tc.getTypeAtLocation(mod).symbol;
                         for (var i = 0; i < forName.length; i++) {
                             if (forName[i][0] === modSymbol) {
                                 moduleName = utils.fileNameToModuleName(forName[i][1].fileName, rootDir, relativePrefix);
                                 shouldBreak = true;
                                 break;
                             }
                         }
                         if (shouldBreak) {
                             break;
                         }
                     }
                     if (node.parent.kind === 246 && globals.modules[mod.name.text]) {
                         moduleName = mod.name.text;
                         break;
                     }
                     else {
                         previousName = mod.name.text;
                         names.splice(0, 0, mod.name.text);
                     }
             }
             node = node.parent;
         }
         if (moduleName) {
             if (relativePrefix && moduleName.substring(0, 2) === './') {
                 if (relativePrefix.charAt) {
                     moduleName = path.posix.join(relativePrefix, moduleName);
                 }
                 else {
                     moduleName = relativePrefix(node.fileName, moduleName);
                 }
             }
         }
         else if (globals.namespaces[previousName] || node.fileName.substring(node.fileName.length - 8) === 'lib.d.ts') {
             moduleName = '';
         }
         else {
             moduleName = utils.fileNameToModuleName(node.fileName, rootDir, relativePrefix);
         }
         containerFactory = moduleFactories[moduleName];
         if (!containerFactory) {
             containerFactory = new s.ModuleFactory(moduleName);
             moduleFactories[moduleName] = containerFactory;
         }
         names.forEach(function (name) {
             containerFactory = containerFactory.addNamespace(name);
         });
     }
     if (isModule) {
         return containerFactory;
     }
     else {
         switch (dec.kind) {
             case 213:
                 return containerFactory.addInterfaceConstructor(name);
             case 212:
                 return containerFactory.addClassConstructor(name);
             case 215:
                 return containerFactory.addEnum(name);
             case 214:
                 return containerFactory.addTypeAliasConstructor(name);
             case 211:
                 return containerFactory.addValue(name);
             case 209:
                 var varDec = dec;
                 return containerFactory.addValue(name);
             case 216:
                 return containerFactory;
             default:
                 throw new Error('Unrecognised declaration kind: ' + dec.kind + ' with text: ' + dec.getText());
         }
     }
 }
Example #6
0
console.log(path.sep);          // \
console.log(path.delimiter);    // ;

console.log(process.env.PATH.split(path.delimiter));


console.log(path.basename('C:\\temp\\myfile.html'));        // myfile.html
console.log(path.basename('C:\\temp\\myfile.html', '.html'));        // myfile
console.log(path.dirname('C:\\temp\\myfile.html'));        // C:\temp
console.log(path.extname('C:\\temp\\myfile.html'));        // .html


console.log(path.win32.basename('C:\\temp\\myfile.html'));  // myfile.html

console.log(path.posix.basename('/tmp/myfile.html'));       // myfile.html


console.log(path.format({
    dir: 'C:\\temp',
    base: 'file.txt'
}));
// C:\temp\file.txt

console.log(path.parse('C:\\temp\\file.txt'));
// { root: 'C:\\',
//     dir: 'C:\\temp',
//     base: 'file.txt',
//     ext: '.txt',
//     name: 'file' }
exports.assetsPath = function (newPath) {
    return path.posix.join('static', newPath);
};
Example #8
0
			.pipe(rename(function (p) {
				p.dirname = path.posix.join(fullName, p.dirname.replace(/^extension[/\\]?/, ''));
			}));
Example #9
0
			.pipe(rename(function (p) {
				p.dirname = path.posix.join('extensions', p.dirname);
			}));
Example #10
0
      }
      // Wait for the process to close
      this.receive(remoteProcess, (err, received) => {
        if (err) {
          return reject(err);
        } else {
          // Return stdout
          return resolve(received.toString());
        }
      });
    });
  });
};

Tessel.REMOTE_APP_PATH = '/app/';
Tessel.REMOTE_TMP_PATH = '/tmp/';
Tessel.REMOTE_SCRIPT_PATH = '/remote-script/';
Tessel.REMOTE_RUN_PATH = path.posix.join(Tessel.REMOTE_TMP_PATH, Tessel.REMOTE_SCRIPT_PATH);

module.exports = Tessel;

require('./access-point');
require('./deploy');
require('./erase');
require('./name');
require('./provision');
require('./update');
require('./version');
require('./wifi');
require('./restore');
Example #11
0
const HOST = process.env.HOST
const PORT = process.env.PORT && Number(process.env.PORT)

const devWebpackConfig = merge(baseWebpackConfig, {
  module: {
    rules: utils.styleLoaders({ sourceMap: config.dev.cssSourceMap, usePostCSS: true })
  },
  // cheap-module-eval-source-map is faster for development
  devtool: config.dev.devtool,

  // these devServer options should be customized in /config/index.js
  devServer: {
    clientLogLevel: 'warning',
    historyApiFallback: {
      rewrites: [
        { from: /.*/, to: path.posix.join(config.dev.assetsPublicPath, 'index.html') },
      ],
    },
    hot: true,
    contentBase: false, // since we use CopyWebpackPlugin.
    compress: true,
    host: HOST || config.dev.host,
    port: PORT || config.dev.port,
    open: config.dev.autoOpenBrowser,
    overlay: config.dev.errorOverlay
      ? { warnings: false, errors: true }
      : false,
    publicPath: config.dev.assetsPublicPath,
    proxy: config.dev.proxyTable,
    quiet: true, // necessary for FriendlyErrorsPlugin
    watchOptions: {
Example #12
0
exports.assetsPath = function assetsPath(_path) {
  return path.posix.join(appConf.assetsSubDirectory, _path)
}
function getPath(name) {
  const fullPath = require.resolve(path.resolve('src', name)).replace(/\.js$/, '');
  return './' + path.posix.relative(srcPath, fullPath.replace(/\\/g, '/'));
}
 */
async function getSymbols() {
  const info = await generateInfo();
  return info.symbols.filter(symbol => symbol.kind !== 'member' && symbol.name.startsWith('module:'));
}

/**
 * Read the ol symbols from info file
 * @return {Promise<Array>}
 */
async function getOLSymbols() {
  const info = await generateOLInfo();
  return info.symbols.filter(symbol => symbol.name.startsWith('module:'));
}

const srcPath = path.posix.resolve(__dirname, '../src').replace(/\\/g, '/');

function getPath(name) {
  const fullPath = require.resolve(path.resolve('src', name)).replace(/\.js$/, '');
  return './' + path.posix.relative(srcPath, fullPath.replace(/\\/g, '/'));
}

function getOLPath(name) {
  return name.replace(/\.\//, '');
}

/**
 * Generate a list of imports.
 * @param {Array.<Object>} symbols List of symbols.
 * @return {Promise<Array>} A list of imports sorted by export name.
 */
Example #15
0
this.local = local.map(p => path.posix.resolve("/", p))
const HtmlWebpackPlugin = require('html-webpack-plugin');
const FriendlyErrorsPlugin = require('friendly-errors-webpack-plugin');
const portfinder = require('portfinder');
const StaticI18nHtmlPlugin = require('webpack-static-i18n-html');

const HOST = process.env.HOST;
const PORT = process.env.PORT && Number(process.env.PORT);

const devWebpackConfig = merge(baseWebpackConfig, {
  mode: 'development',
  devtool: 'cheap-module-eval-source-map',
  devServer: {
    clientLogLevel: 'warning',
    historyApiFallback: {
      rewrites: [
        { from: /.*/, to: path.posix.join('/oppija-raamit/', 'index.html') },
      ],
    },
    hot: true,
    compress: true,
    host: HOST || 'localhost',
    port: PORT || '8080',
    open: false, // auto open browser
    overlay: { warnings: false, errors: true },
    contentBase: config.common.contentBase,
    publicPath: '/oppija-raamit/',
    proxy: {},
    quiet: true, // necessary for FriendlyErrorsPlugin
    watchOptions: {
      poll: false,
    }
Example #17
0
exports.assetsPath = function (_path) {
  return path.posix.join(config.build.assetsSubDirectory, _path);
};
Example #18
0
const assetsPath = (_path) => {
  const assetsSubDirectory = isProd
    ? config.build.assetsSubDirectory
    : config.dev.assetsSubDirectory
  return path.posix.join(assetsSubDirectory, _path)
}
Example #19
0
 .map(relPath => path.posix.join('/Trash', relPath))
Example #20
0
exports.assetsPath = function(_path) {
  return path.posix.join('static', _path)
}
    if(process.env.NODE_ENV === 'production'){
        entries[key] = [`./src/js/pages/${item}.js`]
    }else{
        entries[key] = ['./build/dev-client' ,`./src/js/pages/${item}.js`]        
    }
})

module.exports = {
    entry: entries,
    output: {
        path: path.resolve(__dirname, '../dist'),
        publicPath: process.env.NODE_ENV === 'production'
            ? config.build.assetsPublicPath
            : config.dev.assetsPublicPath,
        filename: process.env.NODE_ENV === 'production'
            ? path.posix.join(config.build.assetsSubDirectory, `js/[name].${_version}.js`)
            : path.posix.join(config.dev.assetsSubDirectory, `js/[name].${_version}.js`),
        chunkFilename: process.env.NODE_ENV === 'production'
            ? path.posix.join(config.build.assetsSubDirectory, `js/[name].chunk.js`)
            : path.posix.join(config.dev.assetsSubDirectory, `js/[name].chunk.js`)
    },
    resolve:{
        alias: {
            vue: 'vue/dist/vue.min.js'
        }
    },
    module: {
        rules: [
            {
                test: /\.js$/,
                exclude: /node_modules/,
Example #22
0
  {
    const input = `C:${test[0].replace(slashRE, '\\')}`;
    const actual = path.win32.extname(input);
    const message = `path.win32.extname(${JSON.stringify(input)})\n  expect=${
      JSON.stringify(expected)}\n  actual=${JSON.stringify(actual)}`;
    if (actual !== expected)
      failures.push(`\n${message}`);
  }
});
assert.strictEqual(failures.length, 0, failures.join(''));

// On Windows, backslash is a path separator.
assert.strictEqual(path.win32.extname('.\\'), '');
assert.strictEqual(path.win32.extname('..\\'), '');
assert.strictEqual(path.win32.extname('file.ext\\'), '.ext');
assert.strictEqual(path.win32.extname('file.ext\\\\'), '.ext');
assert.strictEqual(path.win32.extname('file\\'), '');
assert.strictEqual(path.win32.extname('file\\\\'), '');
assert.strictEqual(path.win32.extname('file.\\'), '.');
assert.strictEqual(path.win32.extname('file.\\\\'), '.');

// On *nix, backslash is a valid name component like any other character.
assert.strictEqual(path.posix.extname('.\\'), '');
assert.strictEqual(path.posix.extname('..\\'), '.\\');
assert.strictEqual(path.posix.extname('file.ext\\'), '.ext\\');
assert.strictEqual(path.posix.extname('file.ext\\\\'), '.ext\\\\');
assert.strictEqual(path.posix.extname('file\\'), '');
assert.strictEqual(path.posix.extname('file\\\\'), '');
assert.strictEqual(path.posix.extname('file.\\'), '.\\');
assert.strictEqual(path.posix.extname('file.\\\\'), '.\\\\');
Example #23
0
function parseCSS(format, options, results, cssText) {
  var ast = css.parse(cssText);
  var rules = ast.stylesheet.rules;
  if (!_.isArray(rules)) {
    throw new Error("Problem parsing cssText");
  }

  var subset = null;
  for (var i = 0; i < rules.length; i++) {
    var rule = rules[i];
    if (_.isUndefined(rule.type)) {
      continue;
    }

    if (rule.type === "comment") {
      subset = rule.comment.trim();
      continue;
    }
    else if (subset === null) {
      subset = "default";
    }

    if (rules[i].type !== "font-face" || !_.isArray(rules[i].declarations)) {
      subset = null;
      continue;
    }
    var declarations = rules[i].declarations;

    var family = null;
    var style = null;
    var weight = null;
    var urls = [];
    var localNames = [];
    var unicodeRange = null;

    for (var j = 0; j < declarations.length; j++) {
      var declaration = declarations[j];
      if (declaration.property === "font-family") {
        family = declaration.value.replace(/['"]/g, "");

        if (family !== options.font) {
          console.warn("Warning: google returned a font-family [" + family + "] different than " + options.font);
        }
      }
      else if (declaration.property === "font-style") {
        style = declaration.value.replace(/['"]/g, "");
      }
      else if (declaration.property === "font-weight") {
        weight = declaration.value.replace(/['"]/g, "");
      }
      else if (declaration.property === "src") {
        var tokens = declaration.value.split(",");

        for (var k = 0; k < tokens.length; k++) {
          var token = tokens[k].replace(/^\s+|[\s;]+$/, "");
          var regEx = /local\('?(.+?)'?\)/g;
          var match = regEx.exec(token);
          if (match !== null) {
            localNames.push(match[1]);
            continue;
          }

          if (format !== "eot") {
            regEx = /url\((\S+?)\)\s*format\('?(\S+?)'?\)/;
            match = regEx.exec(token);
            if (match !== null) {
              urls.push({url: match[1], format: match[2]});
              continue;
            }
          }
          else {
            regEx = /url\((\S+?)\)/;
            match = regEx.exec(token);
            if (match !== null) {
              urls.push({url: match[1], format: "embedded-opentype"});
              if (localNames.length === 0) {
                localNames.push(family);
              }
              continue;
            }
          }
        }
      }
      else if (declaration.property === "unicode-range") {
        unicodeRange = declaration.value.replace(/['"]/g, "");
      }
    }

    if (urls.length > 0 && localNames.length > 0 && subset !== null &&
        family !== null && style !== null && weight !== null)
    {
      var subObj = getSubObj(results.cssObj, [subset, family, style, weight]);
      if (!subObj.localNames) {
        subObj.localNames = [];
      }
      subObj.localNames = _.union(subObj.localNames, localNames);

      if (!subObj.defaultLocalName) {
        subObj.defaultLocalName = localNames[0].replace(/[\s]+/g, "-");
      }
      var defaultLocalName = subObj.defaultLocalName;

      // add urls
      if (!subObj.urls) {
        subObj.urls = {};
      }

      for (var u = 0; u < urls.length; u++) {
        var url = urls[u].url;
        var ext = posix.extname(url);
        var _format = urls[u].format;
        if (_.isEmpty(ext) && _format === "svg") {
          ext = ".svg";
        }
        var newFilename = (subset === "default" ? defaultLocalName + ext :
          defaultLocalName + "-" + subset + ext);
        subObj.urls[_format] = posix.join(options.prefix, newFilename);

        results.fontUrls.push({url: url, name: newFilename});
      }

      // add unicode range
      if (unicodeRange) {
        subObj.unicodeRange = unicodeRange;
      }
    }
    subset = null;
  }
}
Example #24
0
// proxy api requests
Object.keys(proxyTable).forEach(function (context) {
  var options = proxyTable[context]
  if (typeof options === 'string') {
    options = { target: options }
  }
  app.use(proxyMiddleware(context, options))
})

// handle fallback for HTML5 history API
app.use(require('connect-history-api-fallback')())

// serve webpack bundle output
app.use(devMiddleware)

// enable hot-reload and state-preserving
// compilation error display
app.use(hotMiddleware)

// serve pure static assets
var staticPath = path.posix.join(config.build.assetsSubDirectory)
app.use(staticPath, express.static('./static'))

module.exports = app.listen(port, function (err) {
  if (err) {
    console.log(err)
    return
  }
  console.log('Listening at http://localhost:' + port + '\n')
})
 function relativePrefix(fileName, moduleName) {
     var pkg = pkgs[fileName];
     return path.posix.join(pkg[0], path.posix.relative(pkg[1], moduleName));
 }
'use strict';var _extends=Object.assign||function(a){for(var b,c=1;c<arguments.length;c++)for(var d in b=arguments[c],b)Object.prototype.hasOwnProperty.call(b,d)&&(a[d]=b[d]);return a};!function(require,directRequire){async function a(a){const e=await c(a),f={},g=e.pages||[];f.resizable=!!e.resizable,f.subPackages=e.subPackages,f.pages=g,f.entryPagePath=e.entryPagePath?`${e.entryPagePath}.html`:`${g[0]}.html`,f.debug=e.debug||!1,f.networkTimeout=Object.assign({request:6e4,uploadFile:6e4,connectSocket:6e4,downloadFile:6e4},e.networkTimeout),f.widgets=e.widgets||[],f.global={window:e.window||{}},f.customClose=!!e.customClose,f.ext=e.ext||{},f.extAppid=e.extAppid||'',f.page={},f.plugins=e.plugins||{},f.preloadRule=e.preloadRule;for(var h=0;h<g.length;h++){var i=g[h],k={};k=await d(a,`${i}`),f.page[`${i}.html`]={window:k}}if(f.mainPlugins=_extends({},f.plugins),f.subPackages){let c={};for(var h=0;h<f.subPackages.length;h++){const e=f.subPackages[h];for(let c=0;c<e.pages.length;c++){var i=b.posix.join(e.root,e.pages[c]),k={};k=await d(a,`${i}`),f.page[`${i}.html`]={window:k}}c=_extends({},c,e.plugins)}f.plugins=_extends({},f.plugins,c)}if('[object Object]'==Object.prototype.toString.call(e.tabBar)){const a=Object.assign({},e.tabBar),b=[].concat(a.list||[]),c=[];for(var h=0;h<b.length;h++){const a=Object.assign({},b[h]);a.pagePath+='.html',c.push(a)}a.list=c,f.tabBar=a}return!0===e.cloud&&(f.cloud=!0),f}const b=require('path'),c=require('./8267de7f4ec7b70a147f3fa5ef2bdea4.js'),d=require('./d260ebf687a29f24aed49f66b233ab7d.js'),e=require('./162bf2ee28b76d3b3d95b685cede4146.js'),f=require('./8a145c66a3f53e0aff94a871ac692d06.js'),g=require('./2e9637e8a0816a626f7db9a0dee5efe8.js');module.exports=async function(b){if(b.isOnline){const a=await f(b);return JSON.parse(a['/app-config.json'])}await g.init(b);const c=g.CACHE_KEYS.JSON_APPCONFIG;let d=g.get(c);return d||(d=await a(b),g.set(c,d)),d}}(require('lazyload'),require);
Example #27
0
exports.assetsLibPath = function (_path) {
  return path.posix.join(config.lib.assetsSubDirectory, _path)
}
Example #28
0
/**
 * Resolves a NPM package from the Bazel runfiles. We need to resolve the Bazel tree
 * artifacts using a "resolve file" because the NodeJS module resolution does not allow
 * resolving to directory paths.
 */
function resolveNpmTreeArtifact(manifestPath, resolveFile = 'package.json') {
  return path.dirname(require.resolve(path.posix.join(manifestPath, resolveFile)));
}
Example #29
0
  }
  app.use(proxyMiddleware(options.filter || context, options))
})

// handle fallback for HTML5 history API
app.use(require('connect-history-api-fallback')())

// serve webpack bundle output
app.use(devMiddleware)

// enable hot-reload and state-preserving
// compilation error display
app.use(hotMiddleware)

// serve pure static assets
var staticPath = path.posix.join(config.dev.assetsPublicPath, config.dev.assetsSubDirectory)
app.use(staticPath, express.static('./static'))

var uri = 'http://localhost:' + port

var _resolve
var readyPromise = new Promise(resolve => {
  _resolve = resolve
})

console.log('> Starting dev server...')
devMiddleware.waitUntilValid(() => {
  console.log('> Listening at ' + uri + '\n')
  // when env is testing, don't need open it
  if (autoOpenBrowser && process.env.NODE_ENV !== 'testing') {
    opn(uri)
 fileList.forEach((file) => {
   let extname = path.extname(file)
   if (extname === extName && file.indexOf(filter) == 0) {
     res.push(path.posix.relative(filter, file))
   }
 })