@locker/compiler
Advanced tools
Comparing version 0.12.2 to 0.12.3
{ | ||
"name": "@locker/compiler", | ||
"version": "0.12.2", | ||
"version": "0.12.3", | ||
"license": "Salesforce Developer Agreement", | ||
@@ -10,7 +10,8 @@ "author": "Salesforce UI Security Team", | ||
"scripts": { | ||
"build": "rollup -c .rolluprc.cjs", | ||
"build": "rollup --config .rolluprc.cjs", | ||
"clean": "locker-trash dist/", | ||
"test:dev": "cross-env NODE_ENV=development yarn test", | ||
"test:update": "yarn test:dev --updateSnapshot && yarn test --updateSnapshot", | ||
"test": "yarn build && jest" | ||
"test:base": "yarn build && jest", | ||
"test:dev": "cross-env NODE_ENV=development yarn test:base", | ||
"test:update": "yarn test:dev --updateSnapshot && yarn test:base --updateSnapshot", | ||
"test": "yarn test:dev && yarn test:base" | ||
}, | ||
@@ -24,4 +25,4 @@ "files": [ | ||
"dependencies": { | ||
"@locker/ast-lib-maker": "0.12.2", | ||
"@locker/shared": "0.12.2", | ||
"@locker/ast-lib-maker": "0.12.3", | ||
"@locker/shared": "0.12.3", | ||
"acorn": "8.0.4", | ||
@@ -36,3 +37,3 @@ "acorn-walk": "8.0.0", | ||
}, | ||
"gitHead": "738fe1b33d349d389394370359044c1d5ee968c4" | ||
"gitHead": "04a89b8ef9516c8ebc5f38a1bb2d93b04deba348" | ||
} |
@@ -13,12 +13,12 @@ # @locker/compiler | ||
Compile code using `Compiler.compile(options)`. | ||
<!-- eslint-disable import/no-extraneous-dependencies, no-undef --> | ||
The `Compiler` object: | ||
<!-- eslint-disable import/no-extraneous-dependencies, no-console, no-undef --> | ||
```js | ||
const { Compiler } = require('@locker/compiler'); | ||
Compiler.compile(source, { | ||
// Compile code using `Compiler.compile(input, options)`. The function returns | ||
// an object of `{ code, map, meta }`. | ||
Compiler.compile(input, { | ||
// The absolute filename of `source` used to generate source maps. | ||
filename: undefined, | ||
// The name of the sandbox namespace. See | ||
namespaceName: 'namespace', | ||
// Specify the newline character(s) to use in compiled output, i.e. either | ||
@@ -37,9 +37,68 @@ // '\n' or '\r\n'. The default value 'auto' will automatically detect the | ||
quoteChar: 'auto', | ||
// The key of the sandbox to evaluate source text in. | ||
// For more details see https://www.npmjs.com/package/@locker/sandbox#usage. | ||
sandboxKey: 'sandbox', | ||
// Specify source map support as either `true`, `false`, or 'hidden'. | ||
// - By default two inline source maps are generated. | ||
// One for sandboxed code and one lazily for the entire module. | ||
// - By default two inline source maps are generated: | ||
// one for sandboxed code and one for the entire module. | ||
// - Use `false` to disable all source map generation. | ||
// - Use 'hidden' to skip generating the sandboxed code source map. | ||
sourceMap: true, | ||
// | ||
// *** ADVANCED *** | ||
// Sandbox package specific options you'll likely not need to touch. | ||
sandboxEvalContext: '$lockerEvalContext$', | ||
sandboxPackage: '@locker/sandbox', | ||
sandboxSpecifier: 'evaluateInSandbox', | ||
}); | ||
// Create a new normalized fully populated `Compiler.compile()` options object | ||
// using `Compiler.createOptions(providedOptions)`. | ||
Compiler.createOptions({ | ||
sandboxKey: 'anotherKey', | ||
}); | ||
// Inspect the default options of `Compiler.compile()` using `Compiler.defaultOptions`. | ||
console.log(Compiler.defaultOptions); | ||
``` | ||
The `Parser` object: | ||
<!-- eslint-disable import/no-extraneous-dependencies, no-console, no-undef, no-unused-vars --> | ||
```js | ||
const { Parser } = require('@locker/compiler'); | ||
// Create a `Parser` instance using `Parse.create(input, options)`. | ||
const parser = Parse.create(input, { | ||
// Produce an abstract syntax tree (AST) for use with the custom parser API | ||
// of Prettier. For more details see https://prettier.io/docs/en/api.html#custom-parser-api. | ||
prettier: false, | ||
// Track the string representation of primitive values. | ||
raws: false, | ||
// The start position of the tokenizer in `input`. | ||
startPos: 0, | ||
// For details on the following options and more see | ||
// https://github.com/acornjs/acorn/tree/master/acorn#interface. | ||
allowAwaitOutsideFunction: true, | ||
allowHashBang: true, | ||
allowReserved: true, | ||
allowReturnOutsideFunction: true, | ||
ecmaVersion: 'latest', | ||
sourceType: 'module', | ||
}); | ||
// The `parser.parse()` method returns the generated AST object. | ||
parser.parse(); | ||
// Create an AST object representation of parsed `input` without an intermediate | ||
// `parser` instance using `Parser.parse(input, options)`. | ||
const ast = Parser.parse(input, options); | ||
// Create a new normalized fully populated `Parser.parse()` options object | ||
// using `Parser.createOptions(providedOptions)`. | ||
Parser.createOptions({ | ||
prettier: true, | ||
}); | ||
// Inspect the default options of `Parser.create()` using `Parser.defaultOptions`. | ||
console.log(Parser.defaultOptions); | ||
``` |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
191180
4675
103
0
3
+ Added@locker/ast-lib-maker@0.12.3(transitive)
+ Added@locker/shared@0.12.3(transitive)
- Removed@locker/ast-lib-maker@0.12.2(transitive)
- Removed@locker/shared@0.12.2(transitive)
Updated@locker/ast-lib-maker@0.12.3
Updated@locker/shared@0.12.3