Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export function preprocessSource({ filename, contents }, pluginOptions) {
// Don't need to account for ES6, Babylon can parse it.
if (CJSX.test(filename)) {
return compile(transform(contents), pluginOptions)
} else if (COFFEE.test(filename)) {
return compile(contents, pluginOptions)
} else return null
}
export function preprocessSource({ filename, contents }, pluginOptions) {
// Don't need to account for ES6, Babylon can parse it.
if (CJSX.test(filename)) {
return compile(transform(contents), pluginOptions)
} else if (COFFEE.test(filename)) {
return compile(contents, pluginOptions)
} else return null
}
require('coffeescript').register();
const _ = require('lodash');
const nodeUtil = require('util');
db = require('../../heap/back/db');
testUtil = require('../../heap/test/util');
const HEAP_ENV_ID = '2084764307';
const waitIfIos = async () => {
if (device.getPlatform() === 'ios') {
// :HACK: Break up long URL.
// :TODO: Remove once pixel endpoint is handling larger events again.
console.log('Waiting 15s to flush iOS events.');
await new Promise(resolve => setTimeout(resolve, 15000));
}
async transform({asset, options}) {
let sourceFileName: string = relativeUrl(
options.projectRoot,
asset.filePath,
);
asset.type = 'js';
let output = coffee.compile(await asset.getCode(), {
filename: sourceFileName,
sourceMap: options.sourceMaps,
});
// return from compile is based on sourceMaps option
if (options.sourceMaps) {
asset.setCode(output.js);
asset.setMap(await SourceMap.fromRawSourceMap(output.v3SourceMap));
} else {
asset.setCode(output);
}
return [asset];
},
});
return uncompiled => {
const comp = require('coffeescript');
const compiled = comp.compile('0 || (' + uncompiled + ')');
// Strip out coffeescript scoping wrapper to get translated condition
const re = /\(function\(\) {\s*0 \|\| \((.*)\);\n\n\}\)\.call\(this\);/;
const match = re.exec(compiled);
if (match && match.length > 1) {
return match[1].trim();
} else {
throw new Error('Compilation Error for: ' + uncompiled);
}
};
case 'es6':
require('coffeescript').register();
testUtil = require('../../heap/test/util');
rnTestUtil = require('./rnTestUtilities');
// This file is named funkily so that Mocha runs this first. That way we
// don't lose the initial navigation event (each test flushes redis).
describe('Initial Navigation', () => {
before(async () => {
await device.launchApp();
await expect(element(by.id('initialSentinel'))).toBeVisible();
await element(by.id('initialSentinel')).tap();
await rnTestUtil.pollForSentinel('Initial');
});
require('coffeescript').register();
_ = require('lodash');
assert = require('should/as-function');
nodeUtil = require('util');
testUtil = require('../../heap/test/util');
rnTestUtil = require('./rnTestUtilities');
packageJson = require('../package.json');
const BASICS_PAGE_TOP_HIERARCHY =
'@AppContainer;|@App;|@Provider;|@withReactNavigationAutotrack(NavigationContainer);|@NavigationContainer;|@Navigator;|@NavigationView;|@TabNavigationView;|@ScreenContainer;|@ResourceSavingScene;[key=Basics];|@SceneView;|@Connect(BasicsPage);|@BasicsPage;|@ScrollView;[testID=scrollContainer];|';
const SDK_VERSION = packageJson.version;
assert.exist(SDK_VERSION);
const doTestActions = async () => {
// Open the Basics tab in the tab navigator.
require('coffeescript').register();
_ = require('lodash');
assert = require('should/as-function');
testUtil = require('../../heap/test/util');
rnTestUtil = require('./rnTestUtilities');
const delay = async () => {
await new Promise(resolve => setTimeout(resolve, 500));
};
const doTestActions = async () => {
// Open the PropExtraction tab in the tab navigator.
await element(by.id('Nav')).tap();
await expect(element(by.id('navigate_stack'))).toBeVisible();
await element(by.id('navigate_stack')).tap();
require('coffeescript').register();
_ = require('lodash');
assert = require('should/as-function');
testUtil = require('../../heap/test/util');
rnTestUtil = require('./rnTestUtilities');
const IOS_BUTTON_SUFFIX = 'TouchableOpacity;';
const ANDROID_BUTTON_SUFFIX = 'TouchableNativeFeedback;';
const PROPEXTRACTION_PAGE_TOP_HIERARCHY =
'AppContainer;|App;|Provider;|withReactNavigationAutotrack(NavigationContainer);|NavigationContainer;|Navigator;|NavigationView;|TabNavigationView;|ScreenContainer;|ResourceSavingScene;[key=PropExtraction];|SceneView;|PropExtraction;|';
const doTestActions = async () => {
// Open the PropExtraction tab in the tab navigator.
await element(by.id('PropExtraction')).tap();
const _ = require('lodash')
let COFFEE_SCRIPT_AVAILABLE = false
let LIVE_SCRIPT_AVAILABLE = false
let TYPE_SCRIPT_AVAILABLE = false
// Coffee is required here to enable config files written in coffee-script.
// It's not directly used in this file.
try {
require('coffee-script').register()
COFFEE_SCRIPT_AVAILABLE = true
} catch (e) {}
// CoffeeScript lost the hyphen in the module name a long time ago, all new version are named this:
try {
require('coffeescript').register()
COFFEE_SCRIPT_AVAILABLE = true
} catch (e) {}
// LiveScript is required here to enable config files written in LiveScript.
// It's not directly used in this file.
try {
require('LiveScript')
LIVE_SCRIPT_AVAILABLE = true
} catch (e) {}
try {
require('ts-node').register()
TYPE_SCRIPT_AVAILABLE = true
} catch (e) {}
class Pattern {