How to use systemjs - 10 common examples

To help you get started, we’ve selected a few systemjs 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 cliqz-oss / browser-core / tests / runners / unit-node.js View on Github external
function describeModule(moduleName, loadDeps, testFn) {
  const localSystem = new systemjs.constructor();
  localSystem.config({
    defaultJSExtensions: true,
    baseURL,
    meta: {
      '*': { format: cliqzConfig.format === 'common' ? 'cjs' : 'register' },
    },
  });

  // list names of all loaded modules so we can unload them after each test
  // check `unloadModules`
  const systemSet = localSystem.set;
  const systemImport = localSystem.import;

  let modules = {};

  localSystem.set = function (name) {
github cliqz-oss / browser-core / tests / runners / unit-node.js View on Github external
function describeModule(moduleName, loadDeps, testFn) {
  const localSystem = new systemjs.constructor();
  localSystem.config({
    defaultJSExtensions: true,
    baseURL,
    meta: {
      '*': { format: cliqzConfig.format === 'common' ? 'cjs' : 'register' },
    },
  });

  // list names of all loaded modules so we can unload them after each test
  // check `unloadModules`
  const systemSet = localSystem.set;
  const systemImport = localSystem.import;

  let modules = {};

  localSystem.set = function (name) {
github ListnPlay / riot-isomorphic / app.js View on Github external
// SYSTEM JS
var System = require('systemjs');
require('./build/server/environment');
require('./build/config');

System.import('server/index');
github Jense5 / consultant-cli / src / core / template.js View on Github external
// @flow

import klaw from 'klaw';
import path from 'path';
import chalk from 'chalk';
import rfse from 'fs-extra';
import winston from 'winston';
import Promise from 'bluebird';
import Mustache from 'mustache';
import inquirer from 'inquirer';
import SystemJS from 'systemjs';

import utils from '../utils/utils';

const fse = Promise.promisifyAll(rfse);
SystemJS.config({
  transpiler: 'plugin-babel',
  map: {
    'plugin-babel': path.resolve(__dirname, '../../node_modules/systemjs-plugin-babel/plugin-babel.js'),
    'systemjs-babel-build': path.resolve(__dirname, '../../node_modules/systemjs-plugin-babel/systemjs-babel-browser.js'),
  },
});

/**
 * This class represents a template, which will be able to render to some output location.
 * All the data and render processes are stored in this instance.
 */
class Template {

  filters: Map boolean>;
  source: string;
  start: string;
github FE-Kits / fe-boilerplates / micro-frontend / react-ts-webpack / packages / rtw-bootstrap / src / launcher / resolvers / ModuleResolver.ts View on Github external
constructor(option: IInitOption) {
    // ζ³¨ε†Œζ‰€ζœ‰ηš„ Vendors
    if (option.vendors) {
      option.vendors.forEach(vendor => {
        this.registerSystemMap(vendor);
      });
    }

    // ζ³¨ε†Œζ‰€ζœ‰ηš„εΊ”η”¨
    option.apps.forEach(app => {
      this.registerSystemMap(app);
    });

    // Init systemJS
    SystemJS.config(this.systemConfig);

    // Mount CSS
    this.css.forEach(cssHref => {
      loadCSS(cssHref);
    });

    this.apps = option.apps;
    this.isRegistered = true;

    return this;
  }
github FE-Kits / m-fe-rtw / packages / rtw-bootstrap / src / launcher / resolvers / ModuleResolver.ts View on Github external
constructor(option: IInitOption) {
    // ζ³¨ε†Œζ‰€ζœ‰ηš„ Vendors
    if (option.vendors) {
      option.vendors.forEach(vendor => {
        this.registerSystemMap(vendor);
      });
    }

    // ζ³¨ε†Œζ‰€ζœ‰ηš„εΊ”η”¨
    option.apps.forEach(app => {
      this.registerSystemMap(app);
    });

    // Init systemJS
    SystemJS.config(this.systemConfig);

    // Mount CSS
    this.css.forEach(cssHref => {
      loadCSS(cssHref);
    });

    this.apps = option.apps;
    this.isRegistered = true;

    return this;
  }
github plnkr / runtime / src / index.ts View on Github external
const cssLoader = createCssLoader({
            runtime: this,
        });

        this.defaultDependencies = defaultDependencies;
        // this.defaultExtensions = defaultExtensions;
        this.esmLoader = createEsmCdnLoader({ cssLoader });
        this.localLoader = createLocalLoader({
            cssLoader,
            defaultExtensions,
            runtimeHost,
        });
        this.systemLoader = createSystemLoader();
        this.queue = Promise.resolve();
        // this.runtimeHost = runtimeHost;
        this.system = new SystemJS.constructor();
        // Hack to force system to never use node's require
        this.system._nodeRequire = null;
        this.localRoot = this.system.baseURL.replace(
            /^([a-zA-Z]+:\/\/)([^/]*)\/.*$/,
            '$1$2'
        );
        this.transpiler =
            transpiler === false
                ? null
                : transpiler ||
                  createTranspiler({
                      createRuntime,
                      runtime: this,
                      runtimeHost,
                      typescriptVersion: TYPESCRIPT_VERSION,
                  });
github grafana / grafana / public / app / features / plugins / plugin_loader.ts View on Github external
import impressionSrv from 'app/core/services/impression_srv';
import builtInPlugins from './built_in_plugins';
import * as d3 from 'd3';
import * as grafanaUI from '@grafana/ui';

// rxjs
import { Observable, Subject } from 'rxjs';

// add cache busting
const bust = `?_cache=${Date.now()}`;
function locate(load) {
  return load.address + bust;
}
System.registry.set('plugin-loader', System.newModule({ locate: locate }));

System.config({
  baseURL: 'public',
  defaultExtension: 'js',
  packages: {
    plugins: {
      defaultExtension: 'js',
    },
  },
  map: {
    text: 'vendor/plugin-text/text.js',
    css: 'vendor/plugin-css/css.js',
  },
  meta: {
    '/*': {
      esModule: true,
      authorization: true,
      loader: 'plugin-loader',
github kumaravel29 / grafana-sankey-panel / dist / plugin_loader.ts View on Github external
import * as ticks from 'app/core/utils/ticks';
import {impressions} from 'app/features/dashboard/impression_store';
import builtInPlugins from './built_in_plugins';
import d3 from 'vendor/d3/d3';

// rxjs
import {Observable} from 'rxjs/Observable';
import {Subject} from 'rxjs/Subject';

// these imports add functions to Observable
import 'rxjs/add/observable/empty';
import 'rxjs/add/observable/from';
import 'rxjs/add/operator/map';
import 'rxjs/add/operator/combineAll';

System.config({
  baseURL: 'public',
  defaultExtension: 'js',
  packages: {
    'plugins': {
      defaultExtension: 'js'
    }
  },
  map: {
    text: 'vendor/plugin-text/text.js',
    css: 'vendor/plugin-css/css.js'
  },
  meta: {
    '*': {
      esModule: true,
      authorization: true,
    }
github kumaravel29 / grafana-sankey-panel / dist / plugin_loader.ts View on Github external
map: {
    text: 'vendor/plugin-text/text.js',
    css: 'vendor/plugin-css/css.js'
  },
  meta: {
    '*': {
      esModule: true,
      authorization: true,
    }
  }
});

// add cache busting
var systemLocate = System.locate;
System.cacheBust = '?bust=' + Date.now();
System.locate = function(load) {
  var System = this;
  return Promise.resolve(systemLocate.call(this, load)).then(function(address) {
    return address + System.cacheBust;
  });
};

function exposeToPlugin(name: string, component: any) {
  System.registerDynamic(name, [], true, function(require, exports, module) {
    module.exports = component;
  });
}

exposeToPlugin('lodash', _);
exposeToPlugin('moment', moment);
exposeToPlugin('jquery', jquery);
exposeToPlugin('angular', angular);