Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions packages/snack-content/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,15 @@
"semver": "^7.3.4"
},
"devDependencies": {
"@types/jest": "^27.4.0",
"@types/jest": "^29.5.12",
"@types/semver": "^7.3.9",
"eslint": "^8.49.0",
"eslint-config-universe": "^12.0.0",
"jest": "^27.5.1",
"jest": "^29.7.0",
"jest-prettier": "npm:prettier@^2.8.8",
"prettier": "^3.0.3",
"rimraf": "^3.0.2",
"ts-jest": "~27.1.3",
"ts-jest": "^29.1.2",
"typescript": "^4.1.2"
},
"eslintConfig": {
Expand Down
8 changes: 4 additions & 4 deletions packages/snack-content/src/__tests__/urls-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ describe(parseRuntimeUrl, () => {
it('returns info with only "sdkVersion"', () => {
expect(parseRuntimeUrl('exp://u.expo.dev/xxx?runtime-version=exposdk:69.0.0'))
.toMatchInlineSnapshot(`
Object {
{
"channel": undefined,
"sdkVersion": "69.0.0",
"snack": undefined,
Expand All @@ -52,7 +52,7 @@ describe(parseRuntimeUrl, () => {
it('returns info with "sdkVersion" and "snack"', () => {
expect(parseRuntimeUrl('exp://u.expo.dev/xxx?runtime-version=exposdk:69.0.0&snack=snackid'))
.toMatchInlineSnapshot(`
Object {
{
"channel": undefined,
"sdkVersion": "69.0.0",
"snack": "snackid",
Expand All @@ -66,7 +66,7 @@ describe(parseRuntimeUrl, () => {
'exp://u.expo.dev/xxx?runtime-version=exposdk:69.0.0&snack-channel=channelid',
),
).toMatchInlineSnapshot(`
Object {
{
"channel": "channelid",
"sdkVersion": "69.0.0",
"snack": undefined,
Expand All @@ -80,7 +80,7 @@ describe(parseRuntimeUrl, () => {
'exp://u.expo.dev/xxx?runtime-version=exposdk:69.0.0&snack=snackid&snack-channel=channelid',
),
).toMatchInlineSnapshot(`
Object {
{
"channel": "channelid",
"sdkVersion": "69.0.0",
"snack": "snackid",
Expand Down
6 changes: 3 additions & 3 deletions packages/snack-eslint-standalone/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,14 @@
"@babel/preset-env": "^7.18.9",
"@babel/preset-typescript": "^7.18.6",
"@tsconfig/node16": "^1.0.3",
"@types/jest": "^28.1.6",
"babel-jest": "^28.1.3",
"@types/jest": "^29.5.12",
"babel-jest": "^29.7.0",
"babel-loader": "^8.2.5",
"eslint": "^8.20.0",
"eslint-plugin-react": "^7.30.1",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-react-native": "^4.0.0",
"jest": "^28.1.3",
"jest": "^29.7.0",
"node-polyfill-webpack-plugin": "^2.0.0",
"patch-package": "^6.4.7",
"snack-babel-standalone": "^3.0.1",
Expand Down
1,171 changes: 718 additions & 453 deletions packages/snack-eslint-standalone/yarn.lock

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions packages/snack-require-context/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,12 @@
"@babel/core": "^7.18.9",
"@babel/types": "^7.12.7",
"@tsconfig/node16": "^1.0.2",
"@types/jest": "^26.0.20",
"@types/jest": "^29.5.12",
"eslint": "^8.49.0",
"eslint-config-universe": "^12.0.0",
"jest": "^26.6.3",
"jest": "^29.7.0",
"prettier": "^3.0.3",
"ts-jest": "^26.5.0",
"ts-jest": "^29.1.2",
"typescript": "^4.7.4"
},
"eslintConfig": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,37 +5,37 @@ import { snackRequireContextVirtualModuleBabelPlugin } from '../babel';
describe(snackRequireContextVirtualModuleBabelPlugin, () => {
it(`creates virtual module for require.context('./app')`, () => {
expect(transpile(`require.context('./app')`)).toMatchInlineSnapshot(
`"require(\\"./app?ctx=eyJyIjp0cnVlLCJtIjoiLioiLCJvIjoic3luYyJ9\\");"`,
`"require("./app?ctx=eyJyIjp0cnVlLCJtIjoiLioiLCJvIjoic3luYyJ9");"`,
);
});

it(`creates virtual module for require.context('module://components')`, () => {
expect(transpile(`require.context('module://components')`)).toMatchInlineSnapshot(
`"require(\\"module://components?ctx=eyJyIjp0cnVlLCJtIjoiLioiLCJvIjoic3luYyJ9\\");"`,
`"require("module://components?ctx=eyJyIjp0cnVlLCJtIjoiLioiLCJvIjoic3luYyJ9");"`,
);
});

it('creates virtual module for require.context("./app", false)', () => {
expect(transpile(`require.context('./app', false)`)).toMatchInlineSnapshot(
`"require(\\"./app?ctx=eyJyIjpmYWxzZSwibSI6Ii4qIiwibyI6InN5bmMifQ\\");"`,
`"require("./app?ctx=eyJyIjpmYWxzZSwibSI6Ii4qIiwibyI6InN5bmMifQ");"`,
);
});

it('creates virtual module for require.context("./app", false, /\\.mdx$/)', () => {
expect(transpile(`require.context('./app', false, /\\.mdx$/)`)).toMatchInlineSnapshot(
`"require(\\"./app?ctx=eyJyIjpmYWxzZSwibSI6IlxcLm1keCQiLCJvIjoic3luYyJ9\\");"`,
`"require("./app?ctx=eyJyIjpmYWxzZSwibSI6IlxcLm1keCQiLCJvIjoic3luYyJ9");"`,
);
});

it('creates virtual module for require.context("./app", false, /\\.mdx$/, "async")', () => {
expect(transpile(`require.context('./app', false, /\\.mdx$/, 'async')`)).toMatchInlineSnapshot(
`"require(\\"./app?ctx=eyJyIjpmYWxzZSwibSI6IlxcLm1keCQiLCJvIjoiYXN5bmMifQ\\");"`,
`"require("./app?ctx=eyJyIjpmYWxzZSwibSI6IlxcLm1keCQiLCJvIjoiYXN5bmMifQ");"`,
);
});

it('creates virtual module for require.context(EXPO_ROUTER_APP_ROOT)', () => {
expect(transpile(`require.context(process.env.EXPO_ROUTER_APP_ROOT)`)).toMatchInlineSnapshot(
`"require(\\"module://app?ctx=eyJyIjp0cnVlLCJtIjoiLioiLCJvIjoic3luYyJ9\\");"`,
`"require("module://app?ctx=eyJyIjp0cnVlLCJtIjoiLioiLCJvIjoic3luYyJ9");"`,
);
});

Expand All @@ -50,7 +50,7 @@ describe(snackRequireContextVirtualModuleBabelPlugin, () => {
`;

expect(transpile(code, { EXPO_ROUTER_IMPORT_MODE: 'async' })).toMatchInlineSnapshot(
`"require(\\"module://app?ctx=eyJyIjp0cnVlLCJtIjoiLioiLCJvIjoiYXN5bmMifQ\\");"`,
`"require("module://app?ctx=eyJyIjp0cnVlLCJtIjoiLioiLCJvIjoiYXN5bmMifQ");"`,
);
});

Expand Down
2 changes: 1 addition & 1 deletion packages/snack-require-context/src/utils/babel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export function snackRequireContextVirtualModuleBabelPlugin({
// Resolve the context directory, either from user code or library code
const contextDirectory =
// @ts-expect-error The plugin options aren't typed
state.opts.directoryResolution === 'relative'
state.opts.directoryResolution === 'relative' && state.filename
? resolveContextDirectory(sanitizeFilePath(state.filename), directory)
: directory;

Expand Down
6 changes: 3 additions & 3 deletions packages/snack-sdk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"@expo/spawn-async": "^1.5.0",
"@koa/router": "^10.0.0",
"@types/diff": "^4.0.2",
"@types/jest": "^26.0.20",
"@types/jest": "^29.5.12",
"@types/koa": "^2.11.6",
"@types/koa-bodyparser": "^4.3.0",
"@types/koa__router": "^8.0.3",
Expand All @@ -53,12 +53,12 @@
"eslint": "^8.49.0",
"eslint-config-universe": "^12.0.0",
"form-data": "^3.0.0",
"jest": "^26.6.3",
"jest": "^29.7.0",
"jest-fetch-mock": "^3.0.3",
"koa": "^2.13.0",
"koa-bodyparser": "^4.3.0",
"prettier": "^3.0.3",
"ts-jest": "^26.5.0",
"ts-jest": "^29.1.2",
"typedoc": "^0.19.2",
"typedoc-plugin-markdown": "^3.0.11",
"typescript": "^4.1.2"
Expand Down
4 changes: 2 additions & 2 deletions packages/snack-sdk/src/DependencyResolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ export default class DependencyResolver {
data,
);
return;
} catch (e) {
} catch (e: any) {
return Promise.reject(e);
}
}
Expand All @@ -106,7 +106,7 @@ export default class DependencyResolver {
throw new Error(error);
}
}
} catch (e) {
} catch (e: any) {
const error = createError({
message: `Failed to resolve dependency '${key}' (${e.message})`,
fileName: key,
Expand Down
4 changes: 2 additions & 2 deletions packages/snack-sdk/src/FileUploader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,11 +116,11 @@ export default class FileUploader {
delete this.status[path];
try {
this.callback({ path, file }, resultURL);
} catch (e) {
} catch (e: any) {
return Promise.reject(e);
}
}
} catch (e) {
} catch (e: any) {
const error = createError({
message: `Failed to upload file ${path} (${e.message})`,
fileName: path,
Expand Down
2 changes: 1 addition & 1 deletion packages/snack-sdk/src/__mocks__/snackager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export default function createSnackager(config: SnackagerConfig = defaultConfig)
handle: `snackager-1/${name.replace('/', '~')}@${version}`,
dependencies: bundle.peerDependencies,
};
} catch (e) {
} catch (e: any) {
ctx.status = 500;
ctx.body = e.message;
}
Expand Down
2 changes: 1 addition & 1 deletion packages/snack-sdk/src/__mocks__/versions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export default function createApp(
const versions = config[sdkVersion];
if (!versions) throw new Error(`SDK version '${sdkVersion}' not supported`);
ctx.body = versions;
} catch (e) {
} catch (e: any) {
ctx.status = 500;
ctx.body = e.message;
}
Expand Down
2 changes: 1 addition & 1 deletion packages/snack-sdk/src/__mocks__/www.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export default function createWww() {
key,
hashId: '00000000',
};
} catch (e) {
} catch (e: any) {
ctx.status = 500;
ctx.body = e.message;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`code receives valid code diff 1`] = `
Object {
{
"app.js": "Index: code
===================================================================
--- code
+++ code
@@ -1,0 +1,1 @@
\\\\ No newline at end of file
\\ No newline at end of file
+hoi
\\\\ No newline at end of file
\\ No newline at end of file
",
}
`;

exports[`code receives valid dependencies 1`] = `
Object {
"expo-firebase-analytics": Object {
{
"expo-firebase-analytics": {
"handle": "snackager-1/[email protected]",
"resolved": "8.1.1",
"version": "~8.1.0",
Expand Down
Loading
Loading