Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

atbuild

Package Overview
Dependencies
Maintainers
1
Versions
42
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

atbuild - npm Package Compare versions

Comparing version 1.5.8 to 1.5.9

9

dist/fullAst.js

@@ -30,2 +30,3 @@ var __defProp = Object.defineProperty;

CharacterType2[CharacterType2["replacerStart"] = 2] = "replacerStart";
CharacterType2[CharacterType2["quote"] = 12] = "quote";
})(CharacterType || (CharacterType = {}));

@@ -213,2 +214,5 @@ var Scope;

controlIdentifierTypes["(".charCodeAt(0)] = 6;
charTypes[`"`.charCodeAt(0)] = 12;
charTypes[`'`.charCodeAt(0)] = 12;
charTypes["`".charCodeAt(0)] = 12;
controlIdentifierSkipLength[1] = "inline".length;

@@ -227,2 +231,3 @@ controlIdentifierSkipLength[4] = "run".length;

operationsByControlIdentifier.fill(2);
operationsByControlIdentifier[0] = 0;
operationsByControlIdentifier[2] = 7;

@@ -300,7 +305,7 @@ operationsByControlIdentifier[6] = 4;

column++;
if (operation === 0 && cursor === 4) {
if (operation === 0 && cursor === 4 && (prevCursor !== 12 || controlIdentifierTypes[code.charCodeAt(position + 1)])) {
controlIdentifierType = getControlIdentifier(code, position);
skipLength = controlIdentifierSkipLength[controlIdentifierType] | 0;
if (controlIdentifierType === 0 || keywordNames[controlIdentifierType] !== code.substring(position + 1, position + skipLength + 1)) {
throw new AtbuildParseError(0, `Invalid @ keyword in ${filename}:${line}:${column - 1}`, `Must be @run, @build, @export function $, @inline, @(buildCode), or @end. Received "${code.substring(position).split(" ")[0].slice(0, 10).replace("\n", "\\n")}"
throw new AtbuildParseError(0, `Invalid @ keyword in ${filename}:${line}:${column - 1}`, `Invalid @ keyword in ${filename}:${line}:${column - 1}. Must be @run, @build, @export function $, @inline, @(buildCode), or @end. Received "${code.substring(position).split(" ")[0].slice(0, 10).replace("\n", "\\n")}"
`);

@@ -307,0 +312,0 @@ } else if (controlIdentifierType === 5) {

@@ -34,3 +34,4 @@ var __create = Object.create;

interpolatedBuild: _path("interpolated-build.tsb"),
multipleInlineFields: _path("multiple-inline-fields.tsb")
multipleInlineFields: _path("multiple-inline-fields.tsb"),
scopedImport: _path("scoped-import.tsb")
};

@@ -45,3 +46,14 @@ const SAMPLES = {

interpolatedBuild: fs.default.readFileSync(paths.interpolatedBuild, "utf8"),
multipleInlineFields: fs.default.readFileSync(paths.multipleInlineFields, "utf8")
multipleInlineFields: fs.default.readFileSync(paths.multipleInlineFields, "utf8"),
scopedImport: `
@build
import {Bacon} from '@bacon/foo';
@end
@run
import {Lox} from '@bagel/cream';
@end
`
};

@@ -82,4 +94,6 @@ describe("AtBuild Full", () => {

run("hoursFormatter");
debugger;
});
it("loads scoped import sample", () => {
run("scopedImport");
});
it("loads log sample", () => {

@@ -86,0 +100,0 @@ code = run("log");

@@ -155,3 +155,3 @@ var __create = Object.create;

expect(line).toBeTruthy();
expect(line).not.toContain(".push");
expect(line).not.toContain("+= (");
expect(light.quickTest(code)).toBe(true);

@@ -173,6 +173,6 @@ });

expect(buildLine).toBeTruthy();
expect(buildLine).not.toContain(".push");
expect(buildLine).not.toContain("+= (");
const runtimeLine = lines.find((l) => l.includes("export const hourFormatter ="));
expect(runtimeLine).toBeTruthy();
expect(runtimeLine).toContain(".push");
expect(runtimeLine).toContain("+= (");
});

@@ -193,6 +193,6 @@ it("works interpolated function calls of varying depth", () => {

expect(buildLine).toBeTruthy();
expect(buildLine).not.toContain(".push");
expect(buildLine).not.toContain("+= (");
const runtimeLine = lines.find((l) => l.includes("export const hourFormatter ="));
expect(runtimeLine).toBeTruthy();
expect(runtimeLine).toContain(".push");
expect(runtimeLine).toContain("+= (");
});

@@ -228,12 +228,12 @@ it("works with multiline build-time only lines and interpolated function calls", () => {

expect(buildLine).toBeTruthy();
expect(buildLine).not.toContain(".push");
expect(buildLine).not.toContain("+= (");
expect(baconLine).toBeTruthy();
expect(baconLine).not.toContain(".push");
expect(baconLine).not.toContain("+= (");
expect(whoisjaSON).toBeTruthy();
expect(whoisjaSON).not.toContain(".push");
expect(whoisjaSON).not.toContain("+= (");
const runtimeLine = lines.find((l) => l.includes("export const hourFormatter ="));
expect(runtimeLine).toBeTruthy();
expect(runtimeLine).toContain(".push");
expect(runtimeLine).toContain("+= (");
expect(light.quickTest(code)).toBeTruthy();
});
});

@@ -13,20 +13,29 @@ module.exports = (nextConfig = {}) => {

}
const nextBabelLoaderContainer = config.module.rules.find((rule) => {
return rule.use && rule.use.loader && rule.use.loader === "next-babel-loader" || rule.use && rule.use.find((loader) => loader.loader === "next-babel-loader");
});
if (nextBabelLoaderContainer) {
let loader;
if (nextBabelLoaderContainer.use.loader === "next-babel-loader") {
loader = nextBabelLoaderContainer.use;
function findBabelLoaderInRules(rule) {
if (typeof rule === "object" && rule.loader === "next-babel-loader") {
return rule.options;
} else if (typeof rule.use === "object" && rule.use.length && rule.use[0]) {
for (let _rule of rule.use) {
const __rule = findBabelLoaderInRules(_rule);
if (__rule) {
return __rule;
}
}
} else if (typeof rule.use === "object" && rule.use.loader === "next-babel-loader") {
return rule.use.options;
} else {
loader = nextBabelLoaderContainer.use.find((loader2) => loader2.loader === "next-babel-loader");
return null;
}
config.resolve.extensions.unshift(".@js", ".jsb", ".tsb", ".@ts");
const fs = require("fs");
let tsconfig;
if (fs.existsSync("./tsconfig.json")) {
tsconfig = require(require("path").resolve("./tsconfig.json"));
}
}
const loader = {
loader: "next-babel-loader",
options: findBabelLoaderInRules({use: config.module.rules})
};
config.resolve.extensions.unshift(".@js", ".jsb", ".tsb", ".@ts");
const fs = require("fs");
let tsconfig;
if (fs.existsSync("./tsconfig.json")) {
tsconfig = require(require("path").resolve("./tsconfig.json"));
config.module.rules.push({
test: /\.(@js|jsb)$/,
test: /\.(@ts|tsb)$/,
type: "javascript/auto",

@@ -39,3 +48,4 @@ enforce: "pre",

options: {
typescript: false,
tsconfig,
typescript: true,
...nextConfig.atbuild || {}

@@ -47,7 +57,7 @@ }

config.module.rules.push({
test: /\.(@ts|tsb)$/,
test: /\.(jsx|js|ts|tsx)$/,
type: "javascript/auto",
enforce: "pre",
exclude: /node_modules/,
use: [
loader,
{

@@ -63,4 +73,5 @@ loader: "atbuild/dist/webpack-loader",

});
} else {
config.module.rules.push({
test: /\.(jsx|js|ts|tsx)$/,
test: /\.(jsx|js)$/,
type: "javascript/auto",

@@ -73,4 +84,3 @@ enforce: "pre",

options: {
tsconfig,
typescript: true,
typescript: false,
...nextConfig.atbuild || {}

@@ -81,5 +91,18 @@ }

});
} else {
throw "Atbuild failed to detect webpack-loader so it won't work. Please file an issue.";
}
config.module.rules.push({
test: /\.(@js|jsb)$/,
type: "javascript/auto",
enforce: "pre",
use: [
loader,
{
loader: "atbuild/dist/webpack-loader",
options: {
typescript: false,
...nextConfig.atbuild || {}
}
}
]
});
return config;

@@ -86,0 +109,0 @@ }

{
"name": "atbuild",
"version": "1.5.8",
"version": "1.5.9",
"main": "dist/atbuild.js",

@@ -5,0 +5,0 @@ "browser": "web/atbuild.js",

@@ -111,2 +111,3 @@ var __defProp = Object.defineProperty;

CharacterType2[CharacterType2["replacerStart"] = 2] = "replacerStart";
CharacterType2[CharacterType2["quote"] = 12] = "quote";
})(CharacterType || (CharacterType = {}));

@@ -294,2 +295,5 @@ var Scope;

controlIdentifierTypes["(".charCodeAt(0)] = 6;
charTypes[`"`.charCodeAt(0)] = 12;
charTypes[`'`.charCodeAt(0)] = 12;
charTypes["`".charCodeAt(0)] = 12;
controlIdentifierSkipLength[1] = "inline".length;

@@ -308,2 +312,3 @@ controlIdentifierSkipLength[4] = "run".length;

operationsByControlIdentifier.fill(2);
operationsByControlIdentifier[0] = 0;
operationsByControlIdentifier[2] = 7;

@@ -381,7 +386,7 @@ operationsByControlIdentifier[6] = 4;

column++;
if (operation === 0 && cursor === 4) {
if (operation === 0 && cursor === 4 && (prevCursor !== 12 || controlIdentifierTypes[code.charCodeAt(position + 1)])) {
controlIdentifierType = getControlIdentifier(code, position);
skipLength = controlIdentifierSkipLength[controlIdentifierType] | 0;
if (controlIdentifierType === 0 || keywordNames[controlIdentifierType] !== code.substring(position + 1, position + skipLength + 1)) {
throw new AtbuildParseError(0, `Invalid @ keyword in ${filename}:${line}:${column - 1}`, `Must be @run, @build, @export function $, @inline, @(buildCode), or @end. Received "${code.substring(position).split(" ")[0].slice(0, 10).replace("\n", "\\n")}"
throw new AtbuildParseError(0, `Invalid @ keyword in ${filename}:${line}:${column - 1}`, `Invalid @ keyword in ${filename}:${line}:${column - 1}. Must be @run, @build, @export function $, @inline, @(buildCode), or @end. Received "${code.substring(position).split(" ")[0].slice(0, 10).replace("\n", "\\n")}"
`);

@@ -388,0 +393,0 @@ } else if (controlIdentifierType === 5) {

@@ -18,2 +18,3 @@ // src/fullAst.ts

CharacterType2[CharacterType2["replacerStart"] = 2] = "replacerStart";
CharacterType2[CharacterType2["quote"] = 12] = "quote";
})(CharacterType || (CharacterType = {}));

@@ -201,2 +202,5 @@ var Scope;

controlIdentifierTypes["(".charCodeAt(0)] = 6;
charTypes[`"`.charCodeAt(0)] = 12;
charTypes[`'`.charCodeAt(0)] = 12;
charTypes["`".charCodeAt(0)] = 12;
controlIdentifierSkipLength[1] = "inline".length;

@@ -215,2 +219,3 @@ controlIdentifierSkipLength[4] = "run".length;

operationsByControlIdentifier.fill(2);
operationsByControlIdentifier[0] = 0;
operationsByControlIdentifier[2] = 7;

@@ -288,7 +293,7 @@ operationsByControlIdentifier[6] = 4;

column++;
if (operation === 0 && cursor === 4) {
if (operation === 0 && cursor === 4 && (prevCursor !== 12 || controlIdentifierTypes[code.charCodeAt(position + 1)])) {
controlIdentifierType = getControlIdentifier(code, position);
skipLength = controlIdentifierSkipLength[controlIdentifierType] | 0;
if (controlIdentifierType === 0 || keywordNames[controlIdentifierType] !== code.substring(position + 1, position + skipLength + 1)) {
throw new AtbuildParseError(0, `Invalid @ keyword in ${filename}:${line}:${column - 1}`, `Must be @run, @build, @export function $, @inline, @(buildCode), or @end. Received "${code.substring(position).split(" ")[0].slice(0, 10).replace("\n", "\\n")}"
throw new AtbuildParseError(0, `Invalid @ keyword in ${filename}:${line}:${column - 1}`, `Invalid @ keyword in ${filename}:${line}:${column - 1}. Must be @run, @build, @export function $, @inline, @(buildCode), or @end. Received "${code.substring(position).split(" ")[0].slice(0, 10).replace("\n", "\\n")}"
`);

@@ -295,0 +300,0 @@ } else if (controlIdentifierType === 5) {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc