How to use the unionfs.ufs function in unionfs

To help you get started, we’ve selected a few unionfs examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github saltyshiomix / react-ssr / packages / nestjs-express / lib / optimize.ts View on Github external
configureWebpack,
  getEngine,
  getPages,
  getPageId,
  readFileWithProps,
  gracefullyShutDown,
  sleep,
  Config,
} from '@react-ssr/core';

const cwd = process.cwd();
const env = process.env.NODE_ENV === 'production' ? 'production' : 'development';
const ext = '.' + getEngine();
const codec = require('json-url')('lzw');

const ufs = require('unionfs').ufs;
const memfs = new MemoryFileSystem();
ufs.use(fs).use(memfs);

// onchange bundling
async function bundle(config: Config, ufs: any, memfs: any): Promise;

// initial bundling
async function bundle(config: Config, ufs: any, memfs: any, app: NestExpressApplication): Promise;

async function bundle(config: Config, ufs: any, memfs: any, app?: NestExpressApplication) {
  const entry: webpack.Entry = {};
  const entryPages = await getPages();
  const entryPath = path.resolve(require.resolve('@react-ssr/core'), '../webpack/entry.js');
  const template = fse.readFileSync(entryPath).toString();

  memfs.mkdirpSync(path.join(cwd, 'react-ssr-src'));
github saltyshiomix / react-ssr / packages / nestjs-express / lib / optimize.ts View on Github external
Config,
  configure,
  getEngine,
  getPages,
  getPageId,
  readFileWithProps,
  // gracefullyShutDown,
  sleep,
} from '@react-ssr/core';

const cwd = process.cwd();
const env = process.env.NODE_ENV === 'production' ? 'production' : 'development';
const ext = '.' + getEngine();
const codec = require('json-url')('lzw');

const ufs = require('unionfs').ufs;
const memfs = new MemoryFileSystem();
ufs.use(fs).use(memfs);

// onchange bundling
async function bundle(config: Config, ufs: any, memfs: any): Promise;

// initial bundling
async function bundle(config: Config, ufs: any, memfs: any, app: NestExpressApplication): Promise;

