Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const publicPath = paths.servedPath;
// Some apps do not use client-side routing with pushState.
// For these, "homepage" can be set to "." to enable relative asset paths.
const shouldUseRelativeAssetPaths = publicPath === "./";
// Source maps are resource heavy and can cause out of memory issue for large source files.
const shouldUseSourceMap = process.env.GENERATE_SOURCEMAP !== "false";
// `publicUrl` is just like `publicPath`, but we will provide it to our app
// as %PUBLIC_URL% in `index.html` and `process.env.PUBLIC_URL` in JavaScript.
// Omit trailing slash as %PUBLIC_URL%/xyz looks better than %PUBLIC_URL%xyz.
const publicUrl = publicPath.slice(0, -1);
// Get environment variables to inject into our app.
const env = getClientEnvironment(publicUrl);
// Assert this just to be safe.
// Development builds of React are slow and not intended for production.
if (env.stringified["process.env"].NODE_ENV !== '"production"') {
throw new Error("Production builds must have NODE_ENV=production.");
}
// Note: defined here because it will be used more than once.
const cssFilename = "static/css/[name].[contenthash:8].css";
// ExtractTextPlugin expects the build output to be flat.
// (See https://github.com/webpack-contrib/extract-text-webpack-plugin/issues/27)
// However, our output is structured with css, js and media folders.
// To have this structure working with relative paths, we have to use custom options.
const extractTextPluginOptions = shouldUseRelativeAssetPaths
? // Making sure that the publicPath goes back to to build folder.
{ publicPath: Array(cssFilename.split("/").length).join("../") }
: {};
// This is the production configuration.
const publicPath = paths.servedPath;
// Some apps do not use client-side routing with pushState.
// For these, "homepage" can be set to "." to enable relative asset paths.
const shouldUseRelativeAssetPaths = publicPath === './';
// Source maps are resource heavy and can cause out of memory issue for large source files.
const shouldUseSourceMap = process.env.GENERATE_SOURCEMAP !== 'false';
// `publicUrl` is just like `publicPath`, but we will provide it to our app
// as %PUBLIC_URL% in `index.html` and `process.env.PUBLIC_URL` in JavaScript.
// Omit trailing slash as %PUBLIC_URL%/xyz looks better than %PUBLIC_URL%xyz.
const publicUrl = publicPath.slice(0, -1);
// Get environment variables to inject into our app.
const env = getClientEnvironment(publicUrl);
// Assert this just to be safe.
// Development builds of React are slow and not intended for production.
if (env.stringified['process.env'].NODE_ENV !== '"production"') {
throw new Error('Production builds must have NODE_ENV=production.');
}
// Note: defined here because it will be used more than once.
const cssFilename = 'static/css/[name].[contenthash:8].css';
// ExtractTextPlugin expects the build output to be flat.
// (See https://github.com/webpack-contrib/extract-text-webpack-plugin/issues/27)
// However, our output is structured with css, js and media folders.
// To have this structure working with relative paths, we have to use custom options.
const extractTextPluginOptions = shouldUseRelativeAssetPaths
? // Making sure that the publicPath goes back to to build folder.
{ publicPath: Array(cssFilename.split('/').length).join('../') }
: {};
// This is the production configuration.
// Webpack uses `publicPath` to determine where the app is being served from.
// It requires a trailing slash, or the file assets will get an incorrect path.
const publicPath = paths.servedPath;
// Some apps do not use client-side routing with pushState.
// For these, "homepage" can be set to "." to enable relative asset paths.
const shouldUseRelativeAssetPaths = publicPath === './';
// `publicUrl` is just like `publicPath`, but we will provide it to our app
// as %PUBLIC_URL% in `index.html` and `process.env.PUBLIC_URL` in JavaScript.
// Omit trailing slash as %PUBLIC_URL%/xyz looks better than %PUBLIC_URL%xyz.
const publicUrl = publicPath.slice(0, -1);
// Get environment variables to inject into our app.
const env = getClientEnvironment(publicUrl);
// Assert this just to be safe.
// Development builds of React are slow and not intended for production.
if (env.stringified['process.env'].NODE_ENV !== '"production"') {
throw new Error('Production builds must have NODE_ENV=production.');
}
// Note: defined here because it will be used more than once.
const cssFilename = 'static/css/[name].[contenthash:8].css';
// ExtractTextPlugin expects the build output to be flat.
// (See https://github.com/webpack-contrib/extract-text-webpack-plugin/issues/27)
// However, our output is structured with css, js and media folders.
// To have this structure working with relative paths, we have to use custom options.
function getExtractTextPluginOptions() {
const options = {
fallback: 'style-loader',
use: [
{
loader: 'css-loader',
bodyParser = require("body-parser"),
methodOverride = require("method-override"),
cookieParser = require("cookie-parser"),
cookieSession = require("cookie-session");
//App modules
var dataSource = require("./modules/dataSource"),
dataDescription = require("./modules/dataDescription"),
interactiveFilters = require("./modules/interactiveFilters"),
visualization = require("./modules/visualization");
var app = express();
// all environments
app.set("port", process.env.PORT || 3001);
app.set("views", path.join(__dirname, "views"));
app.set("view engine", "jade");
//app.use(favicon());
app.use(morgan("dev"));
// parse application/x-www-form-urlencoded
app.use(bodyParser.urlencoded({ extended: false }))
// parse application/json
app.use(bodyParser.json())
app.use(methodOverride());
app.use(compress);
app.use(cookieParser("S3CRE7"));
app.use(cookieSession({
name: 'session',
keys: ['key1', 'key2']
/* eslint-disable callback-return */
const process = require("process");
global.logger = new (require("./Logger"))(`Shard ${Number(process.env.SHARDS)} Worker`);
require("../Modules/Utils/ObjectDefines")();
const { WorkerCommands: { MATHJS: MathJSCommands } } = require("./Constants");
const configJS = require("../Configurations/config.js");
const auth = require("../Configurations/auth.js");
const Emoji = require("../Modules/Emoji/Emoji");
const ExtensionManager = require("./Extensions");
const mathjs = require("mathjs");
const safeEval = mathjs.eval;
mathjs.import({
import: () => { throw new Error(`Function "import" is disabled inside calculations!`); },
createUnit: () => { throw new Error(`Function "createUnit" is disabled inside calculations!`); },
eval: () => { throw new Error(`Function "eval" is disabled inside calculations!`); },
'postcss-simple-vars': {},
'postcss-calc': {},
'postcss-nested': {},
'postcss-media-minmax': {},
'postcss-custom-media': {},
'postcss-pxtorem': {
rootValue: 10,
unitPrecision: 5,
propList: ['*'],
selectorBlackList: [/^html$/],
mediaQuery: false,
minPixelValue: 0,
},
'postcss-inline-svg': {
// for correct paths during component-only css creation
path: process.env.NODE_ENV === 'css' ? './src/components/button/styles/' : '',
},
...(process.env.NODE_ENV === 'css' ? {
'postcss-modules': {
getJSON: () => { },
generateScopedName: '[local]',
},
} : {}),
autoprefixer: {},
cssnano: {
discardUnused: { fontFace: false },
},
},
};
get(
workspaceCache: { [key: string]: ServiceDefinition },
serviceName: string
) {
const find = require('find');
const fs = require('fs');
const process = require('process');
if (typeof window !== 'undefined') {
throw new Error(
'`oasis.workspace` is not (yet) available in the browser'
);
}
if (!_populatedWorkspace) {
let projectRoot = process.env.OASIS_WORKSPACE;
if (projectRoot === undefined) {
const path = require('path');
projectRoot = process.cwd();
while (!fs.existsSync(path.join(projectRoot, '.git'))) {
const parentDir = path.dirname(projectRoot);
if (parentDir === projectRoot) {
projectRoot = undefined;
}
projectRoot = parentDir;
}
}
if (projectRoot === undefined) {
throw new Error(
'Could not find workspace root. Perhaps set the `OASIS_WORKSPACE` env var?'
#!/usr/bin/env node
'use strict';
const http = require('http');
const process = require('process');
const child = require('child_process');
let couchurl = process.env.COUCHDB_URL ? process.env.COUCHDB_URL : 'http://localhost:5984';
if (typeof couchurl === undefined || couchurl === null) {
couchurl = 'http://localhost:5984';
}
const testCouchServer = function(url) {
return new Promise((resolve, reject) => {
let request = http.get(url, (response) => {
let dataChunk = '';
if (response.statusCode !== 200) {
reject(new Error('Access to chouchDB failed.'));
}
response.on('data', (data) => { dataChunk += data; });
response.on('end', () => {
resolve(JSON.parse(dataChunk));
let env = require('process').env;
let axios = require('axios');
let AWS = require('aws-sdk');
let urlParse = require('url').URL;
let appsyncUrl = process.env.ENDPOINT;
let tmdbApiKey = process.env.TMDBKEY;
let url = 'https://api.themoviedb.org/3/movie/popular?api_key='+tmdbApiKey+'&language=en-US&page=';
let response;
let endpoint = (new urlParse(appsyncUrl)).hostname.toString();
let getMovies = `query GetMovies{
getMovies(id: 0) {
id
name
poster
date
plot
constructor(Config) {
this.config = Config.get('jsonApi');
this.JsonApiSerializer = new Serializer(this.config.globalOptions);
this.includeStackTrace = process.env.NODE_ENV !== 'production';
this.JSE = JsonApiSpecificationException;
this.JsonApiException = JsonApiException;
this.jsonApiErrors = [];
}