Skip to content

SourceCode module should provide scriptURL when running livereload without webdebugger #3803

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Dec 20, 2019
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
7 changes: 7 additions & 0 deletions .ado/windows-vs-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,13 @@ jobs:
/p:RNW_PKG_VERSION_STR="Private Build"
/p:RNW_PKG_VERSION="1000,0,0,0"

- task: CmdLine@2
displayName: Build react-native-win32 RNTester bundle
inputs:
script: yarn bundle
workingDirectory: packages/react-native-win32
condition: and(succeeded(), eq(variables['BuildConfiguration'], 'Debug'), eq(variables['BuildPlatform'], 'x64'))

- task: VSTest@2
displayName: Run Desktop Unit Tests
timeoutInMinutes: 5 # Set smaller timeout , due to hangs
Expand Down
43 changes: 24 additions & 19 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,31 +8,33 @@
"**/dist": true
},
"editor.formatOnSave": true,
// turn off formatting for JS and JSX, we will do this via eslint
"[javascript]": {
"editor.formatOnSave": false
},
"[javascriptreact]": {
"editor.formatOnSave": false
},
"[typescript]": {
"editor.formatOnSave": false
},
"[typescriptreact]": {
"editor.formatOnSave": false
},
"eslint.format.enable": true,
"eslint.packageManager": "yarn",
"eslint.autoFixOnSave": true,
"eslint.enable": true,
"eslint.validate": [
{"language": "javascript", "autoFix": true},
{"language": "javascriptreact", "autoFix": true},
{"language": "typescript", "autoFix": true},
{"language": "typescriptreact", "autoFix": true}
"javascript",
"javascriptreact",
"typescript",
"typescriptreact"
],
"eslint.options": {
"configFile": "./vnext/.eslintrc.js"
},
"[json]": {
"editor.defaultFormatter": "dbaeumer.vscode-eslint"
},
"[jsonc]": {
"editor.defaultFormatter": "dbaeumer.vscode-eslint"
},
"[typescript]": {
"editor.defaultFormatter": "dbaeumer.vscode-eslint"
},
"[typescriptreact]": {
"editor.defaultFormatter": "dbaeumer.vscode-eslint"
},
"[javascript]": {
"editor.defaultFormatter": "dbaeumer.vscode-eslint"
},
// These should run through eslint
"prettier.disableLanguages": [
"javascript",
Expand All @@ -44,5 +46,8 @@
"clang-format.language.typescript.enable": false,
"clang-format.assumeFilename": "${workspaceFolder}/.clang-format",
"clang-format.executable": "${workspaceRoot}/vnext/node_modules/.bin/clang-format",
"typescript.tsdk": "node_modules\\typescript\\lib"
"typescript.tsdk": "node_modules\\typescript\\lib",
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"type": "none",
"comment": "Dont checkin generated index files",
"packageName": "@office-iss/react-native-win32",
"email": "acoates@microsoft.com",
"commit": "ee0de45b4e776cd6d110b6e5fdb94bfbae1c7133",
"date": "2019-12-18T22:17:55.695Z"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"type": "prerelease",
"comment": "Provide source uri in SourceCode module when using livereload",
"packageName": "react-native-windows",
"email": "acoates@microsoft.com",
"commit": "ee0de45b4e776cd6d110b6e5fdb94bfbae1c7133",
"date": "2019-12-18T22:17:59.673Z"
}
1 change: 1 addition & 0 deletions packages/react-native-win32/.gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/demo
/dist
/index.*
/IntegrationTests
/jest
/lib
Expand Down
9 changes: 9 additions & 0 deletions packages/react-native-win32/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# @office-iss/react-native-win32

**Internal use only**

To better support some of our open source efforts, we are publishing this @office-iss/react-native-win32 JS package that office uses on win32. This is not a package that is generally consumable by other since it requires Office's UI framework which isn't open source. But it does allow some of our other cross platform efforts to be able to open source their work where previously its been unable to if Office win32 was one of the target platforms. This will enable projects such as our cross platform component libraries to be able to be published to open source.

# Running react-native on win32.

We do have a solution for running react-native in a win32 app. You can run react-native-windows on win32 using Xaml Islands. We are working on expanding the set of supported windows versions to broaden the support of that, and provide more samples of how to do that.
2 changes: 1 addition & 1 deletion packages/react-native-win32/docs/api/react-native-win32.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ This package provides Win32 specific components and provides JS implementations
| --- | --- |
| [ButtonWin32](./react-native-win32.buttonwin32.md) | React-native <Button> control with additional Win32-specific functionality. |
| [TextWin32](./react-native-win32.textwin32.md) | |
| [TouchableWin32](./react-native-win32.touchablewin32.md) | TouchableWin32 is a 'compentantization' of the Touchable Mixin in React Native. This means that instead of implementing components such as TouchableHighlight via the mixin, they are merely implemented as wrappers around TouchableWin32, forwarding the correct set of props. Additionally, TouchableWin32 supports hover via onMouseEnter and onMouseLeave and focus/blur via onFocus/onBlur. TouchableWin32 also allows for functions as child components (that use the internal state of the touchable to conditionally render children) as well functions as styles (that use internal state to conditionally calculate styles) |
| [TouchableWin32](./react-native-win32.touchablewin32.md) | TouchableWin32 is a 'componentization' of the Touchable Mixin in React Native. This means that instead of implementing components such as TouchableHighlight via the mixin, they are merely implemented as wrappers around TouchableWin32, forwarding the correct set of props. Additionally, TouchableWin32 supports hover via onMouseEnter and onMouseLeave and focus/blur via onFocus/onBlur. TouchableWin32 also allows for functions as child components (that use the internal state of the touchable to conditionally render children) as well functions as styles (that use internal state to conditionally calculate styles) |
| [ViewWin32](./react-native-win32.viewwin32.md) | |

## Enumerations
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

## TouchableWin32 class

TouchableWin32 is a 'compentantization' of the Touchable Mixin in React Native. This means that instead of implementing components such as TouchableHighlight via the mixin, they are merely implemented as wrappers around TouchableWin32, forwarding the correct set of props. Additionally, TouchableWin32 supports hover via onMouseEnter and onMouseLeave and focus/blur via onFocus/onBlur. TouchableWin32 also allows for functions as child components (that use the internal state of the touchable to conditionally render children) as well functions as styles (that use internal state to conditionally calculate styles)
TouchableWin32 is a 'componentization' of the Touchable Mixin in React Native. This means that instead of implementing components such as TouchableHighlight via the mixin, they are merely implemented as wrappers around TouchableWin32, forwarding the correct set of props. Additionally, TouchableWin32 supports hover via onMouseEnter and onMouseLeave and focus/blur via onFocus/onBlur. TouchableWin32 also allows for functions as child components (that use the internal state of the touchable to conditionally render children) as well functions as styles (that use internal state to conditionally calculate styles)

<b>Signature:</b>

Expand Down
2 changes: 0 additions & 2 deletions packages/react-native-win32/index.d.ts

This file was deleted.

3 changes: 0 additions & 3 deletions packages/react-native-win32/index.js

This file was deleted.

1 change: 0 additions & 1 deletion packages/react-native-win32/index.js.map

This file was deleted.

15 changes: 15 additions & 0 deletions packages/react-native-win32/just-task.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
*/

const path = require('path');
const fs = require('fs');
const {
task,
copyTask,
Expand Down Expand Up @@ -68,6 +69,20 @@ task('clean', () => {
);
});

function ensureDirectoryExists(filePath) {
const dir = path.dirname(filePath);
if (!fs.existsSync(dir)) {
ensureDirectoryExists(dir);
fs.mkdirSync(dir);
}
}

task('prepareBundle', () => {
ensureDirectoryExists(
path.resolve(__dirname, 'dist/win32/dev/index.win32.bundle'),
);
});

task(
'build',
series(
Expand Down
2 changes: 1 addition & 1 deletion packages/react-native-win32/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"lint": "just-scripts eslint",
"lint:fix": "eslint ./**/*.js ./**/*.ts? --fix",
"watch": "tsc -w",
"bundle": "react-native bundle --platform win32 --entry-file RNTester.js --bundle-output dist/win32/dev/index.win32.bundle --assets-dest dist/win32/dev",
"bundle": "just-scripts prepareBundle && react-native bundle --platform win32 --entry-file RNTester.js --bundle-output dist/win32/dev/index.win32.bundle --assets-dest dist/win32/dev",
"run-win32": "rex-win32 --bundle RNTester.win32 --component RNTesterApp --basePath ./dist/win32/dev",
"run-win32-devmain": "rex-win32 --bundle RNTester.win32 --component RNTesterApp --basePath ./dist/win32/dev --useDevMain",
"run-win32-dev-web": "rex-win32 --bundle RNTester.win32 --component RNTesterApp --basePath ./dist/win32/dev --useWebDebugger"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ const LONG_PRESS_DELAY_MS = LONG_PRESS_THRESHOLD - HIGHLIGHT_DELAY_MS;
const LONG_PRESS_ALLOWED_MOVEMENT = 10;

/**
* TouchableWin32 is a 'compentantization' of the Touchable Mixin in React Native.
* TouchableWin32 is a 'componentization' of the Touchable Mixin in React Native.
* This means that instead of implementing components such as TouchableHighlight
* via the mixin, they are merely implemented as wrappers around TouchableWin32,
* forwarding the correct set of props. Additionally, TouchableWin32 supports hover
Expand Down
15 changes: 8 additions & 7 deletions vnext/Shared/OInstance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -730,13 +730,14 @@ std::vector<std::unique_ptr<NativeModule>> InstanceImpl::GetDefaultNativeModules

// TODO - Encapsulate this in a helpers, and make sure callers add it to their
// list
std::string bundleUrl = m_devSettings->useWebDebugger ? DevServerHelper::get_BundleUrl(
m_devSettings->debugHost,
m_devSettings->debugBundlePath,
m_devSettings->platformName,
"true" /*dev*/,
"false" /*hot*/)
: std::string();
std::string bundleUrl = (m_devSettings->useWebDebugger || m_devSettings->liveReloadCallback)
? DevServerHelper::get_BundleUrl(
m_devSettings->debugHost,
m_devSettings->debugBundlePath,
m_devSettings->platformName,
"true" /*dev*/,
"false" /*hot*/)
: std::string();
modules.push_back(std::make_unique<CxxNativeModule>(
m_innerInstance,
facebook::react::SourceCodeModule::name,
Expand Down