async function bundle(config: Config, ufs: any, memfs: any, app?: NestExpressApplication) {
  const entry: webpack.Entry = {};
  const [entryPages, otherPages] = await getPages(config);
  const entryPath = path.resolve(require.resolve('@react-ssr/core'), '../webpack/entry.js');
  const template = fse.readFileSync(entryPath).toString();

  for (let i = 0; i < entryPages.length; i++) {
github saltyshiomix / react-ssr / packages / core / src / optimize / production.ts View on Github external
import MemoryFileSystem from 'memory-fs';
import path from 'path';
import express from 'express';
import webpack from 'webpack';
import { configureWebpack } from './webpack.config';
import { getEntry } from './helpers';
import {
  getSsrConfig,
  getPageId,
  sleep,
} from '../helpers';

const cwd = process.cwd();
const config = getSsrConfig();

const ufs = require('unionfs').ufs;
const memfs = new MemoryFileSystem();
ufs.use(fs).use(memfs);

export default async (app: express.Application): Promise => {
  fse.removeSync(path.join(cwd, config.distDir));

  let compiled = false;
  const [entry, entryPages] = await getEntry(memfs);
  const webpackConfig: webpack.Configuration = configureWebpack(entry);
  const compiler: webpack.Compiler = webpack(webpackConfig);
  compiler.hooks.afterCompile.tap('finish', () => { compiled = true });
  compiler.inputFileSystem = ufs;
  compiler.run((err: Error, stats: webpack.Stats) => {
    err && console.error(err.stack || err);
    stats.hasErrors() && console.error(stats.toString());
github saltyshiomix / react-ssr / packages / static / src / optimize / production.ts View on Github external
import fse from 'fs-extra';
import MemoryFileSystem from 'memory-fs';
import path from 'path';
import express from 'express';
import webpack from 'webpack';
import { configureWebpack } from './webpack.config';
import { getEntry } from './helpers';
import {
  getPageId,
  staticConfig,
  sleep,
} from '../helpers';

const cwd = process.cwd();

const ufs = require('unionfs').ufs;
const memfs = new MemoryFileSystem();
ufs.use(fs).use(memfs);

export default async (app: express.Application): Promise => {
  fse.removeSync(path.join(cwd, staticConfig.distDir));

  let compiled = false;
  const [entry, entryPages] = await getEntry(memfs);
  const webpackConfig: webpack.Configuration = configureWebpack(entry);
  const compiler: webpack.Compiler = webpack(webpackConfig);
  compiler.hooks.afterCompile.tap('finish', () => { compiled = true });
  compiler.inputFileSystem = ufs;
  compiler.run((err: Error, stats: webpack.Stats) => {
    err && console.error(err.stack || err);
    stats.hasErrors() && console.error(stats.toString());
github saltyshiomix / react-ssr / packages / static / src / optimize / development.ts View on Github external
import path from 'path';
import express from 'express';
import proxy from 'http-proxy-middleware';
import webpack from 'webpack';
import WebpackDevServer from 'webpack-dev-server';
import { configureWebpack } from './webpack.config';
import { getEntry } from './helpers';
import {
  getPageId,
  staticConfig,
  sleep,
} from '../helpers';

const cwd = process.cwd();

const ufs = require('unionfs').ufs;
const memfs = new MemoryFileSystem();
ufs.use(fs).use(memfs);

export default async (app: express.Application): Promise => {
  fse.removeSync(path.join(cwd, staticConfig.distDir));

  let compiled = false;
  const [entry, entryPages] = await getEntry(memfs);
  const webpackConfig: webpack.Configuration = configureWebpack(entry);
  const compiler: webpack.Compiler = webpack(webpackConfig);
  compiler.hooks.afterCompile.tap('finish', () => { compiled = true });
  compiler.inputFileSystem = ufs;

  const devServerPort = 8888;
  const devServer = new WebpackDevServer(compiler, {
    hot: true,
github saltyshiomix / react-ssr / packages / core / src / optimize / development.ts View on Github external
import express from 'express';
import proxy from 'http-proxy-middleware';
import webpack from 'webpack';
import WebpackDevServer from 'webpack-dev-server';
import { configureWebpack } from './webpack.config';
import { getEntry } from './helpers';
import {
  getSsrConfig,
  getPageId,
  sleep,
} from '../helpers';

const cwd = process.cwd();
const config = getSsrConfig();

const ufs = require('unionfs').ufs;
const memfs = new MemoryFileSystem();
ufs.use(fs).use(memfs);

export default async (app: express.Application): Promise => {
  fse.removeSync(path.join(cwd, config.distDir));

  let compiled = false;
  const [entry, entryPages] = await getEntry(memfs);
  const webpackConfig: webpack.Configuration = configureWebpack(entry);
  const compiler: webpack.Compiler = webpack(webpackConfig);
  compiler.hooks.afterCompile.tap('finish', () => { compiled = true });
  compiler.inputFileSystem = ufs;

  const devServerPort = 8888;
  const devServer = new WebpackDevServer(compiler, {
    hot: true,
github saltyshiomix / react-ssr / packages / core / src / optimize / development.ts View on Github external
import webpack from 'webpack';
import WebpackDevServer from 'webpack-dev-server';
import { configureWebpack } from '../webpack.config';
import { getEntry } from './helpers';
import {
  getSsrConfig,
  getPageId,
  readFileWithProps,
  sleep,
} from '../helpers/core';

const cwd = process.cwd();
const config = getSsrConfig();
const codec = require('json-url')('lzw');

const ufs = require('unionfs').ufs;
const memfs = new MemoryFileSystem();
ufs.use(fs).use(memfs);

export default async (app: express.Application): Promise => {
  fse.removeSync(path.join(cwd, config.distDir));

  let compiled = false;
  const [entry, entryPages] = await getEntry(memfs);
  const webpackConfig: webpack.Configuration = configureWebpack(entry);
  const compiler: webpack.Compiler = webpack(webpackConfig);
  compiler.hooks.afterCompile.tap('finish', () => { compiled = true });
  compiler.inputFileSystem = ufs;

  const devServerPort = 8888;
  const devServer = new WebpackDevServer(compiler, {
    hot: true,

unionfs

Use multiple `fs` modules in a union.

Unlicense
Latest version published 8 months ago

Package Health Score

76 / 100
Full package analysis

Popular unionfs functions