Compiler config parsing is currently done with new Function(...) which is a XSS vulnerability. Replacing this with json parsing for safety reasons. Almost all compiler options (except for moduleTypeProvider) are json compatible, so this isn't a big change to capabilities. Previously created playground URLs with non-default configs may not be compatible with this change, but we should be able to get the correct config manually (by reading the JS version)
32 lines
583 B
TypeScript
32 lines
583 B
TypeScript
/**
|
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*/
|
|
|
|
import type {Store} from './stores';
|
|
|
|
const index = `\
|
|
export default function MyApp() {
|
|
return <div>Hello World</div>;
|
|
}
|
|
`;
|
|
|
|
export const defaultConfig = `\
|
|
{
|
|
//compilationMode: "all"
|
|
}`;
|
|
|
|
export const defaultStore: Store = {
|
|
source: index,
|
|
config: defaultConfig,
|
|
showInternals: false,
|
|
};
|
|
|
|
export const emptyStore: Store = {
|
|
source: '',
|
|
config: '',
|
|
showInternals: false,
|
|
};
